source: trunk/dports/science/gate/Portfile

Last change on this file was 141867, checked in by mojca@…, 2 years ago

gate: update (now works with geant4.10.1.p02), enable optical tracking of photons, 'fix' the regex

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.6 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 141867 2015-10-30 11:31:22Z ryandesign@macports.org $
3
4# Keep in sync with Geant4 (and/or implement a PortGroup)
5
6PortSystem          1.0
7PortGroup           app 1.0
8PortGroup           cmake 1.0
9PortGroup           github 1.0
10PortGroup           active_variants 1.1
11
12set git_sha         0be152cf
13set git_date        20151007
14
15github.setup        OpenGATE Gate ${git_sha}
16name                gate
17version             7.1
18revision            5
19# version           7.1-git-${git_date}-${git_sha}
20
21categories          science
22maintainers         mojca openmaintainer
23license             LGPL
24description         GATE description
25long_description    GATE is dedicated to numerical simulations in medical imaging and radiotherapy. \
26                    It currently supports simulations of Emission Tomography (PET and SPECT), \
27                    Computed Tomography (CT) and Radiotherapy experiments.
28homepage            http://www.opengatecollaboration.org
29platforms           darwin
30
31checksums           rmd160  8e5316fa5984541c6afa11f6194b970cdf74ab9b \
32                    sha256  4fcab7083b675804397fdf91e4a79ebcb185dbb3a7ff98c8430e8a8ec0d57911
33
34# TODO: take this data from a geant4 portgroup
35set geant.data_versions_10.1 {
36    G4NDL              4.5   G4NDL                G4NEUTRONHPDATA
37    G4EMLOW            6.41  G4EMLOW              G4LEDATA
38    PhotonEvaporation  3.1   G4PhotonEvaporation  G4LEVELGAMMADATA
39    RadioactiveDecay   4.2   G4RadioactiveDecay   G4RADIOACTIVEDATA
40    G4NEUTRONXS        1.4   G4NEUTRONXS          G4NEUTRONXSDATA
41    G4PII              1.3   G4PII                G4PIIDATA
42    RealSurface        1.0   RealSurface          G4REALSURFACEDATA
43    G4SAIDDATA         1.1   G4SAIDDATA           G4SAIDXSDATA
44    G4ABLA             3.0   G4ABLA               G4ABLADATA
45    G4ENSDFSTATE       1.0   G4ENSDFSTATE         G4ENSDFSTATEDATA
46}
47set geant.data_versions_10.0 {
48    G4NDL              4.4   G4NDL                G4NEUTRONHPDATA
49    G4EMLOW            6.35  G4EMLOW              G4LEDATA
50    PhotonEvaporation  3.0   G4PhotonEvaporation  G4LEVELGAMMADATA
51    RadioactiveDecay   4.0   G4RadioactiveDecay   G4RADIOACTIVEDATA
52    G4NEUTRONXS        1.4   G4NEUTRONXS          G4NEUTRONXSDATA
53    G4PII              1.3   G4PII                G4PIIDATA
54    RealSurface        1.0   RealSurface          G4REALSURFACEDATA
55    G4SAIDDATA         1.1   G4SAIDDATA           G4SAIDXSDATA
56    G4ABLA             3.0   G4ABLA               G4ABLADATA
57    G4ENSDFSTATE       1.0   G4ENSDFSTATE         G4ENSDFSTATEDATA
58}
59
60set geant.datadir ""
61set geant.data_versions ""
62
63app.name            Gate
64app.executable      Gate
65app.icon            ${filespath}/gate.png
66
67cmake.out_of_source yes
68
69depends_lib         port:root5
70
71patchfiles-append   patch-addmenu.diff
72
73configure.args-append \
74                    -DGATE_USE_OPTICAL=ON \
75                    -DGATE_USE_SYSTEM_CLHEP=OFF \
76                    -DROOT_CONFIG_EXECUTABLE=${prefix}/libexec/root5/bin/root-config
77                    # ROOT is optional: we could make a variant if needed
78
79post-patch {
80    # patch examples if needed
81    if {[variant_isset examples]} {
82        foreach f [exec find "${worksrcpath}/examples" -type f -name "*.mac"] {
83            # gpumacros/ct/mac/visu.mac gpumacros/optical/macro_biolum_cpu.mac gpumacros/optical/macro_biolum_gpu.mac gpumacros/pet/mac/visu.mac gpumacros/photradthera/mac/visu.mac example_CT/classic/visu.mac example_CT/fast/visu.mac example_CT/vrt/visu.mac example_OPTICAL/macro/Visualisation.mac example_PET/PET_CylindricalPET_System.mac example_PET/PET_Ecat_System.mac example_PHANTOM_SOURCE/Voxelized_Phantom_Source/mainMacro.mac example_SPECT/vis.mac example_TimeActivityCurve/vis.mac example_TrackerDetector/visu.mac
84            # replace "/vis/open OGLIX" with "/vis/open OGLIQt" (not sure about the difference between OGLIQt and OGLSQt; maybe even just OGL)
85            # just in case we could check that the statement actually starts with /vis/open
86            reinplace "s|OGLIX|OGLIQt|g" ${f}
87            reinplace "s|OGLSX|OGLSQt|g" ${f}
88            # TODO: create a single expression to cover both, possibly storing the variables to simplify the replacement part
89            reinplace "s|/gate/geometry/setMaterialDatabase.*GateMaterials.db|/gate/geometry/setMaterialDatabase GateMaterials.db|g" ${f}
90            reinplace "s|/gate/geometry/setMaterialDatabase.*GateMaterialsGPU.db|/gate/geometry/setMaterialDatabase GateMaterialsGPU.db|g" ${f}
91        }
92    }
93}
94pre-destroot {
95    set destdocdir ${destroot}${prefix}/share/doc/${name}
96    xinstall -m 755 -d ${destdocdir}
97    # copy license
98    copy ${worksrcpath}/license ${destdocdir}
99    # copy examples
100    if {[variant_isset examples]} {
101        copy ${worksrcpath}/examples ${destdocdir}
102    }
103    # copy materials database
104    set sharedir ${prefix}/share/${name}
105    set destsharedir ${destroot}${sharedir}
106    xinstall -m 755 -d ${destsharedir}
107    copy ${worksrcpath}/GateMaterials.db ${destsharedir}
108    copy ${worksrcpath}/GateMaterialsGPU.db ${destsharedir}
109    # copy the initial macro files with basic setup
110    copy ${filespath}/gui.mac   ${destsharedir}
111    copy ${filespath}/icons.mac ${destsharedir}
112}
113
114post-destroot {
115    # TODO: the share folder is already set in another phase and should not repeat (actually, all the pre-destroot actions could go to post-destroot)
116    set sharedir ${prefix}/share/${name}
117    # move the binary and set environmental variables
118    set destexecutable ${destroot}${prefix}/bin/Gate
119    set libexecdir ${prefix}/libexec/${name}
120    set destlibexecdir ${destroot}${libexecdir}
121    xinstall -m 755 -d ${destlibexecdir}
122    move ${destexecutable} ${destlibexecdir}
123    system "echo '#!/bin/bash' > ${destexecutable}"
124    system "echo export GATEHOME=\\\"${sharedir}\\\" >> ${destexecutable}"
125    system "echo export G4DATADIR=\\\"${geant.datadir}\\\" >> ${destexecutable}"
126    foreach {data.name data.version data.filename data.envvariable} ${geant.data_versions} {
127        system "echo export ${data.envvariable}=\\\"\\\$G4DATADIR/${data.name}${data.version}\\\" >> ${destexecutable}"
128    }
129    system "echo ${libexecdir}/Gate \\\$@ >> ${destexecutable}"
130    system "chmod 755 ${destexecutable}"
131}
132
133variant examples description {Install examples to doc} {
134}
135variant geant4100 conflicts geant4101 description {Use Geant4 10.0 (deprecated)} {
136    set geant.version       10.0
137    set geant.revision      4
138    set geant.port_name     geant4.${geant.version}
139    set geant.data_versions ${geant.data_versions_10.0}
140    set geant.datadir       ${prefix}/share/Geant4/Data/Geant4.${geant.version}
141    set geant.cmakedir      ${prefix}/lib/Geant4-${geant.version}.${geant.revision}
142
143    depends_lib-append      port:${geant.port_name}
144    configure.args-append   -DGeant4_DIR=${geant.cmakedir}
145}
146variant geant4101 conflicts geant4100 description {Use Geant4 10.1} {
147    set geant.version       10.1
148    set geant.revision      1
149    set geant.port_name     geant4.${geant.version}
150    set geant.data_versions ${geant.data_versions_10.1}
151    set geant.datadir       ${prefix}/share/Geant4/Data/Geant4.${geant.version}
152    set geant.cmakedir      ${prefix}/lib/Geant4-${geant.version}.${geant.revision}
153
154    depends_lib-append      port:${geant.port_name}
155    configure.args-append   -DGeant4_DIR=${geant.cmakedir}
156}
157
158variant qt4 conflicts qt5 description {Use Geant4 with Qt 4} {
159    PortGroup qt4 1.0
160}
161variant qt5 conflicts qt4 description {Use Geant4 with Qt 5 (buggy)} {
162    PortGroup qt5 1.0
163}
164
165default_variants-append     +examples
166
167if {![variant_isset geant4101] && ![variant_isset geant4100]} {
168    default_variants-append +geant4101
169}
170
171# some ugly code to make sure that the variants for Qt version used
172# are consistent between Gate and Geant4; looking for suggestions for improvement
173if {[variant_isset geant4101]} {
174    if {![catch {set result [active_variants geant4.10.1 qt5 qt4]}]} {
175        if {$result} {
176            default_variants-append +qt5
177        } else {
178            default_variants-append +qt4
179        }
180    }
181    if {[variant_isset qt4]} {
182        require_active_variants geant4.10.1 qt
183    } elseif {[variant_isset qt5]} {
184        require_active_variants geant4.10.1 qt5
185    }
186} elseif {[variant_isset geant4100]} {
187    if {![catch {set result [active_variants geant4.10.0 qt5 qt4]}]} {
188        if {$result} {
189            default_variants-append +qt5
190        } else {
191            default_variants-append +qt4
192        }
193    }
194    if {[variant_isset qt4]} {
195        require_active_variants geant4.10.0 qt
196    } elseif {[variant_isset qt5]} {
197        require_active_variants geant4.10.0 qt5
198    }
199}
200
201livecheck.version   ${version}
202livecheck.regex     archive/\[v\](\[^"\]+)${extract.suffix}
Note: See TracBrowser for help on using the repository browser.