1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils versionator toolchain-funcs multilib
9 MV=$(get_major_version)
10 MY_P=${PN}$(replace_all_version_separators "" ${PV})
12 DESCRIPTION="Lund Monte Carlo high-energy physics event generator"
13 HOMEPAGE="http://pythia8.hepforge.org/"
14 SRC_URI="http://home.thep.lu.se/~torbjorn/${PN}${MV}/${MY_P}.tgz"
18 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
19 IUSE="doc examples gzip +hepmc static-libs"
22 gzip? ( dev-libs/boost sys-libs/zlib )
23 hepmc? ( sci-physics/hepmc:0= )"
26 S="${WORKDIR}/${MY_P}"
29 PYTHIADIR="${EPREFIX}/usr/share/pythia8"
30 # set datadir for xmldor in include file
32 -e "s:../xmldoc:${PYTHIADIR}/xmldoc:" \
33 include/Pythia8/Pythia.h || die
34 # respect libdir, prefix, flags
36 -e "s:/lib:/$(get_libdir):g" \
37 -e "s:/usr:${EPREFIX}/usr:g" \
41 -e "s:LIBDIR=.*:LIBDIR=$(get_libdir):" \
42 -e "s:LIBDIRARCH=.*:LIBDIRARCH=$(get_libdir):" \
43 -e "s:cp -r lib:cp -r $(get_libdir):" \
45 Makefile examples/Makefile || die
49 export USRCXXFLAGS="${CXXFLAGS}"
50 export USRLDFLAGSSHARED="${LDFLAGS}"
52 # homemade configure script
54 --installdir="${EPREFIX}/usr" \
55 --datadir="${PYTHIADIR}" \
57 $(usex gzip "--enable-gzip=yes" "") \
58 $(usex hepmc "--with-hepmcversion=2 --with-hepmc=${EPREFIX}/usr" "") \
60 if ! use static-libs; then
62 -e '/targets.*=$(LIBDIR.*\.a$/d' \
63 -e 's/+=\(.*libpythia8\.\)/=\1/' \
67 -e 's:$(LIBDIRARCH):$(LIBDIR):g' \
68 examples/Makefile || die
74 # use emake for parallel instead of long runmains
75 local tests="$(echo main0{1..8})" t
76 use hepmc && tests="${tests} main31"
79 LD_LIBRARY_PATH="${S}/$(get_libdir):${LD_LIBRARY_PATH}" \
80 bin/${t}.exe > ${t}.out || die "test ${t} failed"
82 emake clean && rm main*out
86 emake INSTALLDIR="${ED}/usr" DATADIR="${D}/${PYTHIADIR}" install
87 rm -r "${D}"/${PYTHIADIR}/{html,php}doc || die
88 echo "PYTHIA8DATA=${PYTHIADIR}/xmldoc" >> 99pythia8
91 dodoc GUIDELINES AUTHORS README
93 dodoc worksheet.pdf htmldoc/pythia8100.pdf
97 insinto /usr/share/doc/${PF}
98 doins -r examples rootexamples
99 docompress -x /usr/share/doc/${PF}/{root,}examples