summaryrefslogtreecommitdiff
path: root/dev-cpp/valijson/valijson-0.7.ebuild
blob: 52fc96a2bad88e0059c120a4f45e7d1c77eaa9f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

DESCRIPTION="Header-only C++ library for JSON Schema validation"
HOMEPAGE="https://github.com/tristanpenman/valijson"
SRC_URI="https://github.com/tristanpenman/valijson/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"
IUSE="test"
RESTRICT="!test? ( test )"

src_configure() {
	local mycmakeargs=(
		-Dvalijson_BUILD_TESTS=$(usex test)
	)

	if use test; then
		# Fix relative paths to test data
		sed -i -e "s:../tests/data/documents/:../${P}/tests/data/documents/:" tests/test_adapter_comparison.cpp || die
		sed -i -e "s:../tests/data:../${P}/tests/data:" tests/test_validation_errors.cpp || die
		sed -i -e "s:../thirdparty/:../${P}/thirdparty/:" -e "s:../doc/schema/:../${P}/doc/schema/:" tests/test_validator.cpp || die
	fi

	# -Werror is too aggressive due to false positives with gcc-12, see bug #866153
	sed -i -e 's/-Werror//g' ../${P}/CMakeLists.txt || die

	cmake_src_configure
}

src_test() {
	cd "${BUILD_DIR}" || die
	./test_suite || die
}

src_install() {
	# there is no target for installing headers, so do it manually
	doheader -r include/*
}