1 |
commit: 63f953e2a98c7e0690f635a933302fac3f6d65fe |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 9 08:24:28 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 9 08:38:08 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63f953e2 |
7 |
|
8 |
app-misc/jq: fix configure tests |
9 |
|
10 |
Needed in particular with newer Clang (15+) which otherwise |
11 |
will think gettimeofday isn't available on some systems |
12 |
(tested on musl+clang). |
13 |
|
14 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
15 |
|
16 |
.../jq-1.7_pre20201109-fix-configure-test.patch | 54 +++++++++++++ |
17 |
app-misc/jq/jq-1.7_pre20201109-r1.ebuild | 88 ++++++++++++++++++++++ |
18 |
2 files changed, 142 insertions(+) |
19 |
|
20 |
diff --git a/app-misc/jq/files/jq-1.7_pre20201109-fix-configure-test.patch b/app-misc/jq/files/jq-1.7_pre20201109-fix-configure-test.patch |
21 |
new file mode 100644 |
22 |
index 000000000000..8be52042bcc4 |
23 |
--- /dev/null |
24 |
+++ b/app-misc/jq/files/jq-1.7_pre20201109-fix-configure-test.patch |
25 |
@@ -0,0 +1,54 @@ |
26 |
+https://github.com/stedolan/jq/pull/2480 |
27 |
+ |
28 |
+From 40bbd419ad8d1bd9cbe8b17063c323f8a40ab327 Mon Sep 17 00:00:00 2001 |
29 |
+From: Khem Raj <raj.khem@×××××.com> |
30 |
+Date: Tue, 6 Sep 2022 09:59:31 -0700 |
31 |
+Subject: [PATCH 1/2] configure: Pass _XOPEN_SOURCE when checking for strptime |
32 |
+ |
33 |
+Include sys/time.h for gettimeofday since thats where its in glibc |
34 |
+ |
35 |
+Signed-off-by: Khem Raj <raj.khem@×××××.com> |
36 |
+--- a/configure.ac |
37 |
++++ b/configure.ac |
38 |
+@@ -139,7 +139,10 @@ AC_FUNC_ALLOCA |
39 |
+ |
40 |
+ AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0]) |
41 |
+ AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0]) |
42 |
++OLD_CFLAGS=$CFLAGS |
43 |
++CFLAGS="$CFLAGS -D_XOPEN_SOURCE" |
44 |
+ AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0]) |
45 |
++CFLAGS=$OLD_CFLAGS |
46 |
+ AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0]) |
47 |
+ AC_FIND_FUNC([setenv], [c], [#include <stdlib.h>], [0, 0, 0]) |
48 |
+ AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0]) |
49 |
+@@ -147,7 +150,7 @@ AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0]) |
50 |
+ AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0]) |
51 |
+ AC_FIND_FUNC([localtime_r], [c], [#include <time.h>], [0, 0]) |
52 |
+ AC_FIND_FUNC([localtime], [c], [#include <time.h>], [0]) |
53 |
+-AC_FIND_FUNC([gettimeofday], [c], [#include <time.h>], [0, 0]) |
54 |
++AC_FIND_FUNC([gettimeofday], [c], [#include <sys/time.h>], [0, 0]) |
55 |
+ AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define to 1 if the system has the tm_gmt_off field in struct tm])], |
56 |
+ [], [[#include <time.h>]]) |
57 |
+ AC_CHECK_MEMBER([struct tm.__tm_gmtoff], [AC_DEFINE([HAVE_TM___TM_GMT_OFF],1,[Define to 1 if the system has the __tm_gmt_off field in struct tm])], |
58 |
+ |
59 |
+From cda1734bed3b048c01452c798877d05b8c2f4c15 Mon Sep 17 00:00:00 2001 |
60 |
+From: Khem Raj <raj.khem@×××××.com> |
61 |
+Date: Tue, 6 Sep 2022 10:00:59 -0700 |
62 |
+Subject: [PATCH 2/2] builtin: Replace _BSD_SOURCE with _DEFAULT_SOURCE |
63 |
+ |
64 |
+newer glibc has remove _BSD_SOURCE and wants it to be replaced with _DEFAULT_SOURCE |
65 |
+ |
66 |
+Fixes |
67 |
+/usr/include/features.h:194:3: warning: "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-W#warnings] |
68 |
+warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" |
69 |
+ |
70 |
+Signed-off-by: Khem Raj <raj.khem@×××××.com> |
71 |
+--- a/src/builtin.c |
72 |
++++ b/src/builtin.c |
73 |
+@@ -1,4 +1,4 @@ |
74 |
+-#define _BSD_SOURCE |
75 |
++#define _DEFAULT_SOURCE |
76 |
+ #define _GNU_SOURCE |
77 |
+ #ifndef __sun__ |
78 |
+ # define _XOPEN_SOURCE |
79 |
+ |
80 |
|
81 |
diff --git a/app-misc/jq/jq-1.7_pre20201109-r1.ebuild b/app-misc/jq/jq-1.7_pre20201109-r1.ebuild |
82 |
new file mode 100644 |
83 |
index 000000000000..6c0d7ed19c9b |
84 |
--- /dev/null |
85 |
+++ b/app-misc/jq/jq-1.7_pre20201109-r1.ebuild |
86 |
@@ -0,0 +1,88 @@ |
87 |
+# Copyright 1999-2022 Gentoo Authors |
88 |
+# Distributed under the terms of the GNU General Public License v2 |
89 |
+ |
90 |
+EAPI=7 |
91 |
+ |
92 |
+inherit autotools |
93 |
+ |
94 |
+COMMIT_HASH="a17dd3248a666d01be75f6b16be37e80e20b0954" |
95 |
+ |
96 |
+DESCRIPTION="A lightweight and flexible command-line JSON processor" |
97 |
+HOMEPAGE="https://stedolan.github.io/jq/" |
98 |
+#SRC_URI="https://github.com/stedolan/jq/releases/download/${P}/${P}.tar.gz" |
99 |
+SRC_URI="https://github.com/stedolan/jq/archive/${COMMIT_HASH}.tar.gz -> ${P}.tar.gz" |
100 |
+S="${WORKDIR}/${PN}-${COMMIT_HASH}" |
101 |
+ |
102 |
+LICENSE="MIT CC-BY-3.0" |
103 |
+SLOT="0" |
104 |
+KEYWORDS="~alpha amd64 ~arm arm64 ~ia64 ~loong ~ppc ppc64 ~riscv x86 ~amd64-linux ~x64-macos" |
105 |
+IUSE="+oniguruma static-libs test" |
106 |
+ |
107 |
+ONIGURUMA_MINPV='>=dev-libs/oniguruma-6.1.3' # Keep this in sync with bundled modules/oniguruma/ |
108 |
+DEPEND=" |
109 |
+ >=sys-devel/bison-3.0 |
110 |
+ sys-devel/flex |
111 |
+ oniguruma? ( ${ONIGURUMA_MINPV}:=[static-libs?] ) |
112 |
+" |
113 |
+RDEPEND=" |
114 |
+ !static-libs? ( |
115 |
+ oniguruma? ( ${ONIGURUMA_MINPV}[static-libs?] ) |
116 |
+ ) |
117 |
+" |
118 |
+PATCHES=( |
119 |
+ "${FILESDIR}"/jq-1.6-r3-never-bundle-oniguruma.patch |
120 |
+ "${FILESDIR}"/jq-1.7-runpath.patch |
121 |
+ "${FILESDIR}"/jq-1.7-warnings.patch |
122 |
+ "${FILESDIR}"/jq-1.7-visible-null.patch |
123 |
+ # https://bugs.gentoo.org/776385 |
124 |
+ "${FILESDIR}"/jq-1.7_pre20201109-no-git-bdep.patch |
125 |
+ "${FILESDIR}"/jq-1.7_pre20201109-fix-configure-test.patch |
126 |
+) |
127 |
+ |
128 |
+RESTRICT="!test? ( test )" |
129 |
+REQUIRED_USE="test? ( oniguruma )" |
130 |
+ |
131 |
+src_prepare() { |
132 |
+ sed -e '/^dist_doc_DATA/d; s:-Wextra ::' -i Makefile.am || die |
133 |
+ sed -r -e "s:(m4_define\(\[jq_version\],) .+\):\1 \[${PV}\]):" \ |
134 |
+ -i configure.ac || die |
135 |
+ |
136 |
+ # jq-1.6-r3-never-bundle-oniguruma makes sure we build with the system oniguruma, |
137 |
+ # but the bundled copy of oniguruma still gets eautoreconf'd since it |
138 |
+ # exists; save the cycles by nuking it. |
139 |
+ sed -e '/modules\/oniguruma/d' -i Makefile.am || die |
140 |
+ rm -rf "${S}"/modules/oniguruma || die |
141 |
+ |
142 |
+ default |
143 |
+ eautoreconf |
144 |
+} |
145 |
+ |
146 |
+src_configure() { |
147 |
+ local econfargs=( |
148 |
+ # don't try to rebuild docs |
149 |
+ --disable-docs |
150 |
+ --disable-valgrind |
151 |
+ --disable-maintainer-mode |
152 |
+ --enable-rpathhack |
153 |
+ $(use_enable static-libs static) |
154 |
+ $(use_with oniguruma oniguruma yes) |
155 |
+ ) |
156 |
+ econf "${econfargs[@]}" |
157 |
+} |
158 |
+ |
159 |
+src_test() { |
160 |
+ if ! LD_LIBRARY_PATH="${S}/.libs" nonfatal emake check; then |
161 |
+ if [[ -r "${S}/test-suite.log" ]]; then |
162 |
+ eerror "Tests failed, outputting testsuite log" |
163 |
+ cat "${S}/test-suite.log" |
164 |
+ fi |
165 |
+ die "Tests failed" |
166 |
+ fi |
167 |
+} |
168 |
+ |
169 |
+src_install() { |
170 |
+ local DOCS=( AUTHORS NEWS README.md ) |
171 |
+ default |
172 |
+ |
173 |
+ use static-libs || { find "${D}" -name '*.la' -delete || die; } |
174 |
+} |