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