commit:     64bc39eb91bc75f6f97e5016da13d11da5ddd30c
Author:     Alexander Puck Neuwirth <alexander <AT> neuwirth-informatik <DOT> 
de>
AuthorDate: Wed Jul 26 17:51:33 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Thu Aug 17 09:05:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64bc39eb

sci-physics/pythia: add 8.3.09, 9999

Closes: https://bugs.gentoo.org/862103
Signed-off-by: Alexander Puck Neuwirth <alexander <AT> neuwirth-informatik.de>
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 sci-physics/pythia/Manifest             |   1 +
 sci-physics/pythia/metadata.xml         |   5 +
 sci-physics/pythia/pythia-8.3.09.ebuild | 188 ++++++++++++++++++++++++++++++
 sci-physics/pythia/pythia-9999.ebuild   | 196 ++++++++++++++++++++++++++++++++
 4 files changed, 390 insertions(+)

diff --git a/sci-physics/pythia/Manifest b/sci-physics/pythia/Manifest
index 6da91b47b53d..295d8493abb6 100644
--- a/sci-physics/pythia/Manifest
+++ b/sci-physics/pythia/Manifest
@@ -11,3 +11,4 @@ DIST pythia-6.4.28.tar.xz 490248 BLAKE2B 
aff9006a4d3a0536d39a5b5161329f058b98055
 DIST pythia6-20160413.tar.gz 567976 BLAKE2B 
92ee81e41db46d49706599ee387a650f67d54a0ea165648de0d09d6cec811c2a4b22903c15cca0abaf5f34cf28333d70315a2c71f4ce0ec0bc48757c20114ae7
 SHA512 
2a9ea2ae299e8d49bd9750f8c68f0b7f534fb91254c2eebc60ef40828400bdf5e5c4e0956d61807e773a51db873ab4a036c3ac264f904d0bb2b85f4860e538d3
 DIST pythia8245.tgz 23737440 BLAKE2B 
74fd060229a342a32ddd33cd1911708c03e23ee0656a23ed91663fa08b35bb015f75bedba2e6ef13cfc9524affde8e8b65653596eb34f1f080781e655b85af5b
 SHA512 
25107eb98474217ac697476143e879c62fcf5653994a2daf61cfca892f91fbaea3c274019fb4469e9ef547e87d69b8842ee28db5fdac6433965a62eeb16ef95a
 DIST pythia8307.tgz 26016414 BLAKE2B 
0253309d71ca4e46183de80396c3a226d072ea2e8aeaf87da33994b3303017a6ca567f6731902aba43c20fec2c0aeace0728f2ce725f9221f161a70055fa6043
 SHA512 
63e7a3e76f8bfe0cd7b34ef523d8bbcfa50ee780c8437384ef7eb208f0f682481b0166673647db98468baeb6df855fdbf0cbb1509dcc5eda39c90f3f3461fd2a
+DIST pythia8309.tgz 28407620 BLAKE2B 
0ef226e2e65829952d670b57c24bff2108d916ca547233041e97dabb81d9616be3e404da7225f9cb4a2c9773c0c22939d813eaed92560e01c6fbe37e4690c232
 SHA512 
c7d99a9a1f7bf1441532720667ab224283b866e7f3ea9e730c839ac62e3b8b9e5c01471fb94a4a48d481635544e4ed230796a710531650bfffde96f0f78590bf

diff --git a/sci-physics/pythia/metadata.xml b/sci-physics/pythia/metadata.xml
index 6d4b2f695ab6..fb8f9f855f2b 100644
--- a/sci-physics/pythia/metadata.xml
+++ b/sci-physics/pythia/metadata.xml
@@ -19,7 +19,12 @@
   <use>
     <flag name="fastjet">Build jets using the <pkg>sci-physics/fastjet</pkg> 
package</flag>
     <flag name="hepmc">Adds support for High Energy Physics Monte Carlo 
Generators <pkg>sci-physics/hepmc</pkg></flag>
+    <flag name="hepmc2">Adds support for High Energy Physics Monte Carlo 
Generators 2 <pkg>sci-physics/hepmc</pkg></flag>
+    <flag name="hepmc3">Adds support for High Energy Physics Monte Carlo 
Generators 3 <pkg>sci-physics/hepmc</pkg></flag>
     <flag name="lhapdf">Support the use of external PDF sets via 
<pkg>sci-physics/lhapdf</pkg></flag>
     <flag name="root">Use <pkg>sci-physics/root</pkg> trees and histograms (in 
examples only)</flag>
   </use>
+  <upstream>
+    <remote-id type="gitlab">Pythia8/releases</remote-id>
+  </upstream>
 </pkgmetadata>

diff --git a/sci-physics/pythia/pythia-8.3.09.ebuild 
b/sci-physics/pythia/pythia-8.3.09.ebuild
new file mode 100644
index 000000000000..32715ad857ac
--- /dev/null
+++ b/sci-physics/pythia/pythia-8.3.09.ebuild
@@ -0,0 +1,188 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+MV=$(ver_cut 1-2)
+MY_P="${PN}${PV//./}"
+LHA_VER="6.2.1"
+
+DESCRIPTION="Lund Monte Carlo high-energy physics event generator"
+HOMEPAGE="https://pythia.org/";
+SRC_URI="https://pythia.org/download/${PN}${MV//./}/${MY_P}.tgz
+       test? ( lhapdf? (
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/CT10.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/MRST2007lomod.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/NNPDF23_nlo_as_0119_qed_mc.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/NNPDF23_nnlo_as_0119_qed_mc.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/cteq66.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/cteq6l1.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/unvalidated/MRST2004qed.tar.gz
+       ) )"
+
+SLOT="8"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc examples fastjet +hepmc3 hepmc2 lhapdf root test zlib"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="
+       ?? ( hepmc3 hepmc2 )
+"
+
+RDEPEND="
+       fastjet? ( sci-physics/fastjet )
+       hepmc3? ( sci-physics/hepmc:3= )
+       hepmc2? ( sci-physics/hepmc:2= )
+       lhapdf? ( sci-physics/lhapdf:= )
+       zlib? ( sys-libs/zlib )"
+# ROOT is used only when building related tests
+DEPEND="${RDEPEND}
+       test? (
+               root? ( sci-physics/root:= )
+       )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}8209-root-noninteractive.patch
+)
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_pretend() {
+       if use root && ! use test; then
+               ewarn "ROOT support will only affect examples code build during 
test stage."
+               ewarn "Since you have tests disabled, this is a no-op."
+       fi
+}
+
+src_prepare() {
+       PYTHIADIR="/usr/share/Pythia8"
+       EPYTHIADIR="${EPREFIX}${PYTHIADIR}"
+
+       default
+       # set datadir for xmldor in include file
+       sed -i \
+               -e "s|../share/Pythia8/xmldoc|${EPYTHIADIR}/xmldoc|" \
+               include/Pythia8/Pythia.h || die
+       # respect libdir, prefix, flags
+       sed -i \
+               -e "s|/lib|/$(get_libdir)|g" \
+               -e "s|/usr|${EPREFIX}/usr|g" \
+               -e "s|-O2|${CXXFLAGS}|g" \
+               -e "s|Cint|Core|g" \
+               configure || die
+       sed -i 's|$(CXX) $^ -o $@ $(CXX_COMMON) $(CXX_SHARED)|$(CXX) $(LDFLAGS) 
$^ -o $@ $(CXX_COMMON) $(CXX_SHARED)|g' \
+               Makefile || die
+       sed -i 's|$(CXX)|$(CXX) $(LDFLAGS)|' examples/Makefile || die
+       # we use lhapdf6 instead of lhapdf5
+       # some PDFs changed, use something similar
+       sed -i \
+               -e "s|LHAPDF5|LHAPDF6|g" \
+               -e "s|\.LHgrid||g" \
+               -e "s|\.LHpdf||g" \
+               -e "s|MRST2001lo|MRST2007lomod|g" \
+               -e "s|cteq6ll|cteq6l1|g" \
+               -e "s|cteq6m|cteq66|g" \
+               examples/*.{cc,cmnd} || die
+       # After lhapdf5->6 migration PDFs are identical within ~1/1000
+       # https|//www.hepforge.org/archive/lhapdf/pdfsets/6.1/README
+       sed -i \
+               -e "s|1e-8|3e-1|g" \
+               -e "s|nlo_as_0119_qed|nlo_as_0119_qed_mc|g" \
+               -e "s|xmldoc|share/Pythia8/xmldoc|g" \
+               examples/main54.cc || die
+       # ask cflags from root
+       sed -i "s|root-config|root-config --cflags|g" examples/Makefile || die
+
+       sed -i 's|libpythia8\.a|libpythia8$(LIB_SUFFIX)|g' \
+               examples/Makefile || die
+}
+
+# TODO: the following optional packages are out of Gentoo tree:
+# - EvtGen 
http://atlas-computing.web.cern.ch/atlas-computing/links/externalDirectory/EvtGen/
+# - PowHEG http://powhegbox.mib.infn.it/
+# - ProMC  https://github.com/Argonne-National-Laboratory/ProMC/
+src_configure() {
+       # homemade configure script
+       ./configure \
+               --arch=Linux \
+               --cxx="$(tc-getCXX)" \
+               --prefix="${EPREFIX}/usr" \
+               --prefix-lib="${EPREFIX}/usr/$(get_libdir)" \
+               --prefix-share="${EPYTHIADIR}" \
+               $(usex fastjet "--with-fastjet3" "") \
+               $(usex zlib "--with-gzip" "") \
+               $(use_with hepmc3) \
+               $(use_with hepmc2) \
+               $(usex lhapdf "--with-lhapdf6
+                       --with-lhapdf6-plugin=LHAPDF6.h
+                       --with-lhapdf6-lib=${EPREFIX}/usr/$(get_libdir)" "") \
+               $(usex root "--with-root
+                       --with-root-include=${EPREFIX}/usr/include/root
+                       --with-root-lib=${EPREFIX}/usr/$(get_libdir)/root" "") \
+               || die
+
+       # fix pythia config script
+       sed -i \
+               -e 's|Pythia8/examples/Makefile.inc|Pythia8/Makefile.inc|' \
+               -e 's|LINE%=|LINE%%=|' \
+               bin/pythia8-config || die
+}
+
+src_test() {
+       cd examples || die
+
+       local tests="$(echo main{{01..32},37,38,61,62,73,80}.out)"
+       use hepmc3 && tests+=" $(echo main{41,42,85,86}.out)"
+       use hepmc3 && use lhapdf && tests+=" $(echo main{43,{87..89}}.out)"
+       use lhapdf && tests+=" $(echo main{51..54}.out)"
+       use fastjet && tests+=" $(echo main{71,72}.out)"
+       use fastjet && use hepmc3 && use lhapdf && tests+=" $(echo 
main{81..84}).out"
+       use root && tests+=" main91.out"
+       # Disabled tests:
+       # 33    needs PowHEG
+       # 46    needs ProMC
+       # 48    needs EvtGen
+       # 92    generated ROOT dictionary is badly broken
+
+       # use emake for parallel instead of long runmains
+       LD_LIBRARY_PATH="${S}/$(get_libdir):${LD_LIBRARY_PATH}" \
+       PYTHIA8DATA="../share/Pythia8/xmldoc/" \
+       LHAPDF_DATA_PATH="${WORKDIR}" \
+       emake ${tests}
+       emake clean
+}
+
+src_install() {
+       # make install is too broken, much easier to install manually
+       dobin bin/pythia8-config
+       doheader -r include/*
+       dolib.so lib/libpythia8.so
+       use lhapdf && dolib.so lib/libpythia8lhapdf6.so
+       insinto "${PYTHIADIR}"
+       doins -r share/Pythia8/xmldoc share/Pythia8/pdfdata 
examples/Makefile.inc
+
+       newenvd - 99pythia8 <<- _EOF_
+               PYTHIA8DATA=${EPYTHIADIR}/xmldoc
+       _EOF_
+
+       dodoc AUTHORS GUIDELINES README
+       if use doc; then
+               dodoc -r share/Pythia8/pdfdoc/.
+               dodoc -r share/Pythia8/htmldoc/.
+       fi
+       if use examples; then
+               # reuse system Makefile.inc
+               rm examples/Makefile.inc || die
+               sed -i "s|include Makefile.inc|include ${EPYTHIADIR}|" \
+                       examples/Makefile || die
+
+               insinto /usr/share/${PN}
+               doins -r examples
+               docompress -x /usr/share/doc/${PF}/examples
+       fi
+
+       # cleanup
+       unset PYTHIADIR EPYTHIADIR
+}

diff --git a/sci-physics/pythia/pythia-9999.ebuild 
b/sci-physics/pythia/pythia-9999.ebuild
new file mode 100644
index 000000000000..5938af76f961
--- /dev/null
+++ b/sci-physics/pythia/pythia-9999.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+MV=$(ver_cut 1-2)
+MY_P="${PN}${PV//./}"
+LHA_VER="6.2.1"
+
+DESCRIPTION="Lund Monte Carlo high-energy physics event generator"
+HOMEPAGE="https://pythia.org/";
+
+# just data
+SRC_URI="test? ( lhapdf? (
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/CT10.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/MRST2007lomod.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/NNPDF23_nlo_as_0119_qed_mc.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/NNPDF23_nnlo_as_0119_qed_mc.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/cteq66.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/cteq6l1.tar.gz
+               
https://www.hepforge.org/downloads/lhapdf/pdfsets/v6.backup/${LHA_VER}/unvalidated/MRST2004qed.tar.gz
+               ) )"
+
+if [[ ${PV} == 9999 ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://gitlab.com/Pythia8/releases";
+else
+       SRC_URI="https://pythia.org/download/${PN}${MV//./}/${MY_P}.tgz
+       $SRC_URI"
+       KEYWORDS="~amd64 ~x86"
+       S="${WORKDIR}/${MY_P}"
+fi
+
+SLOT="8"
+LICENSE="GPL-2"
+IUSE="doc examples fastjet +hepmc3 hepmc2 lhapdf root test zlib"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="
+       ?? ( hepmc3 hepmc2 )
+"
+
+RDEPEND="
+       fastjet? ( sci-physics/fastjet )
+       hepmc3? ( sci-physics/hepmc:3= )
+       hepmc2? ( sci-physics/hepmc:2= )
+       lhapdf? ( sci-physics/lhapdf:= )
+       zlib? ( sys-libs/zlib )"
+# ROOT is used only when building related tests
+DEPEND="${RDEPEND}
+       test? (
+               root? ( sci-physics/root:= )
+       )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}8209-root-noninteractive.patch
+)
+
+pkg_pretend() {
+       if use root && ! use test; then
+               ewarn "ROOT support will only affect examples code build during 
test stage."
+               ewarn "Since you have tests disabled, this is a no-op."
+       fi
+}
+
+src_prepare() {
+       PYTHIADIR="/usr/share/Pythia8"
+       EPYTHIADIR="${EPREFIX}${PYTHIADIR}"
+
+       default
+       # set datadir for xmldor in include file
+       sed -i \
+               -e "s|../share/Pythia8/xmldoc|${EPYTHIADIR}/xmldoc|" \
+               include/Pythia8/Pythia.h || die
+       # respect libdir, prefix, flags
+       sed -i \
+               -e "s|/lib|/$(get_libdir)|g" \
+               -e "s|/usr|${EPREFIX}/usr|g" \
+               -e "s|-O2|${CXXFLAGS}|g" \
+               -e "s|Cint|Core|g" \
+               configure || die
+       sed -i 's|$(CXX) $^ -o $@ $(CXX_COMMON) $(CXX_SHARED)|$(CXX) $(LDFLAGS) 
$^ -o $@ $(CXX_COMMON) $(CXX_SHARED)|g' \
+               Makefile || die
+       sed -i 's|$(CXX)|$(CXX) $(LDFLAGS)|' examples/Makefile || die
+       # we use lhapdf6 instead of lhapdf5
+       # some PDFs changed, use something similar
+       sed -i \
+               -e "s|LHAPDF5|LHAPDF6|g" \
+               -e "s|\.LHgrid||g" \
+               -e "s|\.LHpdf||g" \
+               -e "s|MRST2001lo|MRST2007lomod|g" \
+               -e "s|cteq6ll|cteq6l1|g" \
+               -e "s|cteq6m|cteq66|g" \
+               examples/*.{cc,cmnd} || die
+       # After lhapdf5->6 migration PDFs are identical within ~1/1000
+       # https|//www.hepforge.org/archive/lhapdf/pdfsets/6.1/README
+       sed -i \
+               -e "s|1e-8|3e-1|g" \
+               -e "s|nlo_as_0119_qed|nlo_as_0119_qed_mc|g" \
+               -e "s|xmldoc|share/Pythia8/xmldoc|g" \
+               examples/main54.cc || die
+       # ask cflags from root
+       sed -i "s|root-config|root-config --cflags|g" examples/Makefile || die
+
+       sed -i 's|libpythia8\.a|libpythia8$(LIB_SUFFIX)|g' \
+               examples/Makefile || die
+}
+
+# TODO: the following optional packages are out of Gentoo tree:
+# - EvtGen 
http://atlas-computing.web.cern.ch/atlas-computing/links/externalDirectory/EvtGen/
+# - PowHEG http://powhegbox.mib.infn.it/
+# - ProMC  https://github.com/Argonne-National-Laboratory/ProMC/
+src_configure() {
+       # homemade configure script
+       ./configure \
+               --arch=Linux \
+               --cxx="$(tc-getCXX)" \
+               --prefix="${EPREFIX}/usr" \
+               --prefix-lib="${EPREFIX}/usr/$(get_libdir)" \
+               --prefix-share="${EPYTHIADIR}" \
+               $(usex fastjet "--with-fastjet3" "") \
+               $(usex zlib "--with-gzip" "") \
+               $(use_with hepmc3) \
+               $(use_with hepmc2) \
+               $(usex lhapdf "--with-lhapdf6
+                       --with-lhapdf6-plugin=LHAPDF6.h
+                       --with-lhapdf6-lib=${EPREFIX}/usr/$(get_libdir)" "") \
+               $(usex root "--with-root
+                       --with-root-include=${EPREFIX}/usr/include/root
+                       --with-root-lib=${EPREFIX}/usr/$(get_libdir)/root" "") \
+               || die
+
+       # fix pythia config script
+       sed -i \
+               -e 's|Pythia8/examples/Makefile.inc|Pythia8/Makefile.inc|' \
+               -e 's|LINE%=|LINE%%=|' \
+               bin/pythia8-config || die
+}
+
+src_test() {
+       cd examples || die
+
+       local tests="$(echo main{{01..32},37,38,61,62,73,80}.out)"
+       use hepmc3 && tests+=" $(echo main{41,42,85,86}.out)"
+       use hepmc3 && use lhapdf && tests+=" $(echo main{43,{87..89}}.out)"
+       use lhapdf && tests+=" $(echo main{51..54}.out)"
+       use fastjet && tests+=" $(echo main{71,72}.out)"
+       use fastjet && use hepmc3 && use lhapdf && tests+=" $(echo 
main{81..84}).out"
+       use root && tests+=" main91.out"
+       # Disabled tests:
+       # 33    needs PowHEG
+       # 46    needs ProMC
+       # 48    needs EvtGen
+       # 92    generated ROOT dictionary is badly broken
+
+       # use emake for parallel instead of long runmains
+       LD_LIBRARY_PATH="${S}/$(get_libdir):${LD_LIBRARY_PATH}" \
+       PYTHIA8DATA="../share/Pythia8/xmldoc/" \
+       LHAPDF_DATA_PATH="${WORKDIR}" \
+       emake ${tests}
+       emake clean
+}
+
+src_install() {
+       # make install is too broken, much easier to install manually
+       dobin bin/pythia8-config
+       doheader -r include/*
+       dolib.so lib/libpythia8.so
+       use lhapdf && dolib.so lib/libpythia8lhapdf6.so
+       insinto "${PYTHIADIR}"
+       doins -r share/Pythia8/xmldoc share/Pythia8/pdfdata 
examples/Makefile.inc
+
+       newenvd - 99pythia8 <<- _EOF_
+               PYTHIA8DATA=${EPYTHIADIR}/xmldoc
+       _EOF_
+
+       dodoc AUTHORS GUIDELINES README
+       if use doc; then
+               dodoc -r share/Pythia8/pdfdoc/.
+               dodoc -r share/Pythia8/htmldoc/.
+       fi
+       if use examples; then
+               # reuse system Makefile.inc
+               rm examples/Makefile.inc || die
+               sed -i "s|include Makefile.inc|include ${EPYTHIADIR}|" \
+                       examples/Makefile || die
+
+               insinto /usr/share/${PN}
+               doins -r examples
+               docompress -x /usr/share/doc/${PF}/examples
+       fi
+
+       # cleanup
+       unset PYTHIADIR EPYTHIADIR
+}

Reply via email to