*/*: Switch proxy-maint to cmake.eclass
[gentoo.git] / sci-physics / geant-vmc / geant-vmc-4.4.0.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit cmake
7
8 if [[ ${PV} == *9999* ]]; then
9         inherit git-r3
10         EGIT_REPO_URI="https://github.com/vmc-project/geant4_vmc.git"
11 else
12         DOWN_PV=$(ver_cut 2-)
13         SRC_URI="http://root.cern.ch/download/vmc/geant4_vmc.${DOWN_PV}.tar.gz"
14         SOURCE_PV=$(ver_rs 1- . ${DOWN_PV})
15         S="${WORKDIR}/geant4_vmc.${SOURCE_PV}"
16         KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
17 fi
18
19 DESCRIPTION="Virtual Monte Carlo Geant4 implementation"
20 HOMEPAGE="http://root.cern.ch/root/vmc/VirtualMC.html"
21
22 LICENSE="GPL-2"
23 SLOT="4"
24 IUSE="doc examples geant3 +g4root +mtroot vgm test"
25
26 # sci-physics/root[c++11] required to match sci-physics/geant flags.
27 RDEPEND="
28         >=sci-physics/geant-4.10.03:=[opengl,geant3?]
29         sci-physics/root:=[c++11,vmc]
30         vgm? ( >=sci-physics/vgm-4.4:= )"
31 DEPEND="${RDEPEND}
32         doc? ( app-doc/doxygen )"
33 RESTRICT="
34         !examples? ( test )
35         !geant3? ( test )
36         !g4root? ( test )
37         !mtroot? ( test )
38         !test? ( test )
39         !vgm? ( test )"
40
41 DOCS=(
42         history
43         README.md
44 )
45 PATCHES=(
46         "${FILESDIR}"/"${PN}-${PV}"-fix-cflags.patch
47 )
48
49 src_configure() {
50         local mycmakeargs=(
51                 -DGeant4VMC_USE_VGM="$(usex vgm)"
52                 -DGeant4VMC_USE_GEANT4_G3TOG4="$(usex geant3)"
53                 -DGeant4VMC_USE_G4Root="$(usex g4root)"
54                 -DGeant4VMC_BUILD_MTRoot="$(usex mtroot)"
55                 -DGeant4VMC_BUILD_EXAMPLES="$(usex test)"
56                 -DGeant4VMC_INSTALL_EXAMPLES="$(usex examples)"
57         )
58         cmake_src_configure
59 }
60
61 src_compile() {
62         cmake_src_compile
63         if use doc ; then
64                 local dirs=(
65                         source
66                         $(usev g4root)
67                         $(usev mtroot)
68                         $(usev examples)
69                 )
70                 local d
71                 for d in "${dirs[@]}"; do
72                         pushd "${d}" > /dev/null || die
73                         doxygen || die
74                         popd > /dev/null || die
75                 done
76         fi
77 }
78
79 src_test() {
80         # Required by sci-physics/root for pointer validity checking,
81         # see e.g. https://sft.its.cern.ch/jira/browse/ROOT-8146 .
82         addwrite /dev/random
83         cd examples || die
84         # Bug: Can not disable Garfield in test suite, fixed upstream.
85         sed -i 's/ExGarfield//' test_suite.sh || die
86         # Bug: Path for E03 sub-examples wrong, see https://github.com/vmc-project/geant4_vmc/pull/11 .
87         sed -i 's#only in E03 test#only in E03 test\nG4EXEDIR=${BUILDDIR}/examples/$EXAMPLE/$OPTION#' test_suite_exe.sh || die
88         ./test_suite.sh --g3=off --builddir="${BUILD_DIR}" || die
89         ./test_suite_exe.sh --g3=off --garfield=off --builddir="${BUILD_DIR}" || die
90 }
91
92 src_install() {
93         cmake_src_install
94         use doc && local HTML_DOCS=(doc/.)
95         einstalldocs
96 }