1 |
|
# Copyright 1999-2022 Gentoo Authors
|
|
1 |
# Copyright 1999-2024 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit toolchain-funcs
|
|
6 |
PYTHON_COMPAT=( python3_{11..13} )
|
|
7 |
inherit toolchain-funcs python-single-r1
|
7 |
8 |
|
8 |
9 |
MV=$(ver_cut 1-2)
|
9 |
10 |
MY_P="${PN}${PV//./}"
|
... | ... | |
11 |
12 |
|
12 |
13 |
DESCRIPTION="Lund Monte Carlo high-energy physics event generator"
|
13 |
14 |
HOMEPAGE="https://pythia.org/"
|
14 |
|
SRC_URI="https://pythia.org/download/${PN}${MV//./}/${MY_P}.tgz
|
15 |
|
test? ( lhapdf? (
|
16 |
|
https://www.hepforge.org/archive/lhapdf/pdfsets/v6.backup/${LHA_VER}/CT10.tar.gz
|
17 |
|
https://www.hepforge.org/archive/lhapdf/pdfsets/v6.backup/${LHA_VER}/MRST2007lomod.tar.gz
|
18 |
|
https://www.hepforge.org/archive/lhapdf/pdfsets/v6.backup/${LHA_VER}/NNPDF23_nlo_as_0119_qed_mc.tar.gz
|
19 |
|
https://www.hepforge.org/archive/lhapdf/pdfsets/v6.backup/${LHA_VER}/NNPDF23_nnlo_as_0119_qed_mc.tar.gz
|
20 |
|
https://www.hepforge.org/archive/lhapdf/pdfsets/v6.backup/${LHA_VER}/cteq66.tar.gz
|
21 |
|
https://www.hepforge.org/archive/lhapdf/pdfsets/v6.backup/${LHA_VER}/cteq6l1.tar.gz
|
22 |
|
https://www.hepforge.org/archive/lhapdf/pdfsets/v6.backup/${LHA_VER}/unvalidated/MRST2004qed.tar.gz
|
23 |
|
) )"
|
|
15 |
SRC_URI="test? ( lhapdf? (
|
|
16 |
https://lhapdfsets.web.cern.ch/lhapdfsets/current/CT10.tar.gz
|
|
17 |
https://lhapdfsets.web.cern.ch/lhapdfsets/current/MRST2007lomod.tar.gz
|
|
18 |
https://lhapdfsets.web.cern.ch/lhapdfsets/current/NNPDF23_nlo_as_0119_qed_mc.tar.gz
|
|
19 |
https://lhapdfsets.web.cern.ch/lhapdfsets/current/NNPDF23_nnlo_as_0119_qed_mc.tar.gz
|
|
20 |
https://lhapdfsets.web.cern.ch/lhapdfsets/current/cteq66.tar.gz
|
|
21 |
https://lhapdfsets.web.cern.ch/lhapdfsets/current/cteq6l1.tar.gz
|
|
22 |
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/MRST2004qed.tar.gz
|
|
23 |
) )
|
|
24 |
"
|
|
25 |
if [[ ${PV} == 9999 ]]; then
|
|
26 |
inherit git-r3
|
|
27 |
EGIT_REPO_URI="https://gitlab.com/Pythia8/releases"
|
|
28 |
else
|
|
29 |
SRC_URI="https://pythia.org/download/${PN}${MV//./}/${MY_P}.tgz
|
|
30 |
${SRC_URI}"
|
|
31 |
KEYWORDS="~amd64 ~x86"
|
|
32 |
S="${WORKDIR}/${MY_P}"
|
|
33 |
fi
|
24 |
34 |
|
25 |
|
SLOT="8"
|
26 |
35 |
LICENSE="GPL-2"
|
27 |
|
KEYWORDS="~amd64 ~x86"
|
28 |
|
IUSE="doc examples fastjet +hepmc lhapdf root test zlib"
|
|
36 |
SLOT="8"
|
|
37 |
IUSE="doc examples fastjet +hepmc3 hepmc2 lhapdf root test zlib python highfive mpich rivet" # evtgen mg5mes rivet powheg
|
29 |
38 |
RESTRICT="!test? ( test )"
|
|
39 |
REQUIRED_USE="
|
|
40 |
?? ( hepmc3 hepmc2 )
|
|
41 |
python? ( ${PYTHON_REQUIRED_USE} )
|
|
42 |
"
|
30 |
43 |
|
31 |
44 |
RDEPEND="
|
32 |
45 |
fastjet? ( sci-physics/fastjet )
|
33 |
|
hepmc? ( sci-physics/hepmc:3= )
|
|
46 |
hepmc3? ( sci-physics/hepmc:3= )
|
|
47 |
hepmc2? ( sci-physics/hepmc:2= )
|
34 |
48 |
lhapdf? ( sci-physics/lhapdf:= )
|
35 |
|
zlib? ( sys-libs/zlib )"
|
|
49 |
zlib? ( sys-libs/zlib )
|
|
50 |
highfive? (
|
|
51 |
sci-libs/HighFive
|
|
52 |
sci-libs/hdf5[cxx]
|
|
53 |
)
|
|
54 |
rivet? (
|
|
55 |
sci-physics/rivet:*
|
|
56 |
)
|
|
57 |
mpich? ( sys-cluster/mpich )
|
|
58 |
python? ( ${PYTHON_DEPS} )
|
|
59 |
"
|
|
60 |
DEPEND="${RDEPEND}"
|
36 |
61 |
# ROOT is used only when building related tests
|
37 |
|
DEPEND="${RDEPEND}
|
|
62 |
BDEPEND="
|
38 |
63 |
test? (
|
39 |
64 |
root? ( sci-physics/root:= )
|
40 |
|
)"
|
41 |
|
|
42 |
|
PATCHES=(
|
43 |
|
"${FILESDIR}"/${PN}8209-root-noninteractive.patch
|
44 |
|
)
|
|
65 |
)
|
|
66 |
"
|
45 |
67 |
|
46 |
|
S="${WORKDIR}/${MY_P}"
|
|
68 |
pkg_setup() {
|
|
69 |
use python && python-single-r1_pkg_setup
|
|
70 |
}
|
47 |
71 |
|
48 |
72 |
pkg_pretend() {
|
49 |
73 |
if use root && ! use test; then
|
... | ... | |
53 |
77 |
}
|
54 |
78 |
|
55 |
79 |
src_prepare() {
|
56 |
|
PYTHIADIR="/usr/share/pythia8"
|
|
80 |
PYTHIADIR="/usr/share/Pythia8"
|
57 |
81 |
EPYTHIADIR="${EPREFIX}${PYTHIADIR}"
|
58 |
82 |
|
59 |
83 |
default
|
... | ... | |
68 |
92 |
-e "s|-O2|${CXXFLAGS}|g" \
|
69 |
93 |
-e "s|Cint|Core|g" \
|
70 |
94 |
configure || die
|
71 |
|
sed -i 's|$(CXX) $^ -o $@ $(CXX_COMMON) $(CXX_SHARED)|$(CXX) $(LDFLAGS) $^ -o $@ $(CXX_COMMON) $(CXX_SHARED)|g' \
|
72 |
|
Makefile || die
|
73 |
|
sed -i 's|$(CXX)|$(CXX) $(LDFLAGS)|' examples/Makefile || die
|
74 |
95 |
# we use lhapdf6 instead of lhapdf5
|
75 |
96 |
# some PDFs changed, use something similar
|
76 |
97 |
sed -i \
|
... | ... | |
87 |
108 |
-e "s|1e-8|3e-1|g" \
|
88 |
109 |
-e "s|nlo_as_0119_qed|nlo_as_0119_qed_mc|g" \
|
89 |
110 |
-e "s|xmldoc|share/Pythia8/xmldoc|g" \
|
90 |
|
examples/main54.cc || die
|
|
111 |
examples/main203.cc || die
|
91 |
112 |
# ask cflags from root
|
92 |
113 |
sed -i "s|root-config|root-config --cflags|g" examples/Makefile || die
|
93 |
114 |
|
... | ... | |
101 |
122 |
# - ProMC https://github.com/Argonne-National-Laboratory/ProMC/
|
102 |
123 |
src_configure() {
|
103 |
124 |
# homemade configure script
|
|
125 |
local -x CXX="$(tc-getCXX) ${CXXFLAGS} ${LDFLAGS}"
|
104 |
126 |
./configure \
|
105 |
127 |
--arch=Linux \
|
106 |
|
--cxx="$(tc-getCXX)" \
|
107 |
128 |
--prefix="${EPREFIX}/usr" \
|
108 |
|
--prefix-lib="$(get_libdir)" \
|
|
129 |
--prefix-lib="${EPREFIX}/usr/$(get_libdir)" \
|
109 |
130 |
--prefix-share="${EPYTHIADIR}" \
|
110 |
131 |
$(usex fastjet "--with-fastjet3" "") \
|
111 |
132 |
$(usex zlib "--with-gzip" "") \
|
112 |
|
$(usex hepmc "--with-hepmc3" "") \
|
|
133 |
$(use_with hepmc3) \
|
|
134 |
$(use_with highfive) \
|
|
135 |
$(usex highfive --with-hdf5 "") \
|
|
136 |
$(use_with python) \
|
|
137 |
$(use_with rivet) \
|
|
138 |
$(use_with mpich) \
|
|
139 |
$(use_with hepmc2) \
|
113 |
140 |
$(usex lhapdf "--with-lhapdf6
|
114 |
141 |
--with-lhapdf6-plugin=LHAPDF6.h
|
115 |
142 |
--with-lhapdf6-lib=${EPREFIX}/usr/$(get_libdir)" "") \
|
... | ... | |
120 |
147 |
|
121 |
148 |
# fix pythia config script
|
122 |
149 |
sed -i \
|
123 |
|
-e 's|pythia8/examples/Makefile.inc|pythia8/Makefile.inc|' \
|
|
150 |
-e 's|Pythia8/examples/Makefile.inc|Pythia8/Makefile.inc|' \
|
|
151 |
-e "s|CFG_FILE=.*|CFG_FILE=${EPYTHIADIR}/Makefile.inc|" \
|
124 |
152 |
-e 's|LINE%=|LINE%%=|' \
|
125 |
153 |
bin/pythia8-config || die
|
126 |
154 |
}
|
... | ... | |
128 |
156 |
src_test() {
|
129 |
157 |
cd examples || die
|
130 |
158 |
|
131 |
|
local tests="$(echo main{{01..32},37,38,61,62,73,80}.out)"
|
132 |
|
use hepmc && tests+=" $(echo main{41,42,85,86}.out)"
|
133 |
|
use hepmc && use lhapdf && tests+=" $(echo main{43,{87..89}}.out)"
|
134 |
|
use lhapdf && tests+=" $(echo main{51..54}.out)"
|
135 |
|
use fastjet && tests+=" $(echo main{71,72}.out)"
|
136 |
|
use fastjet && use hepmc && use lhapdf && tests+=" $(echo main{81..84}).out"
|
137 |
|
use root && tests+=" main91.out"
|
138 |
|
# Disabled tests:
|
139 |
|
# 33 needs PowHEG
|
140 |
|
# 46 needs ProMC
|
141 |
|
# 48 needs EvtGen
|
142 |
|
# 92 generated ROOT dictionary is badly broken
|
|
159 |
local tests="$(echo main{{101..103},{121..127}})"
|
|
160 |
use hepmc3 && tests+=" $(echo main{131..135})"
|
|
161 |
use hepmc3 && use mpich && use highfive && tests+=" $(echo main136)"
|
|
162 |
use lhapdf && tests+=" $(echo main{201..204})"
|
|
163 |
use fastjet && tests+=" $(echo main{211..216})"
|
|
164 |
use root && tests+=" main143"
|
|
165 |
use hepmc3 && use lhapdf && tests+=" $(echo main{133,162})"
|
|
166 |
use fastjet && use hepmc3 && use lhapdf && tests+=" $(echo main161)"
|
|
167 |
# Other tests disabled due to missing dependencies
|
143 |
168 |
|
144 |
169 |
# use emake for parallel instead of long runmains
|
145 |
170 |
LD_LIBRARY_PATH="${S}/$(get_libdir):${LD_LIBRARY_PATH}" \
|
... | ... | |
156 |
181 |
dolib.so lib/libpythia8.so
|
157 |
182 |
use lhapdf && dolib.so lib/libpythia8lhapdf6.so
|
158 |
183 |
insinto "${PYTHIADIR}"
|
159 |
|
doins -r share/Pythia8/xmldoc examples/Makefile.inc
|
|
184 |
doins -r share/Pythia8/xmldoc share/Pythia8/pdfdata examples/Makefile.inc
|
160 |
185 |
|
161 |
186 |
newenvd - 99pythia8 <<- _EOF_
|
162 |
187 |
PYTHIA8DATA=${EPYTHIADIR}/xmldoc
|
163 |
188 |
_EOF_
|
164 |
189 |
|
165 |
190 |
dodoc AUTHORS GUIDELINES README
|
|
191 |
|
166 |
192 |
if use doc; then
|
167 |
193 |
dodoc -r share/Pythia8/pdfdoc/.
|
168 |
194 |
dodoc -r share/Pythia8/htmldoc/.
|
... | ... | |
177 |
203 |
doins -r examples
|
178 |
204 |
docompress -x /usr/share/doc/${PF}/examples
|
179 |
205 |
fi
|
|
206 |
if use python; then
|
|
207 |
local site_dir=$(python_get_sitedir)
|
|
208 |
insinto "${site_dir#${EPREFIX}}"
|
|
209 |
doins lib/pythia8.so
|
|
210 |
fi
|
180 |
211 |
|
181 |
212 |
# cleanup
|
182 |
213 |
unset PYTHIADIR EPYTHIADIR
|