*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-cpp / gtest / gtest-1.9.0_pre20190607.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 # Python is required for tests and some build tasks.
7 PYTHON_COMPAT=( python2_7 )
8
9 CMAKE_ECLASS=cmake
10 GOOGLETEST_COMMIT=da10da05c262af0a9e8fa91789a272a3dec67655
11 inherit cmake-multilib python-any-r1
12
13 if [[ ${PV} == "9999" ]]; then
14         inherit git-r3
15         EGIT_REPO_URI="https://github.com/google/googletest"
16 else
17         if [[ -z ${GOOGLETEST_COMMIT} ]]; then
18                 MY_PV=release-${PV}
19         else
20                 MY_PV=${GOOGLETEST_COMMIT}
21         fi
22         SRC_URI="https://github.com/google/googletest/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
23         KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86 ~amd64-linux ~x86-linux ~ppc-macos"
24         S="${WORKDIR}"/googletest-${MY_PV}
25 fi
26
27 DESCRIPTION="Google C++ Testing Framework"
28 HOMEPAGE="https://github.com/google/googletest"
29
30 LICENSE="BSD"
31 SLOT="0"
32 IUSE="doc examples test"
33 RESTRICT="!test? ( test )"
34
35 DEPEND="test? ( ${PYTHON_DEPS} )"
36 RDEPEND="!dev-cpp/gmock"
37
38 PATCHES=(
39         "${FILESDIR}"/${PN}-1.9.0_pre20190607-increase-clone-stack-size.patch
40 )
41
42 pkg_setup() {
43         use test && python-any-r1_pkg_setup
44 }
45
46 src_prepare() {
47         cmake_src_prepare
48
49         sed -i -e '/set(cxx_base_flags /s:-Werror::' \
50                 googletest/cmake/internal_utils.cmake || die "sed failed!"
51 }
52
53 multilib_src_configure() {
54         local mycmakeargs=(
55                 -DBUILD_GMOCK=ON
56                 -DINSTALL_GTEST=ON
57
58                 # tests
59                 -Dgmock_build_tests=$(usex test)
60                 -Dgtest_build_tests=$(usex test)
61                 -DPYTHON_EXECUTABLE="${PYTHON}"
62         )
63         cmake_src_configure
64 }
65
66 multilib_src_install_all() {
67         einstalldocs
68
69         if use doc; then
70                 docinto googletest
71                 dodoc -r googletest/docs/.
72                 docinto googlemock
73                 dodoc -r googlemock/docs/.
74         fi
75
76         if use examples; then
77                 docinto examples
78                 dodoc googletest/samples/*.{cc,h}
79         fi
80 }