|
| 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