*/*: Discontinue Gentoo SuperH port
[gentoo.git] / dev-cpp / gtest / gtest-1.8.1-r1.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 CMAKE_ECLASS=cmake
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 ~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_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
52                 # tests
53                 -Dgmock_build_tests=$(usex test)
54                 -Dgtest_build_tests=$(usex test)
55                 -DPYTHON_EXECUTABLE="${PYTHON}"
56         )
57         cmake_src_configure
58 }
59
60 multilib_src_install_all() {
61         einstalldocs
62
63         if use doc; then
64                 docinto googletest
65                 dodoc -r googletest/docs/.
66                 docinto googlemock
67                 dodoc -r googlemock/docs/.
68         fi
69
70         if use examples; then
71                 docinto examples
72                 dodoc googletest/samples/*.{cc,h}
73         fi
74 }