1 |
|
# Copyright 1999-2023 Gentoo Authors
|
|
1 |
# Copyright 2022-2023 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 cmake
|
|
6 |
# python3_11 fails
|
|
7 |
PYTHON_COMPAT=( python3_{9..10} )
|
|
8 |
inherit cmake python-single-r1
|
7 |
9 |
|
8 |
|
MYP=HepMC-${PV}
|
|
10 |
MYP=HepMC3-${PV}
|
9 |
11 |
|
10 |
12 |
DESCRIPTION="Event Record for Monte Carlo Generators"
|
11 |
13 |
HOMEPAGE="https://hepmc.web.cern.ch/hepmc/"
|
12 |
|
SRC_URI="https://hepmc.web.cern.ch/hepmc/releases/hepmc${PV}.tgz"
|
|
14 |
SRC_URI="https://hepmc.web.cern.ch/hepmc/releases/${MYP}.tar.gz"
|
13 |
15 |
S="${WORKDIR}/${MYP}"
|
14 |
16 |
|
15 |
|
LICENSE="GPL-2"
|
16 |
|
SLOT="2"
|
17 |
|
KEYWORDS="amd64 ~x86 ~amd64-linux ~x86-linux"
|
18 |
|
IUSE="cm doc examples gev test"
|
|
17 |
LICENSE="GPL-3+"
|
|
18 |
SLOT="3"
|
|
19 |
KEYWORDS="~amd64 ~x86"
|
|
20 |
IUSE="doc test examples python root"
|
19 |
21 |
RESTRICT="!test? ( test )"
|
|
22 |
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
20 |
23 |
|
|
24 |
RDEPEND="python? ( ${PYTHON_DEPS} )"
|
|
25 |
DEPEND="${RDEPEND}"
|
21 |
26 |
BDEPEND="
|
|
27 |
root? ( sci-physics/root:= )
|
22 |
28 |
doc? (
|
23 |
29 |
app-doc/doxygen[dot]
|
24 |
30 |
dev-texlive/texlive-latex
|
25 |
31 |
dev-texlive/texlive-latexextra
|
26 |
32 |
dev-texlive/texlive-latexrecommended
|
27 |
|
)"
|
28 |
|
|
29 |
|
# Block against old slot 0
|
30 |
|
RDEPEND="!sci-physics/hepmc:0"
|
31 |
|
|
32 |
|
src_prepare() {
|
33 |
|
cmake_src_prepare
|
34 |
|
|
35 |
|
sed -i -e '/add_subdirectory(doc)/d' CMakeLists.txt || die
|
36 |
|
# CMake doc building broken
|
37 |
|
# gentoo doc directory
|
38 |
|
#sed -i \
|
39 |
|
# -e "s:share/HepMC/doc:share/doc/${PF}:" \
|
40 |
|
# doc/CMakeLists.txt || die
|
41 |
|
|
42 |
|
# gentoo examples directory
|
43 |
|
sed -i \
|
44 |
|
-e "s:share/HepMC:share/doc/${PF}:" \
|
45 |
|
$(find examples -name CMakeLists.txt) || die
|
46 |
|
|
47 |
|
# respect user's flags
|
48 |
|
sed -i \
|
49 |
|
-e "s/-O -ansi -pedantic -Wall//g" \
|
50 |
|
cmake/Modules/HepMCVariables.cmake || die
|
51 |
|
|
52 |
|
# gentoo libdir love
|
53 |
|
sed -i \
|
54 |
|
-e '/DESTINATION/s/lib/lib${LIB_SUFFIX}/g' \
|
55 |
|
{src,fio}/CMakeLists.txt || die
|
56 |
|
|
57 |
|
# remove targets if use flags not set
|
58 |
|
if ! use examples; then
|
59 |
|
sed -i -e '/add_subdirectory(examples)/d' CMakeLists.txt || die
|
60 |
|
fi
|
61 |
|
if ! use test; then
|
62 |
|
sed -i -e '/add_subdirectory(test)/d' CMakeLists.txt || die
|
63 |
|
fi
|
64 |
|
|
65 |
|
# remove static libs
|
66 |
|
sed -i \
|
67 |
|
-e '/(HepMC\(fio\|\)S/d' \
|
68 |
|
-e '/TARGETS/s/HepMC\(fio\|\)S//' \
|
69 |
|
{src,fio}/CMakeLists.txt || die
|
70 |
|
}
|
|
33 |
)
|
|
34 |
"
|
71 |
35 |
|
72 |
36 |
src_configure() {
|
73 |
|
# use MeV over GeV and mm over cm
|
74 |
37 |
local mycmakeargs=(
|
75 |
|
-Dlength=$(usex cm CM MM)
|
76 |
|
-Dmomentum=$(usex gev GEV MEV)
|
|
38 |
-DHEPMC3_ENABLE_ROOTIO=$(usex root ON OFF)
|
|
39 |
-DHEPMC3_ENABLE_PYTHON=$(usex python ON OFF)
|
|
40 |
-DHEPMC3_ENABLE_TEST=$(usex test ON OFF)
|
|
41 |
-DHEPMC3_BUILD_DOCS=$(usex doc ON OFF)
|
|
42 |
-DHEPMC3_BUILD_EXAMPLES=$(usex examples ON OFF)
|
77 |
43 |
)
|
78 |
44 |
cmake_src_configure
|
79 |
45 |
}
|
80 |
46 |
|
81 |
|
src_compile() {
|
82 |
|
cmake_src_compile
|
83 |
|
|
84 |
|
if use doc; then
|
85 |
|
cd doc || die
|
86 |
|
./buildDoc.sh || die
|
87 |
|
./buildDoxygen.sh || die
|
88 |
|
HTML_DOCS=( doc/html/. )
|
89 |
|
fi
|
90 |
|
}
|
91 |
|
|
92 |
47 |
src_install() {
|
93 |
48 |
cmake_src_install
|
94 |
|
use doc && dodoc doc/*.pdf
|
|
49 |
use examples && docompress -x /usr/share/doc/${PF}/examples
|
|
50 |
python_optimize
|
95 |
51 |
}
|