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

Contents of /sci-physics/geant/geant-4.9.3_p02-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Sun Dec 18 07:13:04 2011 UTC (7 years, 4 months ago) by bicatali
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +1 -1 lines
FILE REMOVED
Version bumps. Re-introduced some older flags and fixed linking of zlib. Added patch for source trajectory example (bug #365171), thanks Matthias Nagl.

(Portage version: 2.1.10.41/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20