Skip to content

Commit

Permalink
gnugrep/stdenv: Fix PCRE support by replacing PCRE lib
Browse files Browse the repository at this point in the history
  • Loading branch information
dasJ committed May 15, 2023
1 parent 658c76a commit 11c8f46
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
12 changes: 7 additions & 5 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ rec {
nghttp2.lib
coreutils
gnugrep
pcre.out
gnugrep.pcre2.out
gmp
libiconv
brotli.lib
Expand Down Expand Up @@ -563,7 +563,7 @@ rec {
nghttp2.lib
coreutils
gnugrep
pcre.out
gnugrep.pcre2.out
gmp
libiconv
brotli.lib
Expand All @@ -587,8 +587,9 @@ rec {
persistent = self: super: with prevStage; {
inherit
gnumake gzip gnused bzip2 ed xz patch bash python3
ncurses libffi zlib gmp pcre gnugrep cmake
ncurses libffi zlib gmp gnugrep cmake
coreutils findutils diffutils patchutils ninja libxml2;
inherit (gnugrep) pcre2;

# Hack to make sure we don't link ncurses in bootstrap tools. The proper
# solution is to avoid passing -L/nix-store/...-bootstrap-tools/lib,
Expand Down Expand Up @@ -643,8 +644,9 @@ rec {
persistent = self: super: with prevStage; {
inherit
gnumake gzip gnused bzip2 gawk ed xz patch bash
ncurses libffi zlib gmp pcre gnugrep
ncurses libffi zlib gmp gnugrep
coreutils findutils diffutils patchutils pbzx;
inherit (gnugrep) pcre2;

darwin = super.darwin.overrideScope (_: _: {
inherit (darwin) dyld ICU Libsystem Csu libiconv rewrite-tbd;
Expand Down Expand Up @@ -734,7 +736,7 @@ rec {
gawk
gnugrep
patch
pcre.out
gnugrep.pcre2.out
gettext
binutils.bintools
binutils.bintools.lib
Expand Down
4 changes: 2 additions & 2 deletions pkgs/stdenv/darwin/make-bootstrap-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ in rec {
chmod -R u+w $out/include
cp -rL ${darwin.ICU}/include* $out/include
cp -rL ${libiconv}/include/* $out/include
cp -rL ${lib.getDev gnugrep.pcre}/include/* $out/include
cp -rL ${lib.getDev gnugrep.pcre2}/include/* $out/include
mv $out/include $out/include-Libsystem
# Copy coreutils, bash, etc.
Expand Down Expand Up @@ -86,7 +86,7 @@ in rec {
cp -d ${libssh2.out}/lib/libssh*.dylib $out/lib
cp -d ${lib.getLib openssl}/lib/*.dylib $out/lib
cp -d ${gnugrep.pcre.out}/lib/libpcre*.dylib $out/lib
cp -d ${gnugrep.pcre2.out}/lib/libpcre2*.dylib $out/lib
cp -d ${lib.getLib libiconv}/lib/lib*.dylib $out/lib
cp -d ${lib.getLib gettext}/lib/libintl*.dylib $out/lib
chmod +x $out/lib/libintl*.dylib
Expand Down
5 changes: 3 additions & 2 deletions pkgs/stdenv/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ in
]
# Library dependencies
++ map getLib (
[ attr acl zlib pcre libidn2 libunistring ]
[ attr acl zlib gnugrep.pcre2 libidn2 libunistring ]
++ lib.optional (gawk.libsigsegv != null) gawk.libsigsegv
)
# More complicated cases
Expand All @@ -658,7 +658,8 @@ in
inherit (prevStage)
gzip bzip2 xz bash coreutils diffutils findutils gawk
gnused gnutar gnugrep gnupatch patchelf
attr acl zlib pcre libunistring;
attr acl zlib libunistring;
inherit (prevStage.gnugrep) pcre2;
${localSystem.libc} = getLibc prevStage;

# Hack: avoid libidn2.{bin,dev} referencing bootstrap tools. There's a logical cycle.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/stdenv/linux/make-bootstrap-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ in with pkgs; rec {
cp -d ${patch}/bin/* $out/bin
cp ${patchelf}/bin/* $out/bin
cp -d ${gnugrep.pcre.out}/lib/libpcre*.so* $out/lib # needed by grep
cp -d ${gnugrep.pcre2.out}/lib/libpcre2*.so* $out/lib # needed by grep
# Copy what we need of GCC.
cp -d ${bootGCC.out}/bin/gcc $out/bin
Expand Down
8 changes: 5 additions & 3 deletions pkgs/tools/text/gnugrep/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, pcre, libiconv, perl, autoreconfHook }:
{ lib, stdenv, fetchurl, pcre2, libiconv, perl, autoreconfHook }:

# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
Expand All @@ -19,7 +19,7 @@ stdenv.mkDerivation {
nativeCheckInputs = [ perl ];
outputs = [ "out" "info" ]; # the man pages are rather small

buildInputs = [ pcre libiconv ];
buildInputs = [ pcre2 libiconv ];

# cygwin: FAIL: multibyte-white-space
# freebsd: FAIL mb-non-UTF8-performance
Expand Down Expand Up @@ -63,5 +63,7 @@ stdenv.mkDerivation {
mainProgram = "grep";
};

passthru = {inherit pcre;};
passthru = {
inherit pcre2;
};
}

0 comments on commit 11c8f46

Please sign in to comment.