From e6f9e82ee462c912ec01754d26596f0a5d8a8c23 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 15 Oct 2017 12:03:00 -0400 Subject: [PATCH 1/4] flex: Use native dependencies where applicable Flex needs both a C compiler for the build environment, as well as a native m4. (cherry picked from commit 81827c0084c1a69e41894a4d38b0c0b267eaff34) --- pkgs/development/tools/parsing/flex/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/parsing/flex/default.nix b/pkgs/development/tools/parsing/flex/default.nix index 4ea11a622ea1..55fe7db80077 100644 --- a/pkgs/development/tools/parsing/flex/default.nix +++ b/pkgs/development/tools/parsing/flex/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, bison, m4 +{ stdenv, buildPackages, fetchurl, bison, m4 , fetchpatch, autoreconfHook, help2man }: @@ -19,11 +19,10 @@ stdenv.mkDerivation rec { + "/tools/flex/patches/200-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch"; sha256 = "1aarhcmz7mfrgh15pkj6f7ikxa2m0mllw1i1vscsf1kw5d05lw6f"; })]; - nativeBuildInputs = [ autoreconfHook help2man ]; + nativeBuildInputs = [ buildPackages.stdenv.cc autoreconfHook help2man ]; buildInputs = [ bison ]; - - propagatedBuildInputs = [ m4 ]; + nativePropagatedBuildInputs = [ m4 ]; postConfigure = stdenv.lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) '' sed -i Makefile -e 's/-no-undefined//;' From 715fcb4266710ca83991a1613d6cda3843183661 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 15 Oct 2017 13:01:08 -0400 Subject: [PATCH 2/4] flex: Don't disable static while cross-compiling flex linux-pam appears to rely on this while cross-compiling. (cherry picked from commit 4009dd163ac30cd25833bf7eb19b5e26e75c474f) --- pkgs/development/tools/parsing/flex/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/tools/parsing/flex/default.nix b/pkgs/development/tools/parsing/flex/default.nix index 55fe7db80077..0b4312966114 100644 --- a/pkgs/development/tools/parsing/flex/default.nix +++ b/pkgs/development/tools/parsing/flex/default.nix @@ -39,6 +39,9 @@ stdenv.mkDerivation rec { export ac_cv_func_malloc_0_nonnull=yes export ac_cv_func_realloc_0_nonnull=yes ''; + + # linux-pam derivation relies on static archive + dontDisableStatic = true; }; meta = { From 67be78f1290184ab8ad4a9e54460ae0e2cce6f6f Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Sun, 7 Jan 2018 16:47:54 -0600 Subject: [PATCH 3/4] flex: patch around attempt to regen manpage, fix cross --- pkgs/development/tools/parsing/flex/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/parsing/flex/default.nix b/pkgs/development/tools/parsing/flex/default.nix index 0b4312966114..0b4d8cbfc564 100644 --- a/pkgs/development/tools/parsing/flex/default.nix +++ b/pkgs/development/tools/parsing/flex/default.nix @@ -29,10 +29,11 @@ stdenv.mkDerivation rec { ''; crossAttrs = { - # disable tests which can't run on build machine postPatch = '' - substituteInPlace Makefile.in --replace "tests" " "; + substituteInPlace Makefile.in --replace "tests" " " + + substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: ' ''; preConfigure = '' From cafe25224fd5f61a74204860348e3f6acf3b2e46 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 22 Jan 2018 18:44:42 -0600 Subject: [PATCH 4/4] flex: review feedback * top-level attributes, not crossAttrs * use depsBuildBuild --- .../tools/parsing/flex/default.nix | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/pkgs/development/tools/parsing/flex/default.nix b/pkgs/development/tools/parsing/flex/default.nix index 0b4d8cbfc564..17323a06cc18 100644 --- a/pkgs/development/tools/parsing/flex/default.nix +++ b/pkgs/development/tools/parsing/flex/default.nix @@ -19,31 +19,27 @@ stdenv.mkDerivation rec { + "/tools/flex/patches/200-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch"; sha256 = "1aarhcmz7mfrgh15pkj6f7ikxa2m0mllw1i1vscsf1kw5d05lw6f"; })]; + postPatch = stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + substituteInPlace Makefile.in --replace "tests" " " - nativeBuildInputs = [ buildPackages.stdenv.cc autoreconfHook help2man ]; + substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: ' + ''; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + nativeBuildInputs = [ autoreconfHook help2man ]; buildInputs = [ bison ]; - nativePropagatedBuildInputs = [ m4 ]; + propagatedBuildInputs = [ m4 ]; + + preConfigure = stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' + export ac_cv_func_malloc_0_nonnull=yes + export ac_cv_func_realloc_0_nonnull=yes + ''; postConfigure = stdenv.lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) '' sed -i Makefile -e 's/-no-undefined//;' ''; - crossAttrs = { - # disable tests which can't run on build machine - postPatch = '' - substituteInPlace Makefile.in --replace "tests" " " - - substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: ' - ''; - - preConfigure = '' - export ac_cv_func_malloc_0_nonnull=yes - export ac_cv_func_realloc_0_nonnull=yes - ''; - - # linux-pam derivation relies on static archive - dontDisableStatic = true; - }; + dontDisableStatic = stdenv.buildPlatform != stdenv.hostPlatform; meta = { homepage = https://github.com/westes/flex;