1 |
|
# Copyright 1999-2019 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
inherit autotools
|
7 |
7 |
|
|
8 |
MY_PV="${PV/_/}"
|
|
9 |
MY_P="${PN}-${MY_PV}"
|
8 |
10 |
DESCRIPTION="A lightweight and flexible command-line JSON processor"
|
9 |
11 |
HOMEPAGE="https://stedolan.github.io/jq/"
|
10 |
|
SRC_URI="https://github.com/stedolan/jq/releases/download/${P}/${P}.tar.gz"
|
|
12 |
SRC_URI="https://github.com/jqlang/jq/archive/refs/tags/${MY_P}.tar.gz -> ${P}.gh.tar.gz"
|
|
13 |
S="${WORKDIR}/${PN}-${MY_P}"
|
11 |
14 |
|
12 |
15 |
LICENSE="MIT CC-BY-3.0"
|
13 |
16 |
SLOT="0"
|
14 |
|
KEYWORDS="~alpha amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 x86 ~amd64-linux ~x64-macos"
|
15 |
|
IUSE="oniguruma static-libs"
|
|
17 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~arm64-macos ~x64-macos ~x64-solaris"
|
|
18 |
IUSE="+oniguruma static-libs test"
|
16 |
19 |
|
17 |
|
ONIGURUMA_MINPV='>=dev-libs/oniguruma-6.1.3' # Keep this in sync with bundled modules/oniguruma/
|
|
20 |
ONIGURUMA_MINPV='>=dev-libs/oniguruma-6.9.3' # Keep this in sync with bundled modules/oniguruma/
|
18 |
21 |
DEPEND="
|
19 |
22 |
>=sys-devel/bison-3.0
|
20 |
23 |
sys-devel/flex
|
... | ... | |
25 |
28 |
oniguruma? ( ${ONIGURUMA_MINPV}[static-libs?] )
|
26 |
29 |
)
|
27 |
30 |
"
|
|
31 |
PATCHES=(
|
|
32 |
"${FILESDIR}"/jq-1.6-r3-never-bundle-oniguruma.patch
|
|
33 |
"${FILESDIR}"/jq-1.7-runpath.patch
|
|
34 |
)
|
|
35 |
|
|
36 |
RESTRICT="!test? ( test )"
|
|
37 |
REQUIRED_USE="test? ( oniguruma )"
|
28 |
38 |
|
29 |
39 |
src_prepare() {
|
30 |
|
local PATCHES=(
|
31 |
|
"${FILESDIR}"/jq-1.6-r3-never-bundle-oniguruma.patch
|
32 |
|
"${FILESDIR}"/jq-1.6-runpath.patch
|
33 |
|
"${FILESDIR}"/jq-1.6-segfault-fix.patch
|
34 |
|
)
|
35 |
|
use oniguruma || { sed -i 's:tests/onigtest::' Makefile.am || die; }
|
36 |
|
sed -i '/^dist_doc_DATA/d' Makefile.am || die
|
37 |
|
sed -i -r "s:(m4_define\(\[jq_version\],) .+\):\1 \[${PV}\]):" \
|
38 |
|
configure.ac || die
|
|
40 |
sed -e '/^dist_doc_DATA/d; s:-Wextra ::' -i Makefile.am || die
|
|
41 |
printf "#!/bin/sh\\nprintf '%s'\\n\n" "${MY_PV}" > scripts/version || die
|
39 |
42 |
|
40 |
43 |
# jq-1.6-r3-never-bundle-oniguruma makes sure we build with the system oniguruma,
|
41 |
44 |
# but the bundled copy of oniguruma still gets eautoreconf'd since it
|
42 |
45 |
# exists; save the cycles by nuking it.
|
43 |
|
sed -i -e '/modules\/oniguruma/d' Makefile.am || die
|
|
46 |
sed -e '/modules\/oniguruma/d' -i Makefile.am || die
|
44 |
47 |
rm -rf "${S}"/modules/oniguruma || die
|
45 |
48 |
|
46 |
49 |
default
|
|
50 |
|
|
51 |
sed -i "s/\[jq_version\]/[${MY_PV}]/" configure.ac || die
|
|
52 |
|
47 |
53 |
eautoreconf
|
48 |
54 |
}
|
49 |
55 |
|
... | ... | |
61 |
67 |
}
|
62 |
68 |
|
63 |
69 |
src_test() {
|
64 |
|
if ! emake check; then
|
65 |
|
if [[ -r test-suite.log ]]; then
|
|
70 |
if ! LD_LIBRARY_PATH="${S}/.libs" nonfatal emake check; then
|
|
71 |
if [[ -r "${S}/test-suite.log" ]]; then
|
66 |
72 |
eerror "Tests failed, outputting testsuite log"
|
67 |
|
cat test-suite.log
|
|
73 |
cat "${S}/test-suite.log"
|
68 |
74 |
fi
|
69 |
75 |
die "Tests failed"
|
70 |
76 |
fi
|
71 |
77 |
}
|
72 |
78 |
|
73 |
79 |
src_install() {
|
74 |
|
local DOCS=( AUTHORS README.md )
|
|
80 |
local DOCS=( AUTHORS NEWS.md README.md SECURITY.md )
|
75 |
81 |
default
|
76 |
82 |
|
77 |
83 |
use static-libs || { find "${D}" -name '*.la' -delete || die; }
|