2fce10e383bc02b151d4bc3ec9d96c060f2d56a4
[gentoo.git] / dev-libs / rapidjson / rapidjson-1.1.0-r2.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 inherit cmake
7
8 DESCRIPTION="A fast JSON parser/generator for C++ with both SAX/DOM style API"
9 HOMEPAGE="https://rapidjson.org/"
10
11 LICENSE="MIT"
12 IUSE="doc examples test"
13 RESTRICT="!test? ( test )"
14 SLOT="0"
15
16 if [[ ${PV} == *9999 ]] ; then
17         EGIT_REPO_URI="https://github.com/miloyip/rapidjson.git"
18         inherit git-r3
19 else
20         SRC_URI="https://github.com/miloyip/rapidjson/archive/v${PV}.tar.gz -> ${P}.tar.gz"
21         KEYWORDS="~amd64 ~x86"
22         S="${WORKDIR}/rapidjson-${PV}"
23 fi
24
25 DEPEND="
26         doc? ( app-doc/doxygen )
27         test? (
28                 dev-cpp/gtest
29                 dev-util/valgrind
30         )"
31 RDEPEND=""
32
33 PATCHES=(
34         "${FILESDIR}/${P}-gcc-7.patch"
35 )
36
37 src_prepare() {
38         cmake_src_prepare
39
40         sed -i -e 's|-Werror||g' CMakeLists.txt || die
41         sed -i -e 's|-Werror||g' example/CMakeLists.txt || die
42 }
43
44 src_configure() {
45         local mycmakeargs=(
46                 -DDOC_INSTALL_DIR="${EPREFIX}/usr/share/doc/${PF}"
47                 -DLIB_INSTALL_DIR="${EPREFIX}/usr/$(get_libdir)"
48                 -DRAPIDJSON_BUILD_DOC=$(usex doc)
49                 -DRAPIDJSON_BUILD_EXAMPLES=$(usex examples)
50                 -DRAPIDJSON_BUILD_TESTS=$(usex test)
51                 -DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF
52         )
53         cmake_src_configure
54 }