blob: 6d5ff04f3e2a10041bbe9b6e1c66cab8870e58e7 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
DISTUTILS_OPTIONAL=1
PYTHON_COMPAT=( python3_{9..11} )
inherit distutils-r1 edo toolchain-funcs
COMMIT="531a49062975d6d2cd5d69b75ad5481a8c0e18c5"
DESCRIPTION="Very low footprint JSON parser written in portable ANSI C"
HOMEPAGE="https://github.com/json-parser/json-parser"
SRC_URI="https://github.com/json-parser/json-parser/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${COMMIT}"
LICENSE="BSD-2"
SLOT="0/$(ver_cut 1-2)"
KEYWORDS="~amd64 ~arm64 ~riscv"
IUSE="python"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DEPEND=""
RDEPEND="${DEPEND}
python? ( ${PYTHON_DEPS} )
"
BDEPEND="
python? (
${PYTHON_DEPS}
${DISTUTILS_DEPS}
dev-python/cython[${PYTHON_USEDEP}]
)
"
PATCHES=( "${FILESDIR}/${PN}-1.1.0-pkgconfig-libdir.patch" )
wrap_python() {
local phase=$1
shift
if use python; then
pushd bindings/python || die
distutils-r1_${phase} "${@}"
popd
fi
}
src_prepare() {
default
wrap_python ${FUNCNAME}
}
src_configure() {
default
wrap_python ${FUNCNAME}
}
src_compile() {
default
wrap_python ${FUNCNAME}
}
python_test() {
"${EPYTHON}" test.py || die "Tests failed with ${EPYTHON}"
}
src_test() {
edo $(tc-getCC) ${CFLAGS} -I. ${CPPFLAGS} ${LDFLAGS} -o tests/test tests/test.c json.o -lm
pushd tests > /dev/null || die
edo ./test
use python && distutils-r1_src_test
popd
}
src_install() {
emake DESTDIR="${D}" install-shared
dodoc README.md AUTHORS
wrap_python ${FUNCNAME}
}
|