Skip to content

Commit f0aa088

Browse files
committed
sci-physics/madgraph5: add 9999
1 parent 1e05bb0 commit f0aa088

3 files changed

Lines changed: 161 additions & 36 deletions

File tree

sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-make.patch

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
--- Template/NLO/MCatNLO/srcPythia8/Makefile.orig 2025-10-20 02:38:13.148825000 +0200
2-
+++ Template/NLO/MCatNLO/srcPythia8/Makefile 2025-10-20 02:39:00.008842225 +0200
3-
@@ -3,6 +3,7 @@
4-
-include $(PYTHIA8LOCATION)/config.mk
5-
-include ../Source/make_opts
6-
7-
+
8-
F77=$(FC)
9-
DEBUG=
10-
FF=$(F77) $(DEBUG)
11-
@@ -20,6 +21,9 @@
1+
--- a/Template/NLO/MCatNLO/srcPythia8/Makefile 2025-10-26 13:33:24.567078241 +0100
2+
+++ b/Template/NLO/MCatNLO/srcPythia8/Makefile 2025-10-26 13:33:43.140411913 +0100
3+
@@ -20,6 +20,9 @@
124
LIBGZIP=-L$(ZLIBLOCATION) -lz
135
endif
146

sci-physics/madgraph5/madgraph5-3.6.5.ebuild

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,26 @@ HOMEPAGE="
1717
https://launchpad.net/mg5amcnlo
1818
https://github.com/mg5amcnlo/mg5amcnlo
1919
"
20-
SRC_URI="
20+
if [[ ${PV} == 9999 ]]; then
21+
inherit git-r3
22+
EGIT_REPO_URI="https://github.com/mg5amcnlo/mg5amcnlo"
23+
EGIT_BRANCH="3.x"
24+
else
25+
SRC_URI="
2126
https://launchpad.net/mg5amcnlo/$(ver_cut 1).0/$(ver_cut 1-2).x/+download/${MY_PN}${PV}.tar.gz -> ${MY_P}.tar.gz
2227
http://madgraph.phys.ucl.ac.be//Downloads/MG5aMC_PY8_interface/MG5aMC_PY8_interface_V1.3.tar.gz
2328
"
24-
S="${WORKDIR}/${MY_PF}"
29+
S="${WORKDIR}/${MY_PF}"
30+
KEYWORDS="~amd64"
31+
fi
32+
2533

2634
LICENSE="UoI-NCSA"
2735
SLOT="3"
28-
KEYWORDS="~amd64"
2936
IUSE="+hepmc2 +lhapdf +fastjet +pythia collier thepeg madanalysis5 ninja samurai golem95 herwig yoda rivet"
3037
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
3138

32-
RDEPEND="
39+
DEPEND="
3340
${PYTHON_DEPS}
3441
sys-libs/zlib
3542
sys-devel/gcc:*[fortran]
@@ -58,20 +65,22 @@ RDEPEND="
5865
sci-physics/iregi[static-libs]
5966
sci-physics/qcdloop[static-libs(-)]
6067
"
61-
DEPEND="${RDEPEND}"
68+
RDEPEND="${DEPEND}"
69+
# Wants to know madgraph5 version ...
70+
PDEPEND="sci-physics/madgraph5-pythia8-interface"
6271

6372
PATCHES=(
64-
"${FILESDIR}"/${P}-nlo-template-libs.patch
65-
"${FILESDIR}"/${P}-pythia-hepmc2.patch
66-
"${FILESDIR}"/${P}-pythia-make.patch
73+
"${FILESDIR}"/${PN}-3.6.5-nlo-template-libs.patch
74+
"${FILESDIR}"/${PN}-3.6.5-pythia-hepmc2.patch
75+
"${FILESDIR}"/${PN}-3.6.5-pythia-make.patch
6776
)
6877

6978
src_unpack() {
70-
# Perserve permissions
71-
tar xzf "${DISTDIR}/${MY_PNN}-${PV}.tar.gz" -C "${WORKDIR}" || die
72-
if use pythia; then
73-
mkdir -p "${S}/HEPTools/MG5aMC_PY8_interface/" || die
74-
tar xzf "${DISTDIR}/MG5aMC_PY8_interface_V1.3.tar.gz" -C "${S}/HEPTools/MG5aMC_PY8_interface/" || die
79+
if [[ ${PV} == *9999* ]]; then
80+
git-r3_src_unpack
81+
else
82+
# Perserve permissions
83+
tar xzf "${DISTDIR}/${MY_PNN}-${PV}.tar.gz" -C "${WORKDIR}" || die
7584
fi
7685
}
7786

@@ -80,7 +89,7 @@ src_configure() {
8089
$(usex lhapdf "lhapdf_py3 = ${EPREFIX}/usr/bin/lhapdf-config" "")
8190
$(usex fastjet "fastjet = ${EPREFIX}/usr/bin/fastjet-config" "")
8291
$(usex pythia "pythia8_path = ${EPREFIX}/usr" "")
83-
$(usex pythia "mg5amc_py8_interface_path = ./HEPTools/MG5aMC_PY8_interface" "")
92+
$(usex pythia "mg5amc_py8_interface_path = ${EPREFIX}/opt/madgraph5-pythia8-interface" "")
8493
$(usex hepmc2 "hepmc_path = ${EPREFIX}/usr" "")
8594
$(usex collier "collier = ${EPREFIX}/usr/$(get_libdir)" "")
8695
$(usex thepeg "thepeg_path = ${EPREFIX}/usr/$(get_libdir)" "")
@@ -98,16 +107,6 @@ src_configure() {
98107
src_compile() {
99108
# MadGraph needs to generate `Template/LO/Source/make_opts` which is done
100109
# automatically at startup. This needs to be done during setup (or with root access)
101-
if use pythia; then
102-
tc-export CXX
103-
cd HEPTools/MG5aMC_PY8_interface/ || die
104-
${CXX} \
105-
${CXXFLAGS} MG5aMC_PY8_interface.cc -o MG5aMC_PY8_interface \
106-
$(pythia8-config --ldflags) -lHepMC ${LDFLAGS} || die
107-
echo "$(pythia8-config --version)" >> PYTHIA8_VERSION_ON_INSTALL || die
108-
echo "$PV" >> MG5AMC_VERSION_ON_INSTALL || die
109-
cd ../.. || die
110-
fi
111110
echo "exit" >> tmpfile || die
112111
bin/mg5_aMC ./tmpfile || die
113112
rm tmpfile || die
@@ -125,7 +124,7 @@ src_install() {
125124
# symlink entrypoint
126125
dosym ../../opt/${MY_PF}/bin/mg5_aMC /usr/bin/mg5_aMC3
127126
dosym ../opt/${MY_PF} /opt/"${MY_PNN}"
128-
mv "${WORKDIR}/${MY_PF}" "${ED}/opt/" || die
127+
mv "${S}" "${ED}/opt/" || die
129128

130129
dosym ../../../../../usr/$(get_libdir)/libiregi.a /opt/${MY_PF}/vendor/IREGI/src/libiregi.a
131130
dosym ../../../../../../../usr/$(get_libdir)/libqcdloop.a /opt/${MY_PF}/vendor/IREGI/src/qcdloop/ql/libqcdloop.a
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Distributed under the terms of the GNU General Public License v2
2+
3+
EAPI=8
4+
5+
# does not escape strings properly, so no python3_12 for now
6+
PYTHON_COMPAT=( python3_{11..13} )
7+
inherit fortran-2 python-single-r1 toolchain-funcs
8+
9+
MY_PNN="MadGraph5"
10+
MY_PV=$(ver_rs 1-3 '_')
11+
MY_PN="MG5_aMC_v"
12+
MY_PF=${MY_PN}${MY_PV}
13+
MY_P=${MY_PNN}-${PV}
14+
15+
DESCRIPTION="MadGraph5_aMC@NLO"
16+
HOMEPAGE="
17+
https://launchpad.net/mg5amcnlo
18+
https://github.com/mg5amcnlo/mg5amcnlo
19+
"
20+
if [[ ${PV} == 9999 ]]; then
21+
inherit git-r3
22+
EGIT_REPO_URI="https://github.com/mg5amcnlo/mg5amcnlo"
23+
EGIT_BRANCH="3.x"
24+
else
25+
SRC_URI="
26+
https://launchpad.net/mg5amcnlo/$(ver_cut 1).0/$(ver_cut 1-2).x/+download/${MY_PN}${PV}.tar.gz -> ${MY_P}.tar.gz
27+
http://madgraph.phys.ucl.ac.be//Downloads/MG5aMC_PY8_interface/MG5aMC_PY8_interface_V1.3.tar.gz
28+
"
29+
S="${WORKDIR}/${MY_PF}"
30+
KEYWORDS="~amd64"
31+
fi
32+
33+
34+
LICENSE="UoI-NCSA"
35+
SLOT="3"
36+
IUSE="+hepmc2 +lhapdf +fastjet +pythia collier thepeg madanalysis5 ninja samurai golem95 herwig yoda rivet"
37+
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
38+
39+
DEPEND="
40+
${PYTHON_DEPS}
41+
sys-libs/zlib
42+
sys-devel/gcc:*[fortran]
43+
$(python_gen_cond_dep '
44+
dev-python/numpy[${PYTHON_USEDEP}]
45+
')
46+
lhapdf? ( sci-physics/lhapdf[static-libs(-),${PYTHON_SINGLE_USEDEP}] )
47+
fastjet? ( sci-physics/fastjet[${PYTHON_SINGLE_USEDEP}] )
48+
pythia? (
49+
sci-physics/pythia:8=[static-libs,hepmc2(-),-hepmc3(-),examples]
50+
sci-physics/hepmc:2=
51+
)
52+
hepmc2? ( sci-physics/hepmc:2 )
53+
collier? ( sci-physics/collier[static-libs] )
54+
thepeg? (
55+
sci-physics/thepeg[hepmc3(-),fastjet?,lhapdf?]
56+
)
57+
madanalysis5? ( sci-physics/madanalysis5 )
58+
ninja? ( sci-physics/ninja[static-libs] )
59+
samurai? ( sci-physics/samurai )
60+
golem95? ( sci-physics/golem95 )
61+
herwig? ( sci-physics/herwig )
62+
yoda? ( sci-physics/yoda )
63+
rivet? ( sci-physics/rivet )
64+
sci-physics/cuttools
65+
sci-physics/iregi[static-libs]
66+
sci-physics/qcdloop[static-libs(-)]
67+
"
68+
RDEPEND="${DEPEND}"
69+
# Wants to know madgraph5 version ...
70+
PDEPEND="sci-physics/madgraph5-pythia8-interface"
71+
72+
PATCHES=(
73+
"${FILESDIR}"/${PN}-3.6.5-nlo-template-libs.patch
74+
"${FILESDIR}"/${PN}-3.6.5-pythia-hepmc2.patch
75+
"${FILESDIR}"/${PN}-3.6.5-pythia-make.patch
76+
)
77+
78+
src_unpack() {
79+
if [[ ${PV} == *9999* ]]; then
80+
git-r3_src_unpack
81+
else
82+
# Perserve permissions
83+
tar xzf "${DISTDIR}/${MY_PNN}-${PV}.tar.gz" -C "${WORKDIR}" || die
84+
fi
85+
}
86+
87+
src_configure() {
88+
cat <<-EOF >> input/mg5_configuration.txt || die
89+
$(usex lhapdf "lhapdf_py3 = ${EPREFIX}/usr/bin/lhapdf-config" "")
90+
$(usex fastjet "fastjet = ${EPREFIX}/usr/bin/fastjet-config" "")
91+
$(usex pythia "pythia8_path = ${EPREFIX}/usr" "")
92+
$(usex pythia "mg5amc_py8_interface_path = ${EPREFIX}/opt/madgraph5-pythia8-interface" "")
93+
$(usex hepmc2 "hepmc_path = ${EPREFIX}/usr" "")
94+
$(usex collier "collier = ${EPREFIX}/usr/$(get_libdir)" "")
95+
$(usex thepeg "thepeg_path = ${EPREFIX}/usr/$(get_libdir)" "")
96+
$(usex herwig "hwpp_path = ${EPREFIX}/usr/$(get_libdir)" "")
97+
ninja = $(usex ninja "${EPREFIX}/usr/$(get_libdir)" "''")
98+
samurai = $(usex samurai "${EPREFIX}/usr/$(get_libdir)" "''")
99+
golem = $(usex golem95 "${EPREFIX}/usr/$(get_libdir)" "''")
100+
$(usex yoda "yoda_path= ${EPREFIX}/usr/$(get_libdir)" "")
101+
$(usex rivet "rivet_path= ${EPREFIX}/usr/$(get_libdir)" "")
102+
$(usex madanalysis5 "madanalysis5_path = ${EPREFIX}/opt/MadAnalysis5/" "")
103+
auto_update = 0
104+
EOF
105+
}
106+
107+
src_compile() {
108+
# MadGraph needs to generate `Template/LO/Source/make_opts` which is done
109+
# automatically at startup. This needs to be done during setup (or with root access)
110+
echo "exit" >> tmpfile || die
111+
bin/mg5_aMC ./tmpfile || die
112+
rm tmpfile || die
113+
114+
cd vendor/StdHEP || die
115+
emake all
116+
cd ../.. || die
117+
118+
# cd vendor/CutTools || die
119+
# emake
120+
# cd ../.. || die
121+
}
122+
123+
src_install() {
124+
# symlink entrypoint
125+
dosym ../../opt/${MY_PF}/bin/mg5_aMC /usr/bin/mg5_aMC3
126+
dosym ../opt/${MY_PF} /opt/"${MY_PNN}"
127+
mv "${S}" "${ED}/opt/" || die
128+
129+
dosym ../../../../../usr/$(get_libdir)/libiregi.a /opt/${MY_PF}/vendor/IREGI/src/libiregi.a
130+
dosym ../../../../../../../usr/$(get_libdir)/libqcdloop.a /opt/${MY_PF}/vendor/IREGI/src/qcdloop/ql/libqcdloop.a
131+
132+
dosym ../../../../../usr/$(get_libdir)/libcts.a /opt/${MY_PF}/vendor/CutTools/includects/libcts.a
133+
dosym ../../../../../usr/include/mpmodule.mod /opt/${MY_PF}/vendor/CutTools/includects/mpmodule.mod
134+
}

0 commit comments

Comments
 (0)