summaryrefslogtreecommitdiff
blob: 71d0c1cf314605e5dec721d4c08769af788d1863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-physics/geant-python/geant-python-4.9.5.ebuild,v 1.2 2012/05/21 04:49:12 heroxbd Exp $

EAPI=4

inherit python versionator

MYP="geant$(replace_version_separator 3 .)"

DESCRIPTION="Python binding for geant"
HOMEPAGE="http://geant4.cern.ch/"
SRC_URI="http://geant4.cern.ch/support/source/${MYP}.tar.gz"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"

LICENSE="geant4"
SLOT="0"
IUSE="examples"

RDEPEND="=sci-physics/geant-${PV}* \
	dev-libs/boost[python]"
DEPEND="${RDEPEND}"

S="${WORKDIR}/${MYP}/environments/g4py"

src_prepare() {
	# DISTDIR and python path patch
	epatch "${FILESDIR}"/${PN}-4.9.5-build.patch

	# fix the visManager wrapper
	epatch "${FILESDIR}"/${PN}-4.9.5-vis-fix.patch

	# let Geant4 module installed into python sitedir instead of default
	sed -i "/G4PY_LIBDIR  :=/cG4PY_LIBDIR  := $\(DESTDIR\)$(python_get_sitedir)/Geant4" \
		config/install.gmk || die "sed failed on config/install.gmk"
	for mfile in source/python{3,}/GNUmakefile
	do
		sed -i "/install_dir :=/cinstall_dir := $\(DESTDIR\)$(python_get_sitedir)/Geant4" \
			"${mfile}" || die "sed failed on ${mfile}"
	done

	# let g4py module installed into python sitedir instead of default
	sed -i "/install_dir :=/cinstall_dir := $\(DESTDIR\)$(python_get_sitedir)/g4py" \
		config/site-install.gmk || die "sed failed on config/site-install.gmk"
	for mfile in {processes/emcalculator,utils/MCScore}/{python3/,}GNUmakefile python/GNUmakefile
	do
		sed -i "/install_dir :=/cinstall_dir := $\(DESTDIR\)$(python_get_sitedir)/g4py" \
			"site-modules/${mfile}" || die "sed failed on site-modules/${mfile}"
	done
}

src_configure() {
	case ${CHOST} in
		x86_64-pc-linux-gnu)
			ARG=linux64
			;;
		i?86-pc-linux-gnu)
			ARG=linux
			;;
		*)
			die "platform unknown"
			;;
	esac

	./configure ${ARG} \
		--prefix="${EPREFIX}/usr" \
		--with-g4-incdir="${EPREFIX}/usr/include/Geant4" \
		--with-g4-libdir="${EPREFIX}/usr/lib" \
		--with-clhep-incdir="${EPREFIX}/usr/include" \
		--with-clhep-libdir="${EPREFIX}/usr/lib" \
		--with-python-incdir="${EPREFIX}$(python_get_includedir)" \
		--with-python-libdir="${EPREFIX}$(python_get_libdir)" \
		--with-boost-incdir="${EPREFIX}/usr/include" \
		--with-boost-libdir="${EPREFIX}/usr/lib" \
	|| die "configure failed"
}

src_install() {
	emake DESTDIR="${ED}" install
	insinto /usr/share/doc/${PF}
	dodoc 00README History AUTHORS
	use examples && doins -r examples
}