/[gentoo-x86]/sci-physics/geant/geant-4.9.2_p01.ebuild
Gentoo

Contents of /sci-physics/geant/geant-4.9.2_p01.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Sep 23 16:06:00 2009 UTC (9 years, 7 months ago) by bicatali
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Version bump. Added aida USE flag, fixed Qt and GDML build options, hopefully fixing examples compiling (bug #260102), thanks Matej and Giovanni Fattori for their input
(Portage version: 2.2_rc41/cvs/Linux x86_64)

1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sci-physics/geant/geant-4.9.2_p01.ebuild,v 1.1 2009/03/18 16:22:25 bicatali Exp $
4
5 EAPI="2"
6
7 inherit eutils fortran versionator toolchain-funcs
8
9 PV1=$(get_version_component_range 1 ${PV})
10 PV2=$(get_version_component_range 2 ${PV})
11 PV3=$(get_version_component_range 3 ${PV})
12 MY_P=${PN}$(replace_version_separator 3 .)
13
14 DESCRIPTION="Toolkit for simulation of passage of particles through matter"
15 HOMEPAGE="http://geant4.cern.ch/"
16
17 SRC_COM="http://geant4.web.cern.ch/geant4/support/source"
18 SRC_URI="${SRC_COM}/${MY_P}.tar.gz"
19 GEANT4_DATA="G4NDL.3.13
20 G4EMLOW.6.2
21 G4RadioactiveDecay.3.2
22 PhotonEvaporation.2.0
23 G4ABLA.3.0"
24 for d in ${GEANT4_DATA}; do
25 SRC_URI="${SRC_URI} data? ( ${SRC_COM}/${d}.tar.gz )"
26 done
27
28 LICENSE="geant4"
29 SLOT="4"
30 KEYWORDS="~amd64 ~hppa ~sparc ~x86"
31 IUSE="athena +data dawn debug examples gdml geant3 global minimal +motif
32 +opengl openinventor qt4 +raytracerx static +vrml zlib"
33
34 RDEPEND=">=sci-physics/clhep-2.0.4.2
35 motif? ( x11-libs/openmotif )
36 athena? ( x11-libs/libXaw )
37 qt4? ( || ( x11-libs/qt:4 x11-libs/qt-gui ) )
38 openinventor? ( >=media-libs/openinventor-2.1.5.10-r3 )
39 raytracerx? ( x11-libs/libX11 x11-libs/libXmu )
40 opengl? ( virtual/opengl
41 athena? ( x11-libs/Xaw3d )
42 qt4? ( || ( x11-libs/qt:4[opengl] x11-libs/qt-opengl ) ) )
43 gdml? ( dev-libs/xerces-c )
44 geant3? ( sci-physics/geant:3 )
45 dawn? ( media-gfx/dawn )
46 zlib? ( sys-libs/zlib )"
47
48 DEPEND="${RDEPEND}"
49
50 S="${WORKDIR}/${MY_P}"
51
52 pkg_setup() {
53 FORTRAN="gfortran g77 ifc"
54 use geant3 && fortran_pkg_setup
55 eval unset ${!G4*}
56 }
57
58 src_prepare() {
59 # fix bad zlib dependency
60 epatch "${FILESDIR}"/${PN}-4.9.2-zlib.patch
61
62 # propagate user's flags.
63 sed -i -e 's/-o/$(LDFLAGS) -o/g' source/GNUmakefile || die
64 sed -i \
65 -e "/CXXFLAGS.*=.*-O2/s:=.*:= ${CXXFLAGS}:" \
66 -e "/FCFLAGS.*=.*-O2/s:=.*:= ${FFLAGS:--O2}:" \
67 -e "/CCFLAGS.*=.*-O2/s:=.*:= ${CFLAGS}:" \
68 -e "s:-Wl,-soname:${LDFLAGS} -Wl,-soname:g" \
69 config/sys/Linux*gmk || die "flag substitution failed"
70
71 # fix forced lib directory
72 sed -i \
73 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4LIB):g' \
74 config/binmake.gmk || die "sed binmake.gmk failed"
75 sed -i \
76 -e '/$(G4LIB)\/$(G4SYSTEM)/d' \
77 config/architecture.gmk || die "sed architecture.gmk failed"
78 sed -i \
79 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4TMP):g' \
80 config/common.gmk || die "sed common.gmk failed"
81 sed -i \
82 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4TMP):g' \
83 config/moc.gmk || die "sed moc.gmk failed"
84 sed -i \
85 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4TMP):g' \
86 -e 's:$(G4BIN)/$(G4SYSTEM):$(G4TMP):g' \
87 -e 's:$(G4TMP)/$(G4SYSTEM):$(G4TMP):g' \
88 source/GNUmakefile || die "sed GNUmakefile failed"
89 sed -i \
90 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4TMP):g' \
91 config/globlib.gmk || die "sed globlib.gmk failed"
92 }
93
94 src_configure() {
95 export GEANT4_DIR="/usr/share/${PN}${PV1}"
96 # where to put compiled libraries;
97 # we set env var G4LIB in src_install()
98 # to avoid confusing make
99 export GEANT4_LIBDIR=/usr/$(get_libdir)/${PN}${PV1}
100
101 # these should always to be set
102 [[ $(tc-getCXX) = ic*c ]] && export G4SYSTEM=Linux-icc \
103 || export G4SYSTEM=Linux-g++
104 export G4INSTALL="${S}"
105 export G4WORKDIR="${S}"
106 export G4INCLUDE="${D}/usr/include/${PN}"
107 export CLHEP_BASE_DIR=/usr
108
109 # parse USE; just set flags of drivers to build, G4*_USE_* vars are set
110 # later automatically for G4*_BUILD_*_DRIVER
111 use minimal && export G4UI_NONE=y \
112 && export G4VIS_NONE=y
113
114 use motif && export G4UI_BUILD_XM_SESSION=y
115 use athena && export G4UI_BUILD_XAW_SESSION=y
116 if use qt4; then
117 export G4UI_BUILD_QT_SESSION=y
118 export QTLIBS="-L/usr/$(get_libdir)/qt4 -lQtCore -lQtGui"
119 use opengl && export GLQTLIBS="${QTLIBS} -lQtOpenGL"
120 fi
121 use dawn && export G4VIS_BUILD_DAWN_DRIVER=y
122 use raytracerx && export G4VIS_BUILD_RAYTRACERX_DRIVER=y
123 use openinventor && export G4VIS_BUILD_OI_DRIVER=y
124 use opengl && export G4VIS_BUILD_OPENGLX_DRIVER=y
125 use opengl && use motif && export G4VIS_BUILD_OPENGLXM_DRIVER=y
126
127 use geant3 && export G4LIB_BUILD_G3TOG4=y
128 use zlib && export G4LIB_USE_ZLIB=y
129 use vrml && export G4VIS_BUILD_VRML_DRIVER=y \
130 && export G4VIS_BUILD_VRMLFILE_DRIVER=y
131
132 use data && export G4DATA="${GEANT4_DIR}/data"
133 use debug && export G4DEBUG=y || export G4OPTIMIZE=y
134
135 # switch to see compiling flags
136 export CPPVERBOSE=y
137
138 # if shared libs are built, the script will also build static libs
139 # with pic flags
140 # avoid that by building it twice and removing temporary objects
141 export G4LIB_BUILD_SHARED=y
142 }
143
144 src_compile() {
145 cd "${S}/source/"
146 einfo "Building shared library"
147 emake || die "Building shared geant failed"
148
149 if use global; then
150 export G4LIB_USE_GRANULAR=y
151 einfo "Building granular libraries"
152 emake global || die "Building global libraries failed"
153 emake || die "Rebuilding shared geant failed"
154 fi
155
156 if use static; then
157 einfo "Building static libraries"
158 rm -rf tmp
159 export G4LIB_BUILD_STATIC=y ; unset G4LIB_BUILD_SHARED
160 emake || die "Building static geant failed"
161 fi
162 }
163
164 g4_create_env_script() {
165 # we need to change some variables to the final values since we hide these
166 # from make during the compile
167 export G4INSTALL=${GEANT4_DIR}
168 export G4LIB=${GEANT4_LIBDIR}
169 export G4INCLUDE=${G4INCLUDE/${D}/}
170 export G4WORKDIR=\${HOME}/${PN}${PV1}
171
172 local g4env=99${PN}${PV1}
173 cat <<-EOF > ${g4env}
174 LDPATH=${G4LIB}
175 CLHEP_BASE_DIR=${CLHEP_BASE_DIR}
176 EOF
177
178 # detailed data file locations
179 if use data; then
180 G4LEVELGAMMADATA="${G4DATA}/$(basename ${WORKDIR}/PhotonEvaporation*)"
181 G4RADIOACTIVEDATA="${G4DATA}/$(basename ${WORKDIR}/RadioactiveDecay*)"
182 G4LEDATA="${G4DATA}/$(basename ${WORKDIR}/G4EMLOW*)"
183 G4ABLADATA="${G4DATA}/$(basename ${WORKDIR}/G4ABLA*)"
184 G4NEUTRONHPCROSSSECTIONS="${G4DATA}/$(basename ${WORKDIR}/G4NDL*)"
185 export G4LEVELGAMMADATA G4RADIOACTIVEDATA G4LEDATA \
186 G4ABLADATA G4NEUTRONHPCROSSSECTIONS
187 fi
188
189 # read env variables defined upto now
190 printenv | grep ^G4 | uniq >> ${g4env}
191 # define env vars for capabilities we can build into user projects
192 printenv | uniq | \
193 sed -n -e '/^G4/s:BUILD\(.*\)_DRIVER:USE\1:gp' >> ${g4env}
194 doenvd ${g4env} || die "Installing environment scripts failed "
195 }
196
197 src_install() {
198 # install headers via make since we want them in a single directory
199 cd "${S}/source/"
200 einfo "Installing Geant4 headers"
201 emake includes || die 'Installing headers failed'
202 cd "${S}"
203
204 # but install libraries and Geant library tool manually
205 einfo "Installing Geant4 libraries"
206 insinto ${GEANT4_LIBDIR}
207 insopts -m0755
208 doins tmp/*.so || die
209 doins tmp/libname.map || die
210 insopts -m0644
211 if use static; then
212 doins tmp/*.a || die
213 fi
214 exeinto ${GEANT4_LIBDIR}
215 doexe tmp/liblist || die
216
217 g4_create_env_script
218
219 # configs
220 insinto ${GEANT4_DIR}
221 doins -r config || die
222
223 # install data
224 if use data; then
225 einfo "Installing Geant4 data"
226 insinto ${G4DATA}
227 pushd "${WORKDIR}" > /dev/null
228 for d in ${GEANT4_DATA}; do
229 local p=${d/.}
230 doins -r *${p/G4} || die "installing data ${d} failed"
231 done
232 popd > /dev/null
233 fi
234
235 # doc and examples
236 insinto /usr/share/doc/${PF}
237 local mypv="${PV1}.${PV2}.${PV3}"
238 doins ReleaseNotes/ReleaseNotes${mypv}.html
239 [[ -e ReleaseNotes/Patch${mypv}-1.txt ]] && \
240 dodoc ReleaseNotes/Patch${mypv}-*.txt
241
242 use examples && doins -r examples
243
244 # TODO: * momo with momo or java flag, and check java stuff
245 }
246
247 pkg_postinst() {
248 elog "Geant4 projects are by default build in \$HOME/geant4."
249 elog "If you want to change, set \$G4WORKDIR to another directory."
250 }

  ViewVC Help
Powered by ViewVC 1.1.20