Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 212221 | Differences between
and this patch

Collapse All | Expand All

(-)a/geant/files/geant-4.9.1_p01-configure.patch
Lines 1-116 Link Here
(-)a/geant/files/geant-4.9.1_p01-no-source.patch
Lines 1-45 Link Here
(-)a/geant/geant-4.9.1_p01.ebuild (-100 / +99 lines)
Lines 4-15 Link Here
4
4
5
EAPI="1"
5
EAPI="1"
6
6
7
inherit eutils fortran multilib versionator
7
inherit eutils fortran multilib versionator toolchain-funcs
8
8
9
MY_P=${PN}$(replace_version_separator 3 .)
9
MY_P=${PN}$(replace_version_separator 3 .)
10
10
11
DESCRIPTION="CERN's detector description and simulation Tool"
11
DESCRIPTION="CERN's detector description and simulation Tool"
12
HOMEPAGE="http://geant4.cern.ch/"
12
HOMEPAGE="http://www.geant4.org/"
13
13
14
SRC_COM="http://geant4.web.cern.ch/geant4/support/source/"
14
SRC_COM="http://geant4.web.cern.ch/geant4/support/source/"
15
SRC_URI="${SRC_COM}/${MY_P}.tar.gz"
15
SRC_URI="${SRC_COM}/${MY_P}.tar.gz"
Lines 44-185 S="${WORKDIR}/${MY_P}" Link Here
44
pkg_setup() {
44
pkg_setup() {
45
	FORTRAN="gfortran g77 ifc"
45
	FORTRAN="gfortran g77 ifc"
46
	use geant3 && fortran_pkg_setup
46
	use geant3 && fortran_pkg_setup
47
	eval unset ${!G4_*}
47
}
48
}
48
49
49
src_unpack() {
50
src_unpack() {
50
	unpack ${A}
51
	unpack ${A}
51
	cd "${S}"
52
	cd "${S}"
52
53
53
	# this patch sanitize the Configure script
54
	# TODO is this still needed? We are using emake below ...
54
	epatch "${FILESDIR}"/${P}-configure.patch
55
	epatch "${FILESDIR}"/${P}-no-source.patch
56
57
	# propagate user's make options
58
	sed -i \
59
		-e "s/g4make=gmake/g4make=\"gmake ${MAKEOPTS}\"/" \
60
		Configure || die "sed Configure failed"
61
62
	# propagate user's flags.
55
	# propagate user's flags.
63
	sed -i \
56
	sed -i \
64
		-e "s:\(CXXFLAGS*+=\)*-O2:\1 ${CXXFLAGS:--O2}:g" \
57
		-e "s:\(CXXFLAGS*+=\)*-O2:\1 ${CXXFLAGS:--O2}:g" \
65
		-e "s:\(FCFLAGS*+=\)*-O2:\1 ${FFLAGS:--O2}:g" \
58
		-e "s:\(FCFLAGS*+=\)*-O2:\1 ${FFLAGS:--O2}:g" \
66
		-e "s:\(CCFLAGS*+=\)*-O2:\1 ${CFLAGS:--O2}:g" \
59
		-e "s:\(CCFLAGS*+=\)*-O2:\1 ${CFLAGS:--O2}:g" \
67
		config/sys/Linux* || die "flag substitution failed"
60
		config/sys/Linux* || die "flag substitution failed"
68
69
	# libdir stuff
70
	sed -i \
71
		-e "s:lib/geant4:$(get_libdir)/geant:g" \
72
		Configure config/scripts/move.sh.SH \
73
		|| die "multilib substitution failed"
74
}
75
76
g4ui_use() {
77
	local answer=$(use $1 && echo y || echo n)
78
	echo "-D g4ui_build_${2:-$1}_session=${answer}
79
		  -D g4ui_use_${2:-$1}=${answer}"
80
}
81
82
g4vis_use() {
83
	local answer=$(use $1 && echo y || echo n)
84
	echo "-D g4vis_build_${2:-$1}_driver=${answer}
85
		  -D g4vis_use_${2:-$1}=${answer}"
86
}
87
88
g4w_use() {
89
	local answer=$(use $1 && echo y || echo n)
90
	echo "-D g4w_use_${2:-$1}=${answer}
91
		  -D g4wlib_use_${2:-$1}=${answer}"
92
}
61
}
93
62
94
src_compile() {
63
src_compile() {
95
64
	export GEANT4_DIR="/usr/share/${PN}-${SLOT}"
96
	GEANT4_DIR=/usr/share/${PN}-${SLOT}
65
97
	GEANT4_DATA_DIR=${GEANT4_DIR}/data
66
	# these should always to be set
98
67
	# TODO icc untested
99
	# The Configure shell script saves its options
68
	[[ $(tc-getCXX) = ic*c ]] && export G4SYSTEM=Linux-icc \
100
	# in .config/bin/*/config.sh
69
	                          || export G4SYSTEM=Linux-g++
101
	local myconf="$(g4vis_use opengl openglx)"
70
	export G4INSTALL="${S}"
102
	use opengl && myconf="${glconf} $(g4vis_use motif openglxm)"
71
	export G4INCLUDE="${D}/usr/include/${PN}"
103
	use data && myconf="${myconf} -D g4data=${GEANT4_DATA_DIR}"
72
	export CLHEP_BASE_DIR=/usr
104
73
105
	 # switch to see compiling flags
74
	# where to put compiled libraries;
75
	# we set env var G4LIB in src_install()
76
	# to avoid confusing make
77
	export LIB_DIR_TMP="/usr/$(get_libdir)/${PN}"
78
79
	# parse USE; just set flags of drivers to build, G4*_USE_* vars are set
80
	# later automatically for G4*_BUILD_*_DRIVER
81
	use minimal             && export G4UI_NONE=y \
82
	                        && export G4VIS_NONE=y
83
84
	use motif               && export G4UI_BUILD_XM_SESSION=y
85
	use athena              && export G4UI_BUILD_XAW_SESSION=y
86
87
	use dawn                && export G4VIS_BUILD_DAWN_DRIVER=y
88
	use raytracerx          && export G4VIS_BUILD_RAYTRACERX_DRIVER=y
89
	use openinventor        && export G4VIS_BUILD_OI_DRIVER=y
90
	use opengl              && export G4VIS_BUILD_OPENGLX_DRIVER=y
91
	use opengl && use motif && export G4VIS_BUILD_OPENGLXM_DRIVER=y
92
93
	use geant3              && export G4LIB_BUILD_G3TOG4=y
94
	use zlib                && export G4LIB_BUILD_ZLIB=y
95
	use vrml                && export G4VIS_BUILD_VRML_DRIVER=y \
96
	                        && export G4VIS_BUILD_VRMLFILE_DRIVER=y
97
98
	use data                && export G4DATA="${GEANT4_DIR}/data"
99
	use debug               && export G4DEBUG=y || export G4OPTIMIZE=y
100
101
	# switch to see compiling flags
106
	export CPPVERBOSE=y
102
	export CPPVERBOSE=y
107
	use debug && export G4DEBUG=y || export G4OPTIMIZE=y
103
108
104
	# internal variables of ./Configure
109
	# to check what they are doing and working
105
	# -D d_portable \      # seems to be a local variable of ./Configure
110
	# -D d_portable \
106
	# -D g4global=n \      # create few BIG global libraries
111
	# -D g4global=n \
107
	# -D g4granular=y      # create many small libraries for submodules (default)
112
	# -D g4granular=y
108
	# -D g4_use_granular=y # link against the BIG global library when compiling apps
113
	# -D g4_use_granular=y
109
	# TODO if we really want GLOBAL libraries (too), we would use
114
	# -D g4make=make \
110
	# use global && emake global || die "Building global geant failed"
115
111
	# and set G4LIB_USE_GRANULAR=y in env.*sh
116
	./Configure \
117
		-deE -build \
118
		-D g4analysis_use=n \
119
		-D g4includes_flag=y \
120
		-D g4include="${D}/usr/include/geant4" \
121
		-D g4final_install="${D}/usr" \
122
		$(g4ui_use minimal none) \
123
		$(g4ui_use athena xaw) \
124
		$(g4ui_use motif xm) \
125
		$(g4vis_use minimal none) \
126
		$(g4vis_use dawn) \
127
		$(g4vis_use raytracerx) \
128
		$(g4vis_use openinventor oix) \
129
		$(g4vis_use vrml) \
130
		$(g4vis_use vrml vrmlfile) \
131
		$(g4w_use geant3 g3tog4) \
132
		$(g4w_use zlib) \
133
		${myconf} \
134
		${EXTRA_ECONF} \
135
		|| die "Configure failed"
136
112
137
	# if shared libs are built, the script will also build static libs
113
	# if shared libs are built, the script will also build static libs
138
	# with pic flags
114
	# with pic flags
139
	# avoid that by building it twice and removing temporary objects
115
	# avoid that by building it twice and removing temporary objects
140
116
	cd "${S}/source/"
141
	./Configure \
117
	export G4LIB_BUILD_SHARED=y
142
		-deO -build \
118
	emake || die "Building shared geant failed"
143
		-D g4lib_build_shared=y \
144
		-D g4lib_build_static=n \
145
		|| die "Building shared geant failed"
146
119
147
	if use static; then
120
	if use static; then
148
		rm -rf tmp
121
		rm -rf tmp
149
		./Configure \
122
		export G4LIB_BUILD_STATIC=y ; unset G4LIB_BUILD_SHARED
150
			-deO -build \
123
		emake || die "Building static geant failed"
151
			-D g4lib_build_shared=n \
152
			-D g4lib_build_static=y \
153
			|| die "Building shared geant failed"
154
	fi
124
	fi
155
}
125
}
156
126
127
g4_create_env_scripts() {
128
	# we need to change some variables to the final values since we hide these
129
	# from make during the compile
130
	export G4INSTALL="${GEANT4_DIR}"
131
	export G4LIB="${LIB_DIR_TMP}"
132
	export G4INCLUDE=`echo $G4INCLUDE | sed s:${D}::`
133
134
	export G4WORKDIR="/tmp/geant4"/ # TODO howto set it to e.g. $HOME/geant4 ?
135
	echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${G4LIB}" >> "env.sh"
136
	echo "setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:${G4LIB}" >> "env.csh"
137
	echo "export CLHEP_BASE_DIR=$CLHEP_BASE_DIR"            >> "env.sh"
138
	echo "setenv CLHEP_BASE_DIR $CLHEP_BASE_DIR"            >> "env.csh"
139
	# read env variables defined upto now
140
	for v in `env | grep ^G4 | uniq`; do
141
		echo "export $v"   >> "env.sh" # these are already set to "y"
142
		echo "setenv $v y" >> "env.csh"
143
	done
144
	# define env vars for capabilities we can build into user projects
145
	for v in `env | grep ^G4 | uniq | grep DRIVER | cut -d= -f1 | \
146
		sed -e s~BUILD~USE~ -e s~_DRIVER~~`
147
	do
148
		echo "export $v=y" >> "env.sh"
149
		echo "setenv $v y" >> "env.csh"
150
	done
151
}
152
157
src_install() {
153
src_install() {
158
	./Configure \
154
	# install headers via make since we want them in a single directory
159
		-install \
155
	cd "${S}/source/"
160
		|| die "Install failed"
156
	emake includes || die 'Installing headers failed'
157
	cd "${S}"
161
158
162
	./Configure \
159
	# but install libraries and Geant library tool manually
163
		|| die "Final install failed"
160
	insinto "${LIB_DIR_TMP}"
161
	doins -r "lib/${G4SYSTEM}/"*
162
	exeinto "${LIB_DIR_TMP}"
163
	doexe "lib/${G4SYSTEM}/liblist"
164
164
165
	# install env stuff
165
	# env scripts and configs
166
	# todo: try to decipher and translate into a env.d file
167
	insinto ${GEANT4_DIR}
166
	insinto ${GEANT4_DIR}
168
	sed -i \
167
	g4_create_env_scripts
169
		-e "s:${S}:${GEANT4_DIR}:g" \
170
		-e "s:${D}:/:g" \
171
		env.*sh
172
	doins env.*sh || die "failed installing shell scripts"
168
	doins env.*sh || die "failed installing shell scripts"
169
	sed -i s~\$\(G4LIB\)/\$\(G4SYSTEM\)~\$\(G4LIB\)~g \
170
		config/binmake.gmk || die "Adjusting paths failed"
173
	doins -r config
171
	doins -r config
174
172
175
	# install data
173
	# install data
176
	insinto ${GEANT4_DATA_DIR}
177
	if use data; then
174
	if use data; then
175
		insinto ${G4DATA}
178
		cd "${WORKDIR}"
176
		cd "${WORKDIR}"
179
		for d in ${GEANT4_DATA}; do
177
		for d in ${GEANT4_DATA}; do
180
			local p=${d/.}
178
			local p=${d/.}
181
			doins -r *${p/G4} || die "installing data ${d} failed"
179
			doins -r *${p/G4} || die "installing data ${d} failed"
182
		done
180
		done
181
		cd "${S}"
183
	fi
182
	fi
184
183
185
	# doc and examples
184
	# doc and examples
Lines 198-206 src_install() { Link Here
198
197
199
pkg_postinst() {
198
pkg_postinst() {
200
	elog "You can set the Geant4 environment variables"
199
	elog "You can set the Geant4 environment variables"
201
	elog "from ${ROOT}${GEANT4_DIR} shell scripts."
200
	elog "from ${GEANT4_DIR} shell scripts."
202
	elog "Ex: for bash"
201
	elog "Ex: for bash"
203
	elog "     source ${ROOT}${GEANT4_DIR}/env.sh"
202
	elog "     source ${GEANT4_DIR}/env.sh"
204
	elog
203
	elog
205
	elog "Help us to improve the ebuild and dependencies in"
204
	elog "Help us to improve the ebuild and dependencies in"
206
	elog "http://bugs.gentoo.org/show_bug.cgi?id=212221"
205
	elog "http://bugs.gentoo.org/show_bug.cgi?id=212221"
(-)a/geant/metadata.xml (-1 / +2 lines)
Lines 5-11 Link Here
5
<longdescription lang="en">
5
<longdescription lang="en">
6
  Geant simulates the passage of subatomic particles through matter, for
6
  Geant simulates the passage of subatomic particles through matter, for
7
  instance, particle detectors. For maximum flexibility, Geant
7
  instance, particle detectors. For maximum flexibility, Geant
8
  simulations are performed by linking Fortran code supplied by the user
8
  simulations are performed by linking code supplied by the user
9
  with the Geant libraries, then running the resulting executable.
9
  with the Geant libraries, then running the resulting executable.
10
  Geant-3.* was written in Fortran, while Geant-4.* is a rewrite in C++.
10
</longdescription>
11
</longdescription>
11
</pkgmetadata>
12
</pkgmetadata>

Return to bug 212221