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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Sun Nov 7 21:06:38 2010 UTC (8 years, 5 months ago) by xarthisius
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
Fix building with --as-needed wrt bug 344119, respect CXX. Drop old.

(Portage version: 2.1.9.24/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20