Ticket #23323: Portfile

File Portfile, 9.7 KB (added by cristiano.fontana@…, 15 years ago)
Line 
1# $Id$
2PortSystem          1.0
3
4name                geant4
5version             4.9.3
6categories          science
7maintainers         gmail.com:cristiano.fontana
8license             Geant4
9description         Geant4 is a toolkit for the simulation of the passage of particles through matter.
10long_description    Geant4 is a toolkit for the simulation of the passage of particles through matter. \
11                    Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science. \
12                    The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, \
13                    and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278.
14homepage            http://geant4.web.cern.ch/
15notes               GEANT4 needs some environment variables to run, they can be set using either ${prefix}/share/geant4/env.sh or ${prefix}/share/geant4/env.csh
16platforms           darwin
17
18# Data files versions
19set G4NDL_v             3.13
20set G4EMLOW_v           6.9
21set PhotonEvaporation_v 2.0
22set RadioactiveDecay_v  3.2
23set G4ABLA_v            3.0
24set RealSurface_v       1.0
25
26distfiles           geant${version}.tar.gz \
27                    G4NDL.${G4NDL_v}.tar.gz \
28                    G4EMLOW.${G4EMLOW_v}.tar.gz \
29                    PhotonEvaporation.${PhotonEvaporation_v}.tar.gz \
30                    G4RadioactiveDecay.${RadioactiveDecay_v}.tar.gz \
31                    G4ABLA.${G4ABLA_v}.tar.gz \
32                    RealSurface.${RealSurface_v}.tar.gz
33
34master_sites        http://geant4.cern.ch/support/source/
35
36checksums           geant4.9.3.tar.gz \
37                    md5     e2b02bac0bba8fb5a01e1caeefe86a7a \
38                    sha1    9c657e90675d64993416b46dfce70710804379d4 \
39                    rmd160  33f54c2dbf33a7eda1470db1a6bb44de279ac577 \
40                    G4NDL.${G4NDL_v}.tar.gz \
41                    md5     3aeb08f8532fc1d445b020ff9985b4e0 \
42                    sha1    4acc412a2f29a7a8f84ac50aeb7331c8ed2889ae \
43                    rmd160  243b206170d996c7b562a86e388ff4d5f8d11764 \
44                    G4EMLOW.${G4EMLOW_v}.tar.gz \
45                    md5     90af6d45b5053e9e355df38231e2060c \
46                    sha1    d4d026f96990d4ed15a6b550b1990ba335248965 \
47                    rmd160  8306a6af7ec41ec16790df2130b4f9b437bb7d9e \
48                    PhotonEvaporation.${PhotonEvaporation_v}.tar.gz \
49                    md5     097fa94e2ec361cbfe3477ed5886a423 \
50                    sha1    df3b4994c7248da7a226c186be747c4b823d34fa \
51                    rmd160  24d46b08b2ffeca5b3be186baffb650b99accc97 \
52                    G4RadioactiveDecay.${RadioactiveDecay_v}.tar.gz \
53                    md5     45e7ab756038e4ebac16f7d65e4227cc \
54                    sha1    45e706e46a33e08b1706f069d15e8c2145f3410e \
55                    rmd160  1f797977c0c66722f4b032ac546c26eaa8a9f14a \
56                    G4ABLA.${G4ABLA_v}.tar.gz \
57                    md5     d2d4e99b14f7a5057f4c10d9c2d647dd \
58                    sha1    5f38676f1650a508e49d35f9405ac96984388135 \
59                    rmd160  5a032ee8e90d00f39b67114fe257ec47001f347b \
60                    RealSurface.${RealSurface_v}.tar.gz \
61                    md5     0dde95e00fcd3bcd745804f870bb6884 \
62                    sha1    9b4bd95c647dc702458eeaf89ebf62c5885e2ece \
63                    rmd160  030513fe340e0cccbfe0b9ae9acb3ba6b5291ebb
64
65worksrcdir          geant${version}/source
66
67depends_lib         port:clhep \
68                    port:openmotif \
69                    port:xercesc3 \
70                    port:zlib
71
72post-patch {
73    # Propagate user's flags and compiler settings
74    reinplace "s/-o/\$(LDFLAGS) -o/g" ${worksrcpath}/GNUmakefile
75
76    # Replaces g++ with standard compiler
77    foreach file [exec find ${workpath}/geant${version}/config -name "*.gmk"] {
78        reinplace "s:g++:${configure.cxx}:g" ${file}
79        reinplace "s:gfortran:${configure.fc}:g" ${file}
80    }
81
82    # Fix an error message in build phase (I hope that it will not cause any problems)
83    reinplace "s:LDFLAGS += -bind_at_load -arch_multiple:LDFLAGS += -bind_at_load:g" ${workpath}/geant${version}/config/sys/Darwin-g++.gmk
84
85    # Forces build phase to lookf for Darwin-g++.gmk and not $(G4SYSTEM).gmk
86    reinplace "s:\$(G4SYSTEM).gmk:Darwin-g++.gmk:g" ${workpath}/geant${version}/config/architecture.gmk
87    reinplace "s:\$(G4SYSTEM).gmk:Darwin-g++.gmk:g" ${workpath}/geant${version}/config/common.gmk
88    reinplace "s:\$(G4SYSTEM).gmk:Darwin-g++.gmk:g" ${workpath}/geant${version}/examples/extended/eventgenerator/HepMC/HepMCEx01/external/GNUmakefile
89
90    # Copies some files to fix them
91    foreach file [ exec find ${filespath} -name "*sh" -print ] {
92        file copy ${file} ${worksrcpath}
93    }
94
95    # Fixes some paths
96    foreach file [ exec find ${worksrcpath} -name "*sh" -print ] {
97        reinplace "s:@PREFIX@:${prefix}:g" ${file}
98        reinplace "s:@WORKSRCPATH@:${worksrcpath}:g" ${file}
99        reinplace "s:@DESTROOT@:${destroot}:g" ${file}
100        reinplace "s:@VERSION@:${version}:g" ${file}
101    }
102}
103
104configure { }
105
106build.env           G4SYSTEM=${version}
107build.env-append    G4INSTALL=${workpath}/geant${version}
108#G4INCLUDE=
109build.env-append    G4TMP=\$G4INSTALL/tmp
110build.env-append    G4LIB=${workpath}/geant${version}/lib
111build.env-append    G4BIN=${workpath}/geant${version}/bin
112
113build.env-append    G4LEVELGAMMADATA=${prefix}/share/geant4/data/PhotonEvaporation${PhotonEvaporation_v}
114build.env-append    G4RADIOACTIVEDATA=${prefix}/share/geant4/data/RadioactiveDecay${RadioactiveDecay_v}
115build.env-append    G4LEDATA=${prefix}/share/geant4/data/G4EMLOW${G4EMLOW_v}
116build.env-append    G4NEUTRONHPDATA=${prefix}/share/geant4/data/G4NDL${G4NDL_v}
117build.env-append    G4ABLADATA=${prefix}/share/geant4/data/G4ABLA${G4ABLA_v}
118#G4ELASTICDATA=
119
120build.env-append    CLHEP_BASE_DIR=${prefix}
121build.env-append    CLHEP_INCLUDE_DIR=${prefix}/include
122build.env-append    CLHEP_LIB_DIR=${prefix}/lib
123build.env-append    CLHEP_LIB=CLHEP
124
125#build.env-append    G4DEBUG=1
126
127#build.env-append    G4UI_NONE=1 # Sets no user interface
128#build.env-append    G4UI_BUILD_XAW_SESSION=1 # Uses Xaw
129#build.env-append    G4UI_USE_XAW=1
130build.env-append    G4UI_BUILD_XM_SESSION=1 #Uses Motif
131build.env-append    G4UI_USE_XM=1
132#build.env-append    G4UI_BUILD_QT_SESSION=1 #Uses Qt
133#build.env-append    G4UI_USE_QT=1
134# END OF G4UI_NONE block
135
136#build.env-append    G4VIS_NONE=1 #Sets no viasualizzation driver
137#build.env-append    G4VIS_BUILD_DAWN_DRIVER=1 #Uses DAWN
138build.env-append    G4VIS_BUILD_OPENGLX_DRIVER=1 #Uses OpenGLX
139build.env-append    G4VIS_BUILD_OPENGLXM_DRIVER=1
140#build.env-append    G4VIS_BUILD_OIX_DRIVER=1
141#build.env-append    G4VIS_BUILD_RAYTRACERX_DRIVER=1
142#build.env-append    G4VIS_BUILD_VRML_DRIVER=1
143#build.env-append    G4VIS_BUILD_OPENGLQT_DRIVER=1
144#build.env-append    G4VIS_USE_DAWN=1
145build.env-append    G4VIS_USE_OPENGLX=1
146build.env-append    G4VIS_USE_OPENGLXM=1 #Uses OpenGLX with Motif
147#build.env-append    G4VIS_USE_OIX=1
148#build.env-append    G4VIS_USE_RAYTRACERX=1
149#build.env-append    G4VIS_USE_VRML=1
150#build.env-append    G4VIS_USE_OPENGLQT=1
151# End of G4VIS_NONE block
152
153#build.env-append    OGLHOME=
154#build.env-append    OIVHOME=
155
156build.env-append    XMFLAGS= -I${prefix}/include
157build.env-append    XMLIBS= -L${prefix}/lib -lXm -lXpm
158build.env-append    XMFLAGS= -I${prefix}/include
159build.env-append    XMLIBS= -L${prefix}/lib -lXm -lXpm
160#build.env-append    XAWFLAGS=
161#build.env-append    XAWLIBS=
162#build.env-append    QTFLAGS=
163#build.env-append    QTLIBS=
164#build.env-append    QTMOC=
165
166build.env-append    G4LIB_BUILD_GDML=1 # Use GDML for detector construction
167build.env-append    XERCESCROOT=${prefix}
168
169#build.env-append    G4LIB_BUILD_G3TOG4=1
170#build.env-append    G4LIB_USE_G3TOG4=1
171
172#build.env-append    G4LIB_BUILD_ZLIB=1
173#build.env-append    G4LIB_USE_ZLIB=1
174
175build.env-append    G4LIB_BUILD_SHARED=1
176#build.env-append    G4LIB_BUILD_STATIC=1
177build.env-append    G4LIB_USE_GRANULAR=1
178
179#pre-build {
180    #system "/usr/bin/make -n -p -f \$G4INSTALL/config/scripts/GNUmakefile > \$G4LIB/\$G4SYSTEM/GNUmakefile.db"
181#}
182
183build.args
184build.target
185
186post-build {
187    system "cd ${worksrcpath} && make includes"
188}
189
190destroot {
191    puts "Installing env scripts to ${prefix}/share/geant4/"
192
193    xinstall -d ${destroot}${prefix}/share/geant4/
194
195    xinstall -m 755 -W ${worksrcpath} env.sh ${destroot}${prefix}/share/geant4/
196    xinstall -m 755 -W ${worksrcpath} env.csh ${destroot}${prefix}/share/geant4/
197
198    puts "Installing GEANT4 data to ${prefix}/share/geant4/data"
199
200    xinstall -d ${destroot}${prefix}/share/geant4/data
201
202    foreach data [list G4NDL${G4NDL_v} G4EMLOW${G4EMLOW_v} PhotonEvaporation${PhotonEvaporation_v} RadioactiveDecay${RadioactiveDecay_v} G4ABLA${G4ABLA_v} RealSurface${RealSurface_v}] {
203        puts "-> Installing ${data} to ${prefix}/share/geant4/data"
204        file copy ${workpath}/${data} ${destroot}${prefix}/share/geant4/data
205    }
206
207    puts "Installing sources to ${prefix}/src/geant4/${version}"
208
209    xinstall -d ${destroot}${prefix}/src/geant4/${version}
210
211    foreach sources {config source environments examples} {
212        puts "-> Installing ${sources} to ${prefix}/src/geant4/${version}"
213        file copy ${workpath}/geant${version}/${sources} ${destroot}${prefix}/src/geant4/${version}
214    }
215
216    puts "Installing headers to ${prefix}/include/"
217
218    foreach file [glob ${workpath}/geant${version}/include/*] {
219        file copy ${file} ${destroot}${prefix}/include/
220    }
221
222    puts "Installing libs to ${prefix}/lib/geant4/${version}"
223
224    xinstall -d ${destroot}${prefix}/lib/geant4/
225
226    file copy ${workpath}/geant${version}/lib/${version}/ ${destroot}${prefix}/lib/geant4/
227
228    puts "Installing executables to ${prefix}/bin"
229
230    foreach file [glob -nocomplain ${workpath}/geant${version}/bin/*] {
231        file copy ${file} ${destroot}${prefix}/bin/
232    }
233}