jq,oniguruma: make suitable for inclusion in common-path.nix

This commit is contained in:
Artturin 2022-12-08 20:46:54 +02:00
parent 5470541347
commit aae20cf5c0
3 changed files with 53 additions and 19 deletions

View File

@ -1,16 +1,18 @@
{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
{ lib, stdenv, fetchurl, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "onig";
pname = "oniguruma";
version = "6.9.8";
src = fetchFromGitHub {
owner = "kkos";
repo = "oniguruma";
rev = "v${version}";
sha256 = "sha256-8aFZdhh6ovLCR0A17rvWq/Oif66rSMnHcCYHjClNElw=";
# Note: do not use fetchpatch or fetchFromGitHub to keep this package available in __bootPackages
src = fetchurl {
url = "https://github.com/kkos/oniguruma/releases/download/v${version}/onig-${version}.tar.gz";
sha256 = "sha256-KM1iwUZGI8eRBWX7HMqqAQSy/osSvNZG6B9ztHU1IT4=";
};
outputs = [ "dev" "lib" "out" ];
outputBin = "dev"; # onig-config
nativeBuildInputs = [ autoreconfHook ];
configureFlags = [ "--enable-posix-api=yes" ];

View File

@ -1,7 +1,6 @@
{ lib
, stdenv
, fetchpatch
, fetchFromGitHub
, fetchurl
, autoreconfHook
, onigurumaSupport ? true
, oniguruma
@ -11,19 +10,14 @@ stdenv.mkDerivation rec {
pname = "jq";
version = "1.6";
src = fetchFromGitHub {
owner = "stedolan";
repo = "jq";
rev = "${pname}-${version}";
hash = "sha256-CIE8vumQPGK+TFAncmpBijANpFALLTadOvkob0gVzro";
# Note: do not use fetchpatch or fetchFromGitHub to keep this package available in __bootPackages
src = fetchurl {
url = "https://github.com/stedolan/jq/releases/download/jq-${version}/jq-${version}.tar.gz";
sha256 = "sha256-XejI4pqqP7nMa0e7JymfJxNU67clFOOsytx9OLW7qnI=";
};
patches = [
(fetchpatch {
name = "fix-tests-when-building-without-regex-supports.patch";
url = "https://github.com/stedolan/jq/pull/2292/commits/f6a69a6e52b68a92b816a28eb20719a3d0cb51ae.patch";
sha256 = "pTM5FZ6hFs5Rdx+W2dICSS2lcoLY1Q//Lan3Hu8Gr58=";
})
./fix-tests-when-building-without-regex-supports.patch
];
outputs = [ "bin" "doc" "man" "dev" "lib" "out" ];

View File

@ -0,0 +1,38 @@
From f6a69a6e52b68a92b816a28eb20719a3d0cb51ae Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov <git#v1@kaction.cc>
Date: Sat, 27 Mar 2021 00:00:00 +0000
Subject: [PATCH] Disable some tests when building without regex support
---
Makefile.am | 5 ++++-
configure.ac | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index f5c1db594..f3f44bb9e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -130,7 +130,10 @@ endif
### Tests (make check)
-TESTS = tests/optionaltest tests/mantest tests/jqtest tests/onigtest tests/shtest tests/utf8test tests/base64test
+TESTS = tests/optionaltest tests/jqtest tests/shtest tests/utf8test tests/base64test
+if WITH_ONIGURUMA
+TESTS += tests/mantest tests/onigtest
+endif
TESTS_ENVIRONMENT = NO_VALGRIND=$(NO_VALGRIND)
# This is a magic make variable that causes it to treat tests/man.test as a
diff --git a/configure.ac b/configure.ac
index 0441d4a2c..987d94e0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,6 +278,7 @@ AC_SUBST(onig_CFLAGS)
AC_SUBST(onig_LDFLAGS)
AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes])
+AM_CONDITIONAL([WITH_ONIGURUMA], [test "x$with_oniguruma" = xyes])
AC_SUBST([BUNDLER], ["$bundle_cmd"])
AC_CONFIG_MACRO_DIR([config/m4])