summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-09-09 09:24:28 +0100
committerSam James <sam@gentoo.org>2022-09-09 09:38:08 +0100
commit63f953e2a98c7e0690f635a933302fac3f6d65fe (patch)
tree7aa98be8c60bb577116ff508c2c1a56184864b33 /app-misc/jq
parentwww-client/firefox: enable llvm-15 on 104.0.2 (diff)
downloadgentoo-63f953e2a98c7e0690f635a933302fac3f6d65fe.tar.gz
gentoo-63f953e2a98c7e0690f635a933302fac3f6d65fe.tar.bz2
gentoo-63f953e2a98c7e0690f635a933302fac3f6d65fe.zip
app-misc/jq: fix configure tests
Needed in particular with newer Clang (15+) which otherwise will think gettimeofday isn't available on some systems (tested on musl+clang). Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-misc/jq')
-rw-r--r--app-misc/jq/files/jq-1.7_pre20201109-fix-configure-test.patch54
-rw-r--r--app-misc/jq/jq-1.7_pre20201109-r1.ebuild88
2 files changed, 142 insertions, 0 deletions
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
new file mode 100644
index 000000000000..8be52042bcc4
--- /dev/null
+++ b/app-misc/jq/files/jq-1.7_pre20201109-fix-configure-test.patch
@@ -0,0 +1,54 @@
+https://github.com/stedolan/jq/pull/2480
+
+From 40bbd419ad8d1bd9cbe8b17063c323f8a40ab327 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 6 Sep 2022 09:59:31 -0700
+Subject: [PATCH 1/2] configure: Pass _XOPEN_SOURCE when checking for strptime
+
+Include sys/time.h for gettimeofday since thats where its in glibc
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+--- a/configure.ac
++++ b/configure.ac
+@@ -139,7 +139,10 @@ AC_FUNC_ALLOCA
+
+ AC_FIND_FUNC([isatty], [c], [#include <unistd.h>], [0])
+ AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0])
++OLD_CFLAGS=$CFLAGS
++CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
+ AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0])
++CFLAGS=$OLD_CFLAGS
+ AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0])
+ AC_FIND_FUNC([setenv], [c], [#include <stdlib.h>], [0, 0, 0])
+ AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0])
+@@ -147,7 +150,7 @@ AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])
+ AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])
+ AC_FIND_FUNC([localtime_r], [c], [#include <time.h>], [0, 0])
+ AC_FIND_FUNC([localtime], [c], [#include <time.h>], [0])
+-AC_FIND_FUNC([gettimeofday], [c], [#include <time.h>], [0, 0])
++AC_FIND_FUNC([gettimeofday], [c], [#include <sys/time.h>], [0, 0])
+ 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])],
+ [], [[#include <time.h>]])
+ 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])],
+
+From cda1734bed3b048c01452c798877d05b8c2f4c15 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 6 Sep 2022 10:00:59 -0700
+Subject: [PATCH 2/2] builtin: Replace _BSD_SOURCE with _DEFAULT_SOURCE
+
+newer glibc has remove _BSD_SOURCE and wants it to be replaced with _DEFAULT_SOURCE
+
+Fixes
+/usr/include/features.h:194:3: warning: "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-W#warnings]
+warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+--- a/src/builtin.c
++++ b/src/builtin.c
+@@ -1,4 +1,4 @@
+-#define _BSD_SOURCE
++#define _DEFAULT_SOURCE
+ #define _GNU_SOURCE
+ #ifndef __sun__
+ # define _XOPEN_SOURCE
+
diff --git a/app-misc/jq/jq-1.7_pre20201109-r1.ebuild b/app-misc/jq/jq-1.7_pre20201109-r1.ebuild
new file mode 100644
index 000000000000..6c0d7ed19c9b
--- /dev/null
+++ b/app-misc/jq/jq-1.7_pre20201109-r1.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools
+
+COMMIT_HASH="a17dd3248a666d01be75f6b16be37e80e20b0954"
+
+DESCRIPTION="A lightweight and flexible command-line JSON processor"
+HOMEPAGE="https://stedolan.github.io/jq/"
+#SRC_URI="https://github.com/stedolan/jq/releases/download/${P}/${P}.tar.gz"
+SRC_URI="https://github.com/stedolan/jq/archive/${COMMIT_HASH}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-${COMMIT_HASH}"
+
+LICENSE="MIT CC-BY-3.0"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~arm arm64 ~ia64 ~loong ~ppc ppc64 ~riscv x86 ~amd64-linux ~x64-macos"
+IUSE="+oniguruma static-libs test"
+
+ONIGURUMA_MINPV='>=dev-libs/oniguruma-6.1.3' # Keep this in sync with bundled modules/oniguruma/
+DEPEND="
+ >=sys-devel/bison-3.0
+ sys-devel/flex
+ oniguruma? ( ${ONIGURUMA_MINPV}:=[static-libs?] )
+"
+RDEPEND="
+ !static-libs? (
+ oniguruma? ( ${ONIGURUMA_MINPV}[static-libs?] )
+ )
+"
+PATCHES=(
+ "${FILESDIR}"/jq-1.6-r3-never-bundle-oniguruma.patch
+ "${FILESDIR}"/jq-1.7-runpath.patch
+ "${FILESDIR}"/jq-1.7-warnings.patch
+ "${FILESDIR}"/jq-1.7-visible-null.patch
+ # https://bugs.gentoo.org/776385
+ "${FILESDIR}"/jq-1.7_pre20201109-no-git-bdep.patch
+ "${FILESDIR}"/jq-1.7_pre20201109-fix-configure-test.patch
+)
+
+RESTRICT="!test? ( test )"
+REQUIRED_USE="test? ( oniguruma )"
+
+src_prepare() {
+ sed -e '/^dist_doc_DATA/d; s:-Wextra ::' -i Makefile.am || die
+ sed -r -e "s:(m4_define\(\[jq_version\],) .+\):\1 \[${PV}\]):" \
+ -i configure.ac || die
+
+ # jq-1.6-r3-never-bundle-oniguruma makes sure we build with the system oniguruma,
+ # but the bundled copy of oniguruma still gets eautoreconf'd since it
+ # exists; save the cycles by nuking it.
+ sed -e '/modules\/oniguruma/d' -i Makefile.am || die
+ rm -rf "${S}"/modules/oniguruma || die
+
+ default
+ eautoreconf
+}
+
+src_configure() {
+ local econfargs=(
+ # don't try to rebuild docs
+ --disable-docs
+ --disable-valgrind
+ --disable-maintainer-mode
+ --enable-rpathhack
+ $(use_enable static-libs static)
+ $(use_with oniguruma oniguruma yes)
+ )
+ econf "${econfargs[@]}"
+}
+
+src_test() {
+ if ! LD_LIBRARY_PATH="${S}/.libs" nonfatal emake check; then
+ if [[ -r "${S}/test-suite.log" ]]; then
+ eerror "Tests failed, outputting testsuite log"
+ cat "${S}/test-suite.log"
+ fi
+ die "Tests failed"
+ fi
+}
+
+src_install() {
+ local DOCS=( AUTHORS NEWS README.md )
+ default
+
+ use static-libs || { find "${D}" -name '*.la' -delete || die; }
+}