gettext: fix stdenv-darwin; remove Bison dependency (#59553)

Commit 1279016787 broke building
nixpkgs.clangStdenv (stdenv-darwin) on macOS:

    nix-build -A clangStdenv .
    these derivations will be built:
      /nix/store/b3vyrfzarzyh51n7fj9wrpw12sq3765l-stdenv-darwin.drv
    building '/nix/store/b3vyrfzarzyh51n7fj9wrpw12sq3765l-stdenv-darwin.drv'...
    output '/nix/store/3agkxvkbhfpimnx5imr09q4rq9pxmjda-stdenv-darwin' is not allowed to refer to the following paths:
         /nix/store/jnzhx3hni0ds1wf49z8wfnxi3qdnkk6q-gnum4-1.4.18
           /nix/store/smdncnz5pkl5q39k4ldk8bh84p2hmj19-bison-3.3.2
    error: build of '/nix/store/b3vyrfzarzyh51n7fj9wrpw12sq3765l-stdenv-darwin.drv' failed

Remove gettext's build dependency on Bison to avoid this error, fixing
Nixpkgs on macOS.

To avoid rebuilding everything unnecessarily on Linux, only apply these
changes to macOS and keep the Bison dependency for Linux.
This commit is contained in:
strager
2019-04-15 01:09:44 -04:00
committed by Dmitry Kalinkin
parent e5724e8e66
commit 6ccf2201f9
2 changed files with 339 additions and 1 deletions
+16 -1
View File
@@ -1,5 +1,6 @@
{ stdenv, lib, fetchurl, libiconv, xz, bison, automake115x, autoconf }:
let allowBisonDependency = !stdenv.isDarwin; in
stdenv.mkDerivation rec {
name = "gettext-${version}";
version = "0.19.8.1";
@@ -15,6 +16,9 @@ stdenv.mkDerivation rec {
url = "https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=patch;h=dce3a16e5e9368245735e29bf498dcd5e3e474a4";
sha256 = "1lpjwwcjr1sb879faj0xyzw02kma0ivab6xwn3qciy13qy6fq5xn";
})
] ++ lib.optionals (!allowBisonDependency) [
# Only necessary for CVE-2018-18751.patch:
./CVE-2018-18751-bison.patch
];
outputs = [ "out" "man" "doc" "info" ];
@@ -47,7 +51,18 @@ stdenv.mkDerivation rec {
sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
'';
nativeBuildInputs = [ xz xz.bin bison automake115x autoconf];
nativeBuildInputs = [
xz
xz.bin
] ++ lib.optional allowBisonDependency [
# Only necessary for CVE-2018-18751.patch (unless CVE-2018-18751-bison.patch
# is also applied):
bison
] ++ [
# Only necessary for CVE-2018-18751.patch:
automake115x
autoconf
];
# HACK, see #10874 (and 14664)
buildInputs = stdenv.lib.optional (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) libiconv;