/[gentoo-x86]/sci-physics/geant/geant-4.9.1_p02.ebuild
Gentoo

Contents of /sci-physics/geant/geant-4.9.1_p02.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Mon Nov 24 16:54:16 2008 UTC (10 years, 5 months ago) by bicatali
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
FILE REMOVED
Removed bundled zlib, closing bug #248423
(Portage version: 2.2_rc15/cvs/Linux 2.6.25-gentoo-r7 x86_64)

1 # Copyright 1999-2008 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.1_p02.ebuild,v 1.6 2008/07/17 13:46:19 bicatali Exp $
4
5 EAPI="1"
6
7 inherit eutils fortran multilib 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="CERN's detector description and simulation Tool"
15 HOMEPAGE="http://www.geant4.org/"
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.12
20 G4EMLOW.5.1
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 +raytracerx static +vrml zlib"
33
34 DEPEND="sci-physics/clhep
35 motif? ( x11-libs/openmotif )
36 athena? ( x11-libs/libXaw )
37 openinventor? ( media-libs/openinventor )
38 raytracerx? ( x11-libs/libX11 x11-libs/libXmu )
39 opengl? ( virtual/opengl
40 athena? ( x11-libs/Xaw3d ) )
41 gdml? ( dev-libs/xerces-c )
42 geant3? ( sci-physics/geant:3 )
43 dawn? ( media-gfx/dawn )"
44
45 S="${WORKDIR}/${MY_P}"
46
47 pkg_setup() {
48 FORTRAN="gfortran g77 ifc"
49 use geant3 && fortran_pkg_setup
50 eval unset ${!G4*}
51 }
52
53 src_unpack() {
54 unpack ${A}
55 cd "${S}"
56
57 # propagate user's flags.
58 sed -i \
59 -e "/CXXFLAGS[[:space:]]*.=[[:space:]]-O2/s:=.*:= ${CXXFLAGS}:" \
60 -e "/FCFLAGS[[:space:]]*.=[[:space:]]-O2/s:=.*:= ${FFLAGS:--O2}:" \
61 -e "/CCFLAGS[[:space:]]*.=[[:space:]]-O2/s:=.*:= ${CFLAGS}:" \
62 config/sys/Linux*gmk || die "flag substitution failed"
63
64 # fix forced lib directory
65 sed -i \
66 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4LIB):g' \
67 config/binmake.gmk || die "sed binmake.gmk failed"
68 sed -i \
69 -e '/$(G4LIB)\/$(G4SYSTEM)/d' \
70 config/architecture.gmk || die "sed architecture.gmk failed"
71 sed -i \
72 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4TMP):g' \
73 config/common.gmk || die "sed common.gmk failed"
74 sed -i \
75 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4TMP):g' \
76 -e 's:$(G4BIN)/$(G4SYSTEM):$(G4TMP):g' \
77 -e 's:$(G4TMP)/$(G4SYSTEM):$(G4TMP):g' \
78 source/GNUmakefile || die "sed GNUmakefile failed"
79 sed -i \
80 -e 's:$(G4LIB)/$(G4SYSTEM):$(G4TMP):g' \
81 config/globlib.gmk || die "sed globlib.gmk failed"
82 }
83
84 src_compile() {
85 export GEANT4_DIR="/usr/share/${PN}${PV1}"
86 # where to put compiled libraries;
87 # we set env var G4LIB in src_install()
88 # to avoid confusing make
89 export GEANT4_LIBDIR=/usr/$(get_libdir)/${PN}${PV1}
90
91 # these should always to be set
92 [[ $(tc-getCXX) = ic*c ]] && export G4SYSTEM=Linux-icc \
93 || export G4SYSTEM=Linux-g++
94 export G4INSTALL="${S}"
95 export G4INCLUDE="${D}/usr/include/${PN}"
96 export CLHEP_BASE_DIR=/usr
97
98 # parse USE; just set flags of drivers to build, G4*_USE_* vars are set
99 # later automatically for G4*_BUILD_*_DRIVER
100 use minimal && export G4UI_NONE=y \
101 && export G4VIS_NONE=y
102
103 use motif && export G4UI_BUILD_XM_SESSION=y
104 use athena && export G4UI_BUILD_XAW_SESSION=y
105
106 use dawn && export G4VIS_BUILD_DAWN_DRIVER=y
107 use raytracerx && export G4VIS_BUILD_RAYTRACERX_DRIVER=y
108 use openinventor && export G4VIS_BUILD_OI_DRIVER=y
109 use opengl && export G4VIS_BUILD_OPENGLX_DRIVER=y
110 use opengl && use motif && export G4VIS_BUILD_OPENGLXM_DRIVER=y
111
112 use geant3 && export G4LIB_BUILD_G3TOG4=y
113 use zlib && export G4LIB_BUILD_ZLIB=y
114 use vrml && export G4VIS_BUILD_VRML_DRIVER=y \
115 && export G4VIS_BUILD_VRMLFILE_DRIVER=y
116
117 use data && export G4DATA="${GEANT4_DIR}/data"
118 use debug && export G4DEBUG=y || export G4OPTIMIZE=y
119
120 # switch to see compiling flags
121 export CPPVERBOSE=y
122
123 # if shared libs are built, the script will also build static libs
124 # with pic flags
125 # avoid that by building it twice and removing temporary objects
126 cd "${S}/source/"
127 export G4LIB_BUILD_SHARED=y
128 emake || die "Building shared geant failed"
129
130 if use global; then
131 export G4LIB_USE_GRANULAR=y
132 emake global || die "Building global libraries failed"
133 emake || die "Rebuilding shared geant failed"
134 fi
135
136 if use static; then
137 rm -rf tmp
138 export G4LIB_BUILD_STATIC=y ; unset G4LIB_BUILD_SHARED
139 emake || die "Building static geant failed"
140 fi
141 }
142
143 g4_create_env_script() {
144 # we need to change some variables to the final values since we hide these
145 # from make during the compile
146 export G4INSTALL=${GEANT4_DIR}
147 export G4LIB=${GEANT4_LIBDIR}
148 export G4INCLUDE=${G4INCLUDE/${D}/}
149 export G4WORKDIR=\${HOME}/${PN}${PV1}
150
151 local g4env=99${PN}${PV1}
152 cat <<-EOF > ${g4env}
153 LDPATH=${G4LIB}
154 CLHEP_BASE_DIR=${CLHEP_BASE_DIR}
155 EOF
156
157 # detailed data file locations
158 if $(use data); then
159 export G4LEVELGAMMADATA="${G4DATA}/PhotonEvaporation2.0"
160 export G4RADIOACTIVEDATA="${G4DATA}/RadioactiveDecay3.2"
161 export G4LEDATA="${G4DATA}/G4EMLOW5.1"
162 export G4NEUTRONHPCROSSSECTIONS="${G4DATA}/G4NDL3.12"
163 fi
164
165 # read env variables defined upto now
166 printenv | grep ^G4 | uniq >> ${g4env}
167 # define env vars for capabilities we can build into user projects
168 printenv | uniq | \
169 sed -n -e '/^G4/s:BUILD\(.*\)_DRIVER:USE\1:gp' >> ${g4env}
170 doenvd ${g4env} || die "Installing environment scripts failed "
171 }
172
173 src_install() {
174 # install headers via make since we want them in a single directory
175 cd "${S}/source/"
176 einfo "Installing Geant4 headers"
177 emake includes || die 'Installing headers failed'
178 cd "${S}"
179
180 # but install libraries and Geant library tool manually
181 einfo "Installing Geant4 libraries"
182 insinto ${GEANT4_LIBDIR}
183 doins tmp/*.so || die
184 doins tmp/libname.map || die
185 if use static; then
186 doins tmp/*.a || die
187 fi
188 exeinto ${GEANT4_LIBDIR}
189 doexe tmp/liblist || die
190
191 g4_create_env_script
192
193 # configs
194 insinto ${GEANT4_DIR}
195 doins -r config || die
196
197 # install data
198 if use data; then
199 einfo "Installing Geant4 data"
200 insinto ${G4DATA}
201 pushd "${WORKDIR}" > /dev/null
202 for d in ${GEANT4_DATA}; do
203 local p=${d/.}
204 doins -r *${p/G4} || die "installing data ${d} failed"
205 done
206 popd > /dev/null
207 fi
208
209 # doc and examples
210 insinto /usr/share/doc/${PF}
211 local mypv="${PV1}.${PV2}.${PV3}"
212 doins ReleaseNotes/ReleaseNotes${mypv}.html
213 [[ -e ReleaseNotes/Patch${mypv}-1.txt ]] && \
214 dodoc ReleaseNotes/Patch${mypv}-*.txt
215
216 use examples && doins -r examples
217
218 # TODO: g4py will probably need a split ebuild since it seems to
219 # rely on on geant4 existence.
220 # TODO: momo with momo or java flag, and check java stuff
221 }
222
223 pkg_postinst() {
224 elog "Geant4 projects are by default build in \$HOME/geant4."
225 elog "If you want to change, set \$G4WORKDIR to another directory."
226 }

  ViewVC Help
Powered by ViewVC 1.1.20