diff --git a/dev-python/spey-pyhf/Manifest b/dev-python/spey-pyhf/Manifest
new file mode 100644
index 00000000000..6699876b91d
--- /dev/null
+++ b/dev-python/spey-pyhf/Manifest
@@ -0,0 +1 @@
+DIST spey-pyhf-0.2.0.gh.tar.gz 86763 BLAKE2B 85b07154b1b2566a6fd46df8edad96c8519883f911cc0a0c02e2e32938e7ab0e769351a289627a159c98d3957121d51b51975e560ba125890b2b79ab5e67f64c SHA512 6d900afcb7054311bc054bf92ea22aa22bf900774e980a0506006848301164505580117afff98e7066741ff4b8ac24624f8c20a5cf521e536ac3b19ebb6d8194
diff --git a/dev-python/spey-pyhf/metadata.xml b/dev-python/spey-pyhf/metadata.xml
new file mode 100644
index 00000000000..7760775743c
--- /dev/null
+++ b/dev-python/spey-pyhf/metadata.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ sci@gentoo.org
+ Gentoo Science Project
+
+
+ apn-pucky@gentoo.org
+ Alexander Puck Neuwirth
+
+
+ spey-pyhf
+ SpeysideHEP/spey-pyhf
+
+
diff --git a/dev-python/spey-pyhf/spey-pyhf-0.2.0.ebuild b/dev-python/spey-pyhf/spey-pyhf-0.2.0.ebuild
new file mode 100644
index 00000000000..1ff461b47a0
--- /dev/null
+++ b/dev-python/spey-pyhf/spey-pyhf-0.2.0.ebuild
@@ -0,0 +1,28 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..13} )
+DISTUTILS_USE_PEP517=setuptools
+PYPI_NO_NORMALIZE=1
+inherit distutils-r1
+
+DESCRIPTION="pyhf plugin for spey interface"
+HOMEPAGE="
+ https://github.com/SpeysideHEP/spey-pyhf/
+ https://speysidehep.github.io/spey-pyhf/
+ https://arxiv.org/abs/2307.06996
+"
+
+SRC_URI="https://github.com/SpeysideHEP/spey-pyhf/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+ ~sci-physics/pyhf-0.7.6[${PYTHON_USEDEP}]
+ >=dev-python/spey-0.2.1[${PYTHON_USEDEP}]
+"
+BDEPEND="${RDEPEND}"
diff --git a/dev-python/spey/Manifest b/dev-python/spey/Manifest
new file mode 100644
index 00000000000..28aee11e96d
--- /dev/null
+++ b/dev-python/spey/Manifest
@@ -0,0 +1 @@
+DIST spey-0.2.5.gh.tar.gz 2975664 BLAKE2B 67b54258bf0151338567dfe38f84855b30a8dba2516d1af039a1ce1f0a4aebf2efe0131f87d1be1e305f3e094dfbbc70684d6c96d4a0159b813dc7557cd46c3e SHA512 0d758b5b6ba5844c89a87eda8c462d829f48e0ee41acec2bdd784fd282eb29535d4fb67db8013c28254998327e64bbe90f5b3f20859cdb21f1bed896faaf218d
diff --git a/dev-python/spey/metadata.xml b/dev-python/spey/metadata.xml
new file mode 100644
index 00000000000..ffe8fc39b90
--- /dev/null
+++ b/dev-python/spey/metadata.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ sci@gentoo.org
+ Gentoo Science Project
+
+
+ apn-pucky@gentoo.org
+ Alexander Puck Neuwirth
+
+
+ spey
+ SpeysideHEP/spey
+
+
diff --git a/dev-python/spey/spey-0.2.5.ebuild b/dev-python/spey/spey-0.2.5.ebuild
new file mode 100644
index 00000000000..290dea32a7c
--- /dev/null
+++ b/dev-python/spey/spey-0.2.5.ebuild
@@ -0,0 +1,33 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..13} )
+DISTUTILS_USE_PEP517=setuptools
+inherit distutils-r1
+
+DESCRIPTION="Smooth inference for reinterpretation studies"
+HOMEPAGE="
+ https://github.com/SpeysideHEP/spey/
+ https://spey.readthedocs.io/
+ https://arxiv.org/abs/2307.06996
+"
+
+SRC_URI="https://github.com/SpeysideHEP/spey/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+ >=dev-python/numpy-1.21.6[${PYTHON_USEDEP}]
+ >=dev-python/scipy-1.10.0[${PYTHON_USEDEP}]
+ >=dev-python/autograd-1.5[${PYTHON_USEDEP}]
+ >=dev-python/semantic-version-2.10[${PYTHON_USEDEP}]
+ >=dev-python/tqdm-4.64.0[${PYTHON_USEDEP}]
+ >=dev-python/requests-2.31.0[${PYTHON_USEDEP}]
+"
+BDEPEND="${RDEPEND}"
+
+distutils_enable_tests pytest
diff --git a/sci-physics/cuttools/cuttools-2.0.0-r2.ebuild b/sci-physics/cuttools/cuttools-2.0.0-r2.ebuild
new file mode 100644
index 00000000000..a7be6603b46
--- /dev/null
+++ b/sci-physics/cuttools/cuttools-2.0.0-r2.ebuild
@@ -0,0 +1,70 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit fortran-2 toolchain-funcs
+
+MY_V="$(ver_cut 1).$(ver_cut 2)"
+
+DESCRIPTION="Computing 1-loop amplitudes at the integrand level"
+HOMEPAGE="https://www.ugr.es/~pittau/CutTools/"
+SRC_URI="https://www.ugr.es/~pittau/CutTools/${PN}_v${MY_V}.tar.gz"
+S="${WORKDIR}"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="+dummy mpfun90 static-libs"
+DEPEND="
+ sci-libs/mpfun90
+ sci-physics/qcdloop
+ sci-physics/oneloop[dpkind,qpkind16,-qpkind,-tlevel,mpfun90?]
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.9.3-unbundle.patch"
+)
+
+src_prepare() {
+ default
+ sed -i 's/^ALL =.*$/ALL = $(CTS)/' src/makefile || die
+ if use dummy ; then
+ cp "${FILESDIR}"/mpnumdummy.f90 src/cts/mpnumdummy.f90 || die
+ fi
+ if use dummy ; then
+ sed -i 's/CTS =/CTS = mpnumdummy.o/' src/makefile || die
+ fi
+ if use mpfun90; then
+ sed -i 's/PRECISION=.*$/PRECISION= MP/g' makefile || die
+ else
+ sed -i 's/PRECISION=.*$/PRECISION= QP/g' makefile || die
+ fi
+}
+
+src_compile() {
+ if use mpfun90; then
+ emake -j1 FFLAGS="${FFLAGS} -I${ESYSROOT}/usr/include -fPIC -std=legacy" mp
+ else
+ emake -j1 FFLAGS="${FFLAGS} -I${ESYSROOT}/usr/include -fPIC -std=legacy" qp
+ fi
+ tc-export AR CXX
+ cd includects || die
+ ${AR} -x libcts.a || die
+ ${CXX} ${CXXFLAGS} ${LDFLAGS} -shared *.o -Wl,-soname,libcuttools.so -lqcdloop -lmpfun90 -o lib${PN}.so || die
+}
+
+src_install() {
+ cd includects || die
+ use static-libs && dolib.a libcts.a
+ dolib.so lib${PN}.so
+ dosym lib${PN}.so /usr/$(get_libdir)/libcts.so
+ cd .. || die
+ mv includects ${PN} || die
+ rm ${PN}/*.a || die
+ rm ${PN}/*.so || die
+ rm ${PN}/*.o || die
+ doheader -r ${PN}
+}
diff --git a/sci-physics/golem95/Manifest b/sci-physics/golem95/Manifest
new file mode 100644
index 00000000000..6732507ce92
--- /dev/null
+++ b/sci-physics/golem95/Manifest
@@ -0,0 +1 @@
+DIST golem95-1.3.4.gh.tar.gz 703444 BLAKE2B 80d94361eb07cc065a06da96018b9e971316e187b18acf504a807a4a5a9e5d3b72f569ab200ae39216bbf9c955e9a905cc513e1c09b84e6042f22e469ad6c694 SHA512 9192805baa9d9c2e79ae16889f0713d3b7c2c5ac8a41a4c905993700ef17a402055301614e2af3807ade0eb7a15c0a7ef7985f8d1c4182d4e95b1c77e54990ea
diff --git a/sci-physics/golem95/golem95-1.3.4.ebuild b/sci-physics/golem95/golem95-1.3.4.ebuild
new file mode 100644
index 00000000000..56761012c89
--- /dev/null
+++ b/sci-physics/golem95/golem95-1.3.4.ebuild
@@ -0,0 +1,56 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools fortran-2
+
+DESCRIPTION="performs the reduction to a certain set of basis integrals numerically"
+HOMEPAGE="
+ https://golem.hepforge.org/
+ https://github.com/gudrunhe/golem95
+"
+SRC_URI="https://github.com/gudrunhe/golem95/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="+looptools"
+RDEPEND="
+ sci-physics/oneloop[dpkind,qpkind16,-qpkind]
+ looptools? ( sci-physics/looptools )
+"
+DEPEND="${REPEND}"
+
+src_prepare() {
+ default
+ # if uses looptools
+ if use looptools; then
+ # add -looptools to pkgconfig
+ sed -i '/Libs:/s/$/ -looptools/' golem95.pc.in || die
+ fi
+ sed -i 's/lib_LTLIBRARIES.*/lib_LTLIBRARIES = libgolem.la/g' Makefile.am || die
+ eautoreconf
+}
+
+src_configure() {
+ local -x CONFIG_SHELL="${BROOT}/bin/bash"
+ # Fix that qcdloop and oneloop are already installed
+ local myconf=(
+ --with-avh_olo_precision=double
+ --with-precision=double
+ $(use_with looptools looptools "${ESYSROOT}"/usr)
+ FCFLAGS="${FCFLAGS} -std=legacy -fPIC -I${ESYSROOT}/usr/include"
+ )
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ emake -j1
+}
+
+src_install() {
+ default
+ find "${ED}" -name '*.la' -delete || die
+}
diff --git a/sci-physics/golem95/metadata.xml b/sci-physics/golem95/metadata.xml
new file mode 100644
index 00000000000..cce1cf37be0
--- /dev/null
+++ b/sci-physics/golem95/metadata.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ apn-pucky@gentoo.org
+ Alexander Puck Neuwirth
+
+
+ sci-physics@gentoo.org
+ Gentoo Physics Project
+
+
+ The program golem95 is a package for the numerical evaluation of integrals and tensor form factors entering the calculation of one-loop amplitudes with up to six external legs, written in Fortran 95.
+ A package for evaluation of scalar and tensor one-loop integrals
+
+
+
+ gudrunhe/golem95
+
+
diff --git a/sci-physics/iregi/Manifest b/sci-physics/iregi/Manifest
new file mode 100644
index 00000000000..c854a2dcac6
--- /dev/null
+++ b/sci-physics/iregi/Manifest
@@ -0,0 +1 @@
+DIST iregi-1.1.0.tar.bz2 69019 BLAKE2B 833743bce182ac65a5c0633235b7a6ed575bcbb595cc8a601b9cc8046c03c118b2d472567c5bf61c02739a704f289fbd366eb4ebe8f77ed6ebdde8b607f8579f SHA512 fc60ab268533da1e61a3c008020892bd0fd2a144a06dc4cb1dc35fa030eb90d21810a70241bbb13fbe5da1d201f309002400f6091ddd6ca45630ac1e1589a2dc
diff --git a/sci-physics/iregi/iregi-1.1.0.ebuild b/sci-physics/iregi/iregi-1.1.0.ebuild
new file mode 100644
index 00000000000..413bfe8fe07
--- /dev/null
+++ b/sci-physics/iregi/iregi-1.1.0.ebuild
@@ -0,0 +1,48 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit fortran-2 toolchain-funcs
+
+DESCRIPTION="Integral REduction with General positive propagator Indices"
+HOMEPAGE="
+ https://gitlab.com/APN-Pucky/iregi-mirror
+ https://arxiv.org/abs/hep-ph/0303184
+ https://launchpad.net/mg5amcnlo
+ https://github.com/mg5amcnlo/mg5amcnlo
+"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://gitlab.com/APN-Pucky/iregi-mirror"
+ EGIT_BRANCH="master"
+else
+ SRC_URI="https://gitlab.com/APN-Pucky/iregi-mirror/-/archive/v${PV}/iregi-mirror-${PV}.tar.bz2 -> ${P}.tar.bz2"
+ S=${WORKDIR}/${MY_PF}
+ KEYWORDS="~amd64"
+fi
+
+# only lives in MG5_aMC@NLO repo => same license
+LICENSE="UoI-NCSA"
+SLOT="0"
+IUSE="+static-libs"
+
+DEPEND="
+ sci-physics/oneloop
+ sci-physics/qcdloop
+"
+RDEPEND="${DEPEND}"
+
+src_compile() {
+ tc-export FC
+ emake -j1 onelooppath="${EPREFIX}"/usr/include/ FC="${FC}" FFLAGS="${FFLAGS}"
+}
+
+src_install() {
+ default
+
+ if ! use static-libs; then
+ rm -f "${D}"/usr/lib/*.a || die
+ fi
+}
diff --git a/sci-physics/iregi/iregi-9999.ebuild b/sci-physics/iregi/iregi-9999.ebuild
new file mode 100644
index 00000000000..413bfe8fe07
--- /dev/null
+++ b/sci-physics/iregi/iregi-9999.ebuild
@@ -0,0 +1,48 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit fortran-2 toolchain-funcs
+
+DESCRIPTION="Integral REduction with General positive propagator Indices"
+HOMEPAGE="
+ https://gitlab.com/APN-Pucky/iregi-mirror
+ https://arxiv.org/abs/hep-ph/0303184
+ https://launchpad.net/mg5amcnlo
+ https://github.com/mg5amcnlo/mg5amcnlo
+"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://gitlab.com/APN-Pucky/iregi-mirror"
+ EGIT_BRANCH="master"
+else
+ SRC_URI="https://gitlab.com/APN-Pucky/iregi-mirror/-/archive/v${PV}/iregi-mirror-${PV}.tar.bz2 -> ${P}.tar.bz2"
+ S=${WORKDIR}/${MY_PF}
+ KEYWORDS="~amd64"
+fi
+
+# only lives in MG5_aMC@NLO repo => same license
+LICENSE="UoI-NCSA"
+SLOT="0"
+IUSE="+static-libs"
+
+DEPEND="
+ sci-physics/oneloop
+ sci-physics/qcdloop
+"
+RDEPEND="${DEPEND}"
+
+src_compile() {
+ tc-export FC
+ emake -j1 onelooppath="${EPREFIX}"/usr/include/ FC="${FC}" FFLAGS="${FFLAGS}"
+}
+
+src_install() {
+ default
+
+ if ! use static-libs; then
+ rm -f "${D}"/usr/lib/*.a || die
+ fi
+}
diff --git a/sci-physics/madanalysis5/Manifest b/sci-physics/madanalysis5/Manifest
new file mode 100644
index 00000000000..b58e2acd165
--- /dev/null
+++ b/sci-physics/madanalysis5/Manifest
@@ -0,0 +1 @@
+DIST MadAnalysis5-1.11.0.tar.gz 1925867 BLAKE2B 30bc91b740d8fc3ee39b9e8c4ea8d1f7ac61a6e048eda2483f5de500fbd88a6ccf4de3e29edb8a87cd233488349c352ea7bcf534618d2e44503836ab04ba0936 SHA512 719950975508fa71dc5bff8ee1ea0d3fd8579dc54a74e5a4817bc93caefbc7988961b01d933428f9a6bd853632fddebdc4d0118990ed5269063d3b43505c44a5
diff --git a/sci-physics/madanalysis5/madanalysis5-1.11.0.ebuild b/sci-physics/madanalysis5/madanalysis5-1.11.0.ebuild
new file mode 100644
index 00000000000..8f817db17a4
--- /dev/null
+++ b/sci-physics/madanalysis5/madanalysis5-1.11.0.ebuild
@@ -0,0 +1,72 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..13} )
+inherit python-single-r1 optfeature
+
+MY_PN="MadAnalysis5"
+MY_PF=madanalysis5-${PV}
+
+DESCRIPTION="A package for event file analysis and recasting of LHC results"
+HOMEPAGE="
+ https://github.com/MadAnalysis/madanalysis5
+"
+SRC_URI="https://github.com/MadAnalysis/madanalysis5/archive/refs/tags/v${PV}.tar.gz -> ${MY_PN}-${PV}.tar.gz"
+S=${WORKDIR}/${MY_PF}
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="
+ ${PYTHON_DEPS}
+ sys-libs/zlib
+ sci-physics/fastjet[${PYTHON_SINGLE_USEDEP}]
+ sci-physics/root[${PYTHON_SINGLE_USEDEP}]
+ sci-physics/delphes
+ $(python_gen_cond_dep '
+ >=dev-python/spey-0.2.0[${PYTHON_USEDEP}]
+ >=dev-python/spey-pyhf-0.2.0[${PYTHON_USEDEP}]
+ >=dev-python/numpy-1.19.5[${PYTHON_USEDEP}]
+ >=dev-python/scipy-1.7.1[${PYTHON_USEDEP}]
+ >=dev-python/matplotlib-3.4.2[${PYTHON_USEDEP}]
+ >=dev-python/lxml-4.6.2[${PYTHON_USEDEP}]
+ ')
+"
+DEPEND="${RDEPEND}"
+
+# Perserve permissions
+src_unpack() {
+ tar xvzf "${DISTDIR}/${MY_PN}-${PV}.tar.gz" -C "${WORKDIR}"
+}
+
+src_configure() {
+ default
+ # Won't find system installed delphes otherwise
+ sed -i -e "s|self.delphes_includes\s*=\s*None|self.delphes_includes=\"${EPREFIX}/usr/include\"|" madanalysis/system/user_info.py || die
+ sed -i -e "s|self.delphes_libs\s*=\s*None|self.delphes_libs=\"${EPREFIX}/usr/$(get_libdir)\"|" madanalysis/system/user_info.py || die
+ # Fix include path
+ sed -i 's|#include "external/ExRootAnalysis|#include "ExRootAnalysis|g' tools/SampleAnalyzer/Interfaces/delphes/*.cpp || die
+}
+
+src_compile() {
+ default
+ echo "1" | ./bin/ma5 --build || die
+}
+
+src_install() {
+ # symlink entrypoint
+ dosym ../../opt/${MY_PF}/bin/ma5 /usr/bin/ma5
+ dosym ../opt/${MY_PF} /opt/"${MY_PN}"
+ mv "${WORKDIR}/${MY_PF}" "${ED}/opt/" || die
+
+ #fperms -R a=u /opt/${MY_PF}
+}
+
+pkg_postinstall() {
+ optfeature "latex support" virtual/latex-base
+ optfeature "gnuplot support" sci-visualization/gnuplot
+}
diff --git a/sci-physics/madanalysis5/metadata.xml b/sci-physics/madanalysis5/metadata.xml
new file mode 100644
index 00000000000..4c40f64559c
--- /dev/null
+++ b/sci-physics/madanalysis5/metadata.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ apn-pucky@gentoo.org
+ Alexander Puck Neuwirth
+
+
+ MadAnalysis 5 is a framework for phenomenological investigations at particle colliders. Based on a C++ kernel, this program allows to efficiently perform, in a straightforward and user-friendly fashion, sophisticated physics analyses of event files such as those generated by a large class of Monte Carlo event generators.
+
+
+ MadAnalysis/madanalysis5
+
+
diff --git a/sci-physics/madgraph5-pythia8-interface/Manifest b/sci-physics/madgraph5-pythia8-interface/Manifest
new file mode 100644
index 00000000000..e74f06675e4
--- /dev/null
+++ b/sci-physics/madgraph5-pythia8-interface/Manifest
@@ -0,0 +1 @@
+DIST MG5aMC_PY8_interface_V1.3.tar.gz 19554 BLAKE2B 2319129db3e621a3c0954af3aec078216230f4dff673bdad25b52413d5471d267c2a1ebe4d5bbd5de527aa47a5835093bfa04143f805234e6cbd3bfe89b592f5 SHA512 eda7bcd1d039d05709c41f91228fe2169d25c93a2e17719356b356e6f383b01098a2ae22bb06e8805fee114848e514ed6cdad9c6da643bdd01601cae880d731e
diff --git a/sci-physics/madgraph5-pythia8-interface/madgraph5-pythia8-interface-1.3.ebuild b/sci-physics/madgraph5-pythia8-interface/madgraph5-pythia8-interface-1.3.ebuild
new file mode 100644
index 00000000000..9cc1f314320
--- /dev/null
+++ b/sci-physics/madgraph5-pythia8-interface/madgraph5-pythia8-interface-1.3.ebuild
@@ -0,0 +1,51 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="Interface to pythia8 for madgraph5"
+HOMEPAGE="
+ https://github.com/mg5amcnlo/MG5aMC_PY8_interface
+"
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/mg5amcnlo/MG5aMC_PY8_interface"
+ EGIT_BRANCH="main"
+else
+ SRC_URI="http://madgraph.phys.ucl.ac.be//Downloads/MG5aMC_PY8_interface/MG5aMC_PY8_interface_V${PV}.tar.gz"
+ KEYWORDS="~amd64"
+ S="${WORKDIR}"
+fi
+
+LICENSE="UoI-NCSA"
+SLOT="0"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="
+ ${PYTHON_DEPS}
+ sci-physics/pythia:8=[static-libs(-),hepmc2(-),-hepmc3(-),examples]
+"
+BDEPEND="sci-physics/madgraph5"
+DEPEND="${RDEPEND}"
+
+src_compile() {
+ tc-export CXX
+ ${CXX} \
+ ${CXXFLAGS} MG5aMC_PY8_interface.cc -o MG5aMC_PY8_interface \
+ $(pythia8-config --ldflags) -lHepMC ${LDFLAGS} || die
+ echo "$(pythia8-config --version)" >> PYTHIA8_VERSION_ON_INSTALL || die
+ echo "$(best_version sci-physics/madgraph5)" >> MG5AMC_VERSION_ON_INSTALL || die
+}
+
+src_install() {
+ insinto /opt/${PN}
+ exeinto /opt/${PN}
+ doexe MG5aMC_PY8_interface
+ doins MG5AMC_VERSION_ON_INSTALL
+ doins PYTHIA8_VERSION_ON_INSTALL
+ doins VERSION
+ doins MultiHist.h
+ doins SyscalcVeto.h
+}
diff --git a/sci-physics/madgraph5/Manifest b/sci-physics/madgraph5/Manifest
index 1717cf1e742..c52c9a017d5 100644
--- a/sci-physics/madgraph5/Manifest
+++ b/sci-physics/madgraph5/Manifest
@@ -1,2 +1,4 @@
+DIST MG5aMC_PY8_interface_V1.3.tar.gz 19554 BLAKE2B 2319129db3e621a3c0954af3aec078216230f4dff673bdad25b52413d5471d267c2a1ebe4d5bbd5de527aa47a5835093bfa04143f805234e6cbd3bfe89b592f5 SHA512 eda7bcd1d039d05709c41f91228fe2169d25c93a2e17719356b356e6f383b01098a2ae22bb06e8805fee114848e514ed6cdad9c6da643bdd01601cae880d731e
DIST MadGraph5-3.5.3.tar.gz 30234007 BLAKE2B 092462f8a5653b11abff554b733f64e06ce35fc9559400208e9db1412d3b8357dcb3bd3653b99fd48ca9727f195099591d177f33e607a2fff3d339dee9aafb3b SHA512 b9d75a4c37e30a11a7e041b7c657a221a2ef27a5c3fafd09ec37ec5b2cfe953e0baa28dea73061ee155324f992b780259b8ddd6930b37a56894ffcf235ee960a
DIST MadGraph5-3.5.8.tar.gz 31245045 BLAKE2B e7e7a46c90de811109e146a204fce2dccf05025246c49349bc948c3fd9497ce7b20901b39cc0052f874990dda504e8fecabb81a44a2826d054babb8af2fb55c0 SHA512 c5c9a6e7d053c53cef2ace90835025c801eea8177f2d6bd1d082f428f05b3ae22d01a81c4108202ae39ffb6ab02c5af5feaef1e6f26d1861e24c122bc32a4907
+DIST MadGraph5-3.6.5.tar.gz 31664698 BLAKE2B 938031605825928f46e6d98ff2c8ffc71c41813a9a70b159058cc4a7f05738a40437c0e2cb2749ccdf079a357b6c5cfc74f01535fdb3c0e6740abc0ce21d46c1 SHA512 d5cfdc481b2b2212dd71ba3257c5b45b8fc5f1470bf8749eae41e10790732310cbdee6a7c003d981185762ab7fe8fda8ff90afaad640b072cc60d887d4569aac
diff --git a/sci-physics/madgraph5/files/madgraph5-3.6.5-nlo-template-libs.patch b/sci-physics/madgraph5/files/madgraph5-3.6.5-nlo-template-libs.patch
new file mode 100644
index 00000000000..302c91cd432
--- /dev/null
+++ b/sci-physics/madgraph5/files/madgraph5-3.6.5-nlo-template-libs.patch
@@ -0,0 +1,11 @@
+--- a/Template/NLO/SubProcesses/makefile_fks_dir 2025-10-20 00:54:33.934104411 +0200
++++ b/Template/NLO/SubProcesses/makefile_fks_dir 2025-10-20 00:55:13.520769019 +0200
+@@ -17,7 +17,7 @@
+ FJLIBS += $(STDLIB)
+ endif
+
+-NLOLIBS=-L$(LIBDIR) $(libmadloop) $(libcuttools) $(libOLP)
++NLOLIBS=-L$(LIBDIR) $(libmadloop) $(libcuttools) $(libOLP) -lqcdloop -loneloop -lmpfun90
+
+ # Uncomment the line below to compile with MadLoop without setting the environnement
+ # variables 'by hand'
diff --git a/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-chmod.patch b/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-chmod.patch
new file mode 100644
index 00000000000..6e7084da5e1
--- /dev/null
+++ b/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-chmod.patch
@@ -0,0 +1,39 @@
+From cee6c73706f1fd69575c969e5b44ec0a62ee002a Mon Sep 17 00:00:00 2001
+From: Alexander Puck Neuwirth
+Date: Mon, 3 Nov 2025 17:25:20 +0100
+Subject: [PATCH] Fix quotes and permissions in PYTHIA8 script
+
+---
+ .../NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script b/Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script
+index 047d454bd..2d2f499c8 100755
+--- a/Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script
++++ b/Template/NLO/MCatNLO/Scripts/MCatNLO_MadFKS_PYTHIA8.Script
+@@ -228,20 +228,20 @@ export PYTHIA8LOCATION=$PY8PATH
+
+ # check the PYTHIA8 version by the position of certain files
+
+-if [ ! -d $PYTHIA8LOCATION/xmldoc ]
++if [ ! -d "$PYTHIA8LOCATION/xmldoc" ]
+ then
+- if [ -f $PYTHIA8LOCATION/share/Pythia8/xmldoc/Version.xml ]
++ if [ -f "$PYTHIA8LOCATION/share/Pythia8/xmldoc/Version.xml" ]
+ then
+ while read line; do
+ if [[ $line == *"Pythia:versionNumber"*"8.2"* ]]; then PY8VER="8.2" ; echo ' USING PYTHIA 8.2xy' ; fi
+ if [[ $line == *"Pythia:versionNumber"*"8.3"* ]]; then PY8VER="8.3" ; echo ' USING PYTHIA 8.3xy' ; fi
+- done < $PYTHIA8LOCATION/share/Pythia8/xmldoc/Version.xml
++ done < "$PYTHIA8LOCATION/share/Pythia8/xmldoc/Version.xml"
+ else
+ echo "Cannot determine Pythia8 version, stopping run"
+ exit -1
+ fi
+- chmod +x $PYTHIA8LOCATION/bin/pythia8-config
+- read HEPMCINCLIB <<< $($PYTHIA8LOCATION/bin/pythia8-config --hepmc2)
++ [ -x "$PYTHIA8LOCATION/bin/pythia8-config" ] || chmod +x "$PYTHIA8LOCATION/bin/pythia8-config"
++ read HEPMCINCLIB <<< $("$PYTHIA8LOCATION/bin/pythia8-config" --hepmc2)
+ else
+ PY8VER="8.1"
+ echo ' USING PYTHIA 8.1xy'
diff --git a/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-hepmc2.patch b/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-hepmc2.patch
new file mode 100644
index 00000000000..325b252e93a
--- /dev/null
+++ b/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-hepmc2.patch
@@ -0,0 +1,53 @@
+From 95a4e8b3d25b86426121a9d74748f182cfa3068b Mon Sep 17 00:00:00 2001
+From: Alexander Puck Neuwirth
+Date: Mon, 20 Oct 2025 01:47:20 +0200
+Subject: [PATCH 1/2] fix: hepmc2 extrapaths for system installed pythia
+
+Running on my computer:
+```bash
+$ pythia8-config --hepmc2
+-lHepMC
+```
+results in the `extrapath` append code failing with an `IndexError`.
+---
+ madgraph/interface/amcatnlo_run_interface.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/madgraph/interface/amcatnlo_run_interface.py b/madgraph/interface/amcatnlo_run_interface.py
+index 9b96a87fc..ea8a63a61 100755
+--- a/madgraph/interface/amcatnlo_run_interface.py
++++ b/madgraph/interface/amcatnlo_run_interface.py
+@@ -3922,7 +3922,9 @@ def run_mcatnlo(self, evt_file, options):
+ #this gives all the flags, i.e.
+ #-I/Path/to/HepMC/include -L/Path/to/HepMC/lib -lHepMC
+ # we just need the path to the HepMC libraries
+- extrapaths.append(hepmc.split()[1].replace('-L', ''))
++ for token in hepmc.split():
++ if token.startswith('-L'):
++ extrapaths.append(token.replace('-L', ''))
+
+ # check that if FxFx is activated the correct shower plugin is present
+ if shower == 'PYTHIA8' and self.run_card['ickkw'] == 3:
+
+From 72c1833a13db1832db08e9f2d2590cccf1d050be Mon Sep 17 00:00:00 2001
+From: Alexander Puck Neuwirth
+Date: Mon, 20 Oct 2025 01:49:28 +0200
+Subject: [PATCH 2/2] fix: ensure only -L at start of path is replaced
+
+---
+ madgraph/interface/amcatnlo_run_interface.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/madgraph/interface/amcatnlo_run_interface.py b/madgraph/interface/amcatnlo_run_interface.py
+index ea8a63a61..8b3f6b8c3 100755
+--- a/madgraph/interface/amcatnlo_run_interface.py
++++ b/madgraph/interface/amcatnlo_run_interface.py
+@@ -3924,7 +3924,7 @@ def run_mcatnlo(self, evt_file, options):
+ # we just need the path to the HepMC libraries
+ for token in hepmc.split():
+ if token.startswith('-L'):
+- extrapaths.append(token.replace('-L', ''))
++ extrapaths.append(token[2:])
+
+ # check that if FxFx is activated the correct shower plugin is present
+ if shower == 'PYTHIA8' and self.run_card['ickkw'] == 3:
diff --git a/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-make.patch b/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-make.patch
new file mode 100644
index 00000000000..96e832653a5
--- /dev/null
+++ b/sci-physics/madgraph5/files/madgraph5-3.6.5-pythia-make.patch
@@ -0,0 +1,12 @@
+--- a/Template/NLO/MCatNLO/srcPythia8/Makefile 2025-10-26 13:33:24.567078241 +0100
++++ b/Template/NLO/MCatNLO/srcPythia8/Makefile 2025-10-26 13:33:43.140411913 +0100
+@@ -20,6 +20,9 @@
+ LIBGZIP=-L$(ZLIBLOCATION) -lz
+ endif
+
++$(PYTHIA8LOCATION)/$(LIBDIR)/libpythia8.a:
++ @echo "Skipping build of libpythia8.a (no rule needed)"
++
+ %.o: ./PY8Analyzer/%.f
+ $(F77) -c $< -fPIC -ffixed-line-length-132 -I$(TOPDIR)/$(INCDIR) -o $@
+
diff --git a/sci-physics/madgraph5/madgraph5-3.6.5.ebuild b/sci-physics/madgraph5/madgraph5-3.6.5.ebuild
new file mode 100644
index 00000000000..73d62e90ff1
--- /dev/null
+++ b/sci-physics/madgraph5/madgraph5-3.6.5.ebuild
@@ -0,0 +1,138 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..13} )
+inherit fortran-2 python-single-r1
+
+MY_PNN="MadGraph5"
+MY_PV=$(ver_rs 1-3 '_')
+MY_PN="MG5_aMC_v"
+MY_PF=${MY_PN}${MY_PV}
+MY_P=${MY_PNN}-${PV}
+
+DESCRIPTION="MadGraph5_aMC@NLO"
+HOMEPAGE="
+ https://launchpad.net/mg5amcnlo
+ https://github.com/mg5amcnlo/mg5amcnlo
+"
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/mg5amcnlo/mg5amcnlo"
+ EGIT_BRANCH="3.x"
+else
+ SRC_URI="
+ https://launchpad.net/mg5amcnlo/$(ver_cut 1).0/$(ver_cut 1-2).x/+download/${MY_PN}${PV}.tar.gz -> ${MY_P}.tar.gz
+ http://madgraph.phys.ucl.ac.be//Downloads/MG5aMC_PY8_interface/MG5aMC_PY8_interface_V1.3.tar.gz
+"
+ S="${WORKDIR}/${PF}"
+ KEYWORDS="~amd64"
+fi
+
+LICENSE="UoI-NCSA"
+SLOT="${PVR}"
+IUSE="+hepmc2 +lhapdf +fastjet +pythia collier thepeg madanalysis5 ninja samurai golem95 herwig yoda rivet"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="
+ ${PYTHON_DEPS}
+ virtual/zlib:=
+ sys-devel/gcc:*[fortran]
+ $(python_gen_cond_dep '
+ dev-python/numpy[${PYTHON_USEDEP}]
+ dev-python/six[${PYTHON_USEDEP}]
+ ')
+ lhapdf? ( sci-physics/lhapdf[static-libs(-),${PYTHON_SINGLE_USEDEP}] )
+ fastjet? ( sci-physics/fastjet[${PYTHON_SINGLE_USEDEP}] )
+ pythia? (
+ sci-physics/pythia:8=[static-libs(-),hepmc2(-),-hepmc3(-),examples]
+ sci-physics/hepmc:2=
+ )
+ hepmc2? ( sci-physics/hepmc:2 )
+ collier? ( sci-physics/collier[static-libs] )
+ thepeg? (
+ sci-physics/thepeg[hepmc3(-),fastjet?,lhapdf?]
+ )
+ madanalysis5? ( sci-physics/madanalysis5 )
+ ninja? ( sci-physics/ninja[static-libs] )
+ samurai? ( sci-physics/samurai )
+ golem95? ( sci-physics/golem95 )
+ herwig? ( sci-physics/herwig )
+ yoda? ( sci-physics/yoda )
+ rivet? ( sci-physics/rivet )
+ sci-physics/cuttools
+ sci-physics/iregi[static-libs]
+ sci-physics/qcdloop[static-libs(-)]
+"
+RDEPEND="${DEPEND}"
+# Wants to know madgraph5 version ...
+PDEPEND="sci-physics/madgraph5-pythia8-interface"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.6.5-nlo-template-libs.patch
+ "${FILESDIR}"/${PN}-3.6.5-pythia-hepmc2.patch
+ "${FILESDIR}"/${PN}-3.6.5-pythia-make.patch
+ "${FILESDIR}"/${PN}-3.6.5-pythia-chmod.patch
+)
+
+src_unpack() {
+ if [[ ${PV} == *9999* ]]; then
+ git-r3_src_unpack
+ else
+ # Perserve permissions
+ tar xzf "${DISTDIR}/${MY_PNN}-${PV}.tar.gz" -C "${WORKDIR}" || die
+ mv ${MY_PF} ${PF}
+ fi
+}
+
+src_configure() {
+ sed -i "s/LIBDIR=lib/LIBDIR=$(get_libdir)/g" Template/NLO/MCatNLO/srcPythia8/Makefile || die
+ sed -i "s/LIBDIR=lib/LIBDIR=$(get_libdir)/g" Template/NLO/MCatNLO/srcPythia8/Makefile_hep || die
+
+ cat <<-EOF >> input/mg5_configuration.txt || die
+ $(usex lhapdf "lhapdf_py3 = ${EPREFIX}/usr/bin/lhapdf-config" "")
+ $(usex fastjet "fastjet = ${EPREFIX}/usr/bin/fastjet-config" "")
+ $(usex pythia "pythia8_path = ${EPREFIX}/usr" "")
+ $(usex pythia "mg5amc_py8_interface_path = ${EPREFIX}/opt/madgraph5-pythia8-interface" "")
+ $(usex hepmc2 "hepmc_path = ${EPREFIX}/usr" "")
+ $(usex collier "collier = ${EPREFIX}/usr/$(get_libdir)" "")
+ $(usex thepeg "thepeg_path = ${EPREFIX}/usr/$(get_libdir)" "")
+ $(usex herwig "hwpp_path = ${EPREFIX}/usr/$(get_libdir)" "")
+ ninja = $(usex ninja "${EPREFIX}/usr/$(get_libdir)" "''")
+ samurai = $(usex samurai "${EPREFIX}/usr/$(get_libdir)" "''")
+ golem = $(usex golem95 "${EPREFIX}/usr/$(get_libdir)" "''")
+ $(usex yoda "yoda_path= ${EPREFIX}/usr/$(get_libdir)" "")
+ $(usex rivet "rivet_path= ${EPREFIX}/usr/$(get_libdir)" "")
+ $(usex madanalysis5 "madanalysis5_path = ${EPREFIX}/opt/MadAnalysis5/" "")
+ auto_update = 0
+ EOF
+}
+
+src_compile() {
+ # MadGraph needs to generate `Template/LO/Source/make_opts` which is done
+ # automatically at startup. This needs to be done during setup (or with root access)
+ echo "exit" >> tmpfile || die
+ bin/mg5_aMC ./tmpfile || die
+ rm tmpfile || die
+
+ cd vendor/StdHEP || die
+ emake all
+ cd ../.. || die
+
+# cd vendor/CutTools || die
+# emake
+# cd ../.. || die
+}
+
+src_install() {
+ # symlink entrypoint
+ dosym ../../opt/${PF}/bin/mg5_aMC /usr/bin/mg5_aMC3-${PVR}
+ mv "${WORKDIR}" "${ED}/opt/" || die
+
+ dosym ../../../../../usr/$(get_libdir)/libiregi.a /opt/${PF}/vendor/IREGI/src/libiregi.a
+ dosym ../../../../../../../usr/$(get_libdir)/libqcdloop.a /opt/${PF}/vendor/IREGI/src/qcdloop/ql/libqcdloop.a
+
+ dosym ../../../../../usr/$(get_libdir)/libcts.a /opt/${PF}/vendor/CutTools/includects/libcts.a
+ dosym ../../../../../usr/include/mpmodule.mod /opt/${PF}/vendor/CutTools/includects/mpmodule.mod
+}
diff --git a/sci-physics/madgraph5/madgraph5-9999.ebuild b/sci-physics/madgraph5/madgraph5-9999.ebuild
new file mode 100644
index 00000000000..7d504727825
--- /dev/null
+++ b/sci-physics/madgraph5/madgraph5-9999.ebuild
@@ -0,0 +1,135 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# does not escape strings properly, so no python3_12 for now
+PYTHON_COMPAT=( python3_{11..13} )
+inherit fortran-2 python-single-r1
+
+MY_PNN="MadGraph5"
+MY_PV=$(ver_rs 1-3 '_')
+MY_PN="MG5_aMC_v"
+MY_PF=${MY_PN}${MY_PV}
+MY_P=${MY_PNN}-${PV}
+
+DESCRIPTION="MadGraph5_aMC@NLO"
+HOMEPAGE="
+ https://launchpad.net/mg5amcnlo
+ https://github.com/mg5amcnlo/mg5amcnlo
+"
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/mg5amcnlo/mg5amcnlo"
+ EGIT_BRANCH="3.x"
+else
+ SRC_URI="
+ https://launchpad.net/mg5amcnlo/$(ver_cut 1).0/$(ver_cut 1-2).x/+download/${MY_PN}${PV}.tar.gz -> ${MY_P}.tar.gz
+ http://madgraph.phys.ucl.ac.be//Downloads/MG5aMC_PY8_interface/MG5aMC_PY8_interface_V1.3.tar.gz
+"
+ S="${WORKDIR}/${MY_PF}"
+ KEYWORDS="~amd64"
+fi
+
+LICENSE="UoI-NCSA"
+SLOT="${PVR}"
+IUSE="+hepmc2 +lhapdf +fastjet +pythia collier thepeg madanalysis5 ninja samurai golem95 herwig yoda rivet"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="
+ ${PYTHON_DEPS}
+ virtual/zlib:=
+ sys-devel/gcc:*[fortran]
+ $(python_gen_cond_dep '
+ dev-python/numpy[${PYTHON_USEDEP}]
+ dev-python/six[${PYTHON_USEDEP}]
+ ')
+ lhapdf? ( sci-physics/lhapdf[static-libs(-),${PYTHON_SINGLE_USEDEP}] )
+ fastjet? ( sci-physics/fastjet[${PYTHON_SINGLE_USEDEP}] )
+ pythia? (
+ sci-physics/pythia:8=[static-libs(-),hepmc2(-),-hepmc3(-),examples]
+ sci-physics/hepmc:2=
+ )
+ hepmc2? ( sci-physics/hepmc:2 )
+ collier? ( sci-physics/collier[static-libs] )
+ thepeg? (
+ sci-physics/thepeg[hepmc3(-),fastjet?,lhapdf?]
+ )
+ madanalysis5? ( sci-physics/madanalysis5 )
+ ninja? ( sci-physics/ninja[static-libs] )
+ samurai? ( sci-physics/samurai )
+ golem95? ( sci-physics/golem95 )
+ herwig? ( sci-physics/herwig )
+ yoda? ( sci-physics/yoda )
+ rivet? ( sci-physics/rivet )
+ sci-physics/cuttools
+ sci-physics/iregi[static-libs]
+ sci-physics/qcdloop[static-libs(-)]
+"
+RDEPEND="${DEPEND}"
+# Wants to know madgraph5 version ...
+PDEPEND="sci-physics/madgraph5-pythia8-interface"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.6.5-nlo-template-libs.patch
+ "${FILESDIR}"/${PN}-3.6.5-pythia-hepmc2.patch
+ "${FILESDIR}"/${PN}-3.6.5-pythia-make.patch
+)
+
+src_unpack() {
+ if [[ ${PV} == *9999* ]]; then
+ git-r3_src_unpack
+ else
+ # Perserve permissions
+ tar xzf "${DISTDIR}/${MY_PNN}-${PV}.tar.gz" -C "${WORKDIR}" || die
+ mv ${MY_PF} ${PF}
+ fi
+}
+
+src_configure() {
+ cat <<-EOF >> input/mg5_configuration.txt || die
+ $(usex lhapdf "lhapdf_py3 = ${EPREFIX}/usr/bin/lhapdf-config" "")
+ $(usex fastjet "fastjet = ${EPREFIX}/usr/bin/fastjet-config" "")
+ $(usex pythia "pythia8_path = ${EPREFIX}/usr" "")
+ $(usex pythia "mg5amc_py8_interface_path = ${EPREFIX}/opt/madgraph5-pythia8-interface" "")
+ $(usex hepmc2 "hepmc_path = ${EPREFIX}/usr" "")
+ $(usex collier "collier = ${EPREFIX}/usr/$(get_libdir)" "")
+ $(usex thepeg "thepeg_path = ${EPREFIX}/usr/$(get_libdir)" "")
+ $(usex herwig "hwpp_path = ${EPREFIX}/usr/$(get_libdir)" "")
+ ninja = $(usex ninja "${EPREFIX}/usr/$(get_libdir)" "''")
+ samurai = $(usex samurai "${EPREFIX}/usr/$(get_libdir)" "''")
+ golem = $(usex golem95 "${EPREFIX}/usr/$(get_libdir)" "''")
+ $(usex yoda "yoda_path= ${EPREFIX}/usr/$(get_libdir)" "")
+ $(usex rivet "rivet_path= ${EPREFIX}/usr/$(get_libdir)" "")
+ $(usex madanalysis5 "madanalysis5_path = ${EPREFIX}/opt/MadAnalysis5/" "")
+ auto_update = 0
+ EOF
+}
+
+src_compile() {
+ # MadGraph needs to generate `Template/LO/Source/make_opts` which is done
+ # automatically at startup. This needs to be done during setup (or with root access)
+ echo "exit" >> tmpfile || die
+ bin/mg5_aMC ./tmpfile || die
+ rm tmpfile || die
+
+ cd vendor/StdHEP || die
+ emake all
+ cd ../.. || die
+
+# cd vendor/CutTools || die
+# emake
+# cd ../.. || die
+}
+
+src_install() {
+ # symlink entrypoint
+ dosym ../../opt/${PF}/bin/mg5_aMC /usr/bin/mg5_aMC3-${PVR}
+ mv "${WORKDIR}" "${ED}/opt/" || die
+
+ dosym ../../../../../usr/$(get_libdir)/libiregi.a /opt/${PF}/vendor/IREGI/src/libiregi.a
+ dosym ../../../../../../../usr/$(get_libdir)/libqcdloop.a /opt/${PF}/vendor/IREGI/src/qcdloop/ql/libqcdloop.a
+
+ dosym ../../../../../usr/$(get_libdir)/libcts.a /opt/${PF}/vendor/CutTools/includects/libcts.a
+ dosym ../../../../../usr/include/mpmodule.mod /opt/${PF}/vendor/CutTools/includects/mpmodule.mod
+}
diff --git a/sci-physics/madgraph5/metadata.xml b/sci-physics/madgraph5/metadata.xml
index 0e9719c3fcb..2bca753fbe2 100644
--- a/sci-physics/madgraph5/metadata.xml
+++ b/sci-physics/madgraph5/metadata.xml
@@ -15,16 +15,13 @@
USE system hepmc version 2
USE system thepeg
USE system collier
-
mg5amcnlo
diff --git a/sci-physics/pyhf/Manifest b/sci-physics/pyhf/Manifest
index 3155872d422..8d4821ffab8 100644
--- a/sci-physics/pyhf/Manifest
+++ b/sci-physics/pyhf/Manifest
@@ -1,2 +1,3 @@
DIST pyhf-0.7.3.tar.gz 113423 BLAKE2B 216ef186c539481e2819e3f3a198203f085aa99652ab335b1153309a780857c5ad53bc848bb1b12615cfa9b8ee97a67553cef5a0f899bbcf178bfea1b2ca11c5 SHA512 904491f9c161f0231d1e109cfa3a12b31a31b1aa7477752e1eafd1e6c4cec75551e53ce1f6d447bed8f295371dc20b032888a5175af0f2eb808e03c0a8993930
DIST pyhf-0.7.5.tar.gz 113812 BLAKE2B 747dc59de4e80d883145dd6b5643507c6faca2c1cb53b2aaea93cfcf31ed474ed3807f9f5a79d45f49a330f9c6260d5373e8134be814b07e1a1ae161844ad960 SHA512 83a5e02d7278e3e835ecf49d5b01fd6614923bf5e80d58ec2a96da89a67ad80bcdad4be90b598d314caf83a293c3bb69c3e995c292c0b62ef109662c061d91e8
+DIST pyhf-0.7.6.tar.gz 113964 BLAKE2B b95c7ba3ad807765cb7112e496abcb09647c1a3d744263cfed4a6cfddc56e392ad8d0c45fe341e648da5e9a1f77e4b7bd4f2111a1d61480568fe9fa48410b4fc SHA512 1db95b640831778700f32ee54529e5359d862bf2bc210ad042cc2b42f87fa5042c8a1ec869d1714ee992aec42c5d569ec35104ae7ecb483bea77550badcde191
diff --git a/sci-physics/pyhf/pyhf-0.7.6.ebuild b/sci-physics/pyhf/pyhf-0.7.6.ebuild
new file mode 100644
index 00000000000..9d4296db039
--- /dev/null
+++ b/sci-physics/pyhf/pyhf-0.7.6.ebuild
@@ -0,0 +1,37 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..13} )
+DISTUTILS_USE_PEP517=hatchling
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="pure-python fitting/limit-setting/interval estimation HistFactory-style"
+HOMEPAGE="
+ https://github.com/scikit-hep/pyhf
+ https://doi.org/10.5281/zenodo.1169739
+ https://zenodo.org/record/8256635
+ https://doi.org/10.21105/joss.02823
+ https://inspirehep.net/literature/2598491
+ https://arxiv.org/abs/2211.15838
+ https://doi.org/10.22323/1.414.0245
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+# test needs missing scrapbook papermill pydocstyle ...
+RESTRICT="test"
+
+RDEPEND="
+ >=dev-python/click-8.0.0[${PYTHON_USEDEP}]
+ >=dev-python/jsonpatch-1.15[${PYTHON_USEDEP}]
+ >=dev-python/jsonschema-4.15.0[${PYTHON_USEDEP}]
+ >=dev-python/pyyaml-5.1[${PYTHON_USEDEP}]
+ >=dev-python/scipy-1.5.2[${PYTHON_USEDEP}]
+ >=dev-python/tqdm-4.56.0[${PYTHON_USEDEP}]
+ dev-python/numpy[${PYTHON_USEDEP}]
+"
+DEPEND="${RDEPEND}"
diff --git a/sci-physics/qcdloop/qcdloop-2.1.0-r1.ebuild b/sci-physics/qcdloop/qcdloop-2.1.0-r1.ebuild
new file mode 100644
index 00000000000..9c8982d0c2b
--- /dev/null
+++ b/sci-physics/qcdloop/qcdloop-2.1.0-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CMAKE_MAKEFILE_GENERATOR="emake"
+
+inherit cmake fortran-2
+
+DESCRIPTION="An object-oriented one-loop scalar Feynman integrals framework"
+HOMEPAGE="https://qcdloop.web.cern.ch/"
+SRC_URI="https://github.com/scarrazza/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="static-libs"
+
+src_prepare() {
+ cmake_src_prepare
+
+ # gentoo libdir love
+ sed -i \
+ -e '/DESTINATION/s/lib/lib${LIB_SUFFIX}/g' \
+ CMakeLists.txt || die
+ sed -i \
+ -e '/libdir.*/s/lib/lib${LIB_SUFFIX}/g' \
+ CMakeLists.txt || die
+
+ if use static-libs; then
+ sed -i \
+ -e '/qcdloop/s/SHARED/STATIC/g' \
+ CMakeLists.txt || die
+ fi
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_PREFIX="${ESYSROOT}"/usr
+ -DENABLE_FORTRAN_WRAPPER=ON
+ )
+ cmake_src_configure
+}
diff --git a/sci-physics/stdhep/Manifest b/sci-physics/stdhep/Manifest
new file mode 100644
index 00000000000..e5d7df64fd3
--- /dev/null
+++ b/sci-physics/stdhep/Manifest
@@ -0,0 +1 @@
+DIST stdhep-5.6.1.tar.bz2 965819 BLAKE2B 30cc39c3c9b3283176834415fbff25525ae6ca12f4e6dc9f23f191474e182da7383687215e486f0c9edfb3a740cb3edfe7f3917211a04304319d1ae16ce23977 SHA512 c53fbfda52576e2d9fd57894b8ba5d051588ee4ac897ee6f194761ac54873ae526f066b612b2fc933e0dc9e1951664cf484e9db0b6f809aec2820a8281c74dc3
diff --git a/sci-physics/stdhep/stdhep-5.6.1.ebuild b/sci-physics/stdhep/stdhep-5.6.1.ebuild
new file mode 100644
index 00000000000..af088040333
--- /dev/null
+++ b/sci-physics/stdhep/stdhep-5.6.1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit fortran-2 toolchain-funcs flag-o-matic
+
+DESCRIPTION="StdHEP: Standard HEP"
+HOMEPAGE="
+ https://gitlab.com/APN-Pucky/stdhep-mirror
+ https://inspirehep.net/literature/538266
+ https://launchpad.net/mg5amcnlo
+ https://github.com/mg5amcnlo/mg5amcnlo
+"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://gitlab.com/APN-Pucky/stdhep-mirror"
+ EGIT_BRANCH="master"
+else
+ SRC_URI="https://gitlab.com/APN-Pucky/stdhep-mirror/-/archive/v${PV}/stdhep-mirror-${PV}.tar.bz2 -> ${P}.tar.bz2"
+ S=${WORKDIR}/${MY_PF}
+ KEYWORDS="~amd64"
+fi
+
+# only lives in MG5_aMC@NLO repo => same license
+LICENSE="UoI-NCSA"
+SLOT="0"
+IUSE="+static-libs"
+
+src_configure() {
+ default
+ filter-lto
+}
+
+src_compile() {
+ tc-export FC CC
+ emake all CC="${CC}" FC="${FC}" F77="${FC}" #FFLAGS="${FFLAGS} -std=legacy -ffixed-line-length-none" CFLAGS="${CFLAGS}"
+}
+
+src_install() {
+ dolib.so lib/lib{Fmcfio,stdhep,stdhepC}.so
+
+ if use static-libs; then
+ dolib.a lib/lib{Fmcfio,stdhep,stdhepC}.a
+ fi
+}
diff --git a/sci-physics/stdhep/stdhep-9999.ebuild b/sci-physics/stdhep/stdhep-9999.ebuild
new file mode 100644
index 00000000000..af088040333
--- /dev/null
+++ b/sci-physics/stdhep/stdhep-9999.ebuild
@@ -0,0 +1,47 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit fortran-2 toolchain-funcs flag-o-matic
+
+DESCRIPTION="StdHEP: Standard HEP"
+HOMEPAGE="
+ https://gitlab.com/APN-Pucky/stdhep-mirror
+ https://inspirehep.net/literature/538266
+ https://launchpad.net/mg5amcnlo
+ https://github.com/mg5amcnlo/mg5amcnlo
+"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://gitlab.com/APN-Pucky/stdhep-mirror"
+ EGIT_BRANCH="master"
+else
+ SRC_URI="https://gitlab.com/APN-Pucky/stdhep-mirror/-/archive/v${PV}/stdhep-mirror-${PV}.tar.bz2 -> ${P}.tar.bz2"
+ S=${WORKDIR}/${MY_PF}
+ KEYWORDS="~amd64"
+fi
+
+# only lives in MG5_aMC@NLO repo => same license
+LICENSE="UoI-NCSA"
+SLOT="0"
+IUSE="+static-libs"
+
+src_configure() {
+ default
+ filter-lto
+}
+
+src_compile() {
+ tc-export FC CC
+ emake all CC="${CC}" FC="${FC}" F77="${FC}" #FFLAGS="${FFLAGS} -std=legacy -ffixed-line-length-none" CFLAGS="${CFLAGS}"
+}
+
+src_install() {
+ dolib.so lib/lib{Fmcfio,stdhep,stdhepC}.so
+
+ if use static-libs; then
+ dolib.a lib/lib{Fmcfio,stdhep,stdhepC}.a
+ fi
+}