summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@yahoo.com>2018-01-22 20:11:03 -0500
committerGitHub <noreply@github.com>2018-01-22 20:11:03 -0500
commitf83bf0e79dc83f4375742839eee6634cb64c1e1b (patch)
treedf1a7040a178f034eb53c4768f87935a71818320 /pkgs
parent1f70b3272513975f6a83260f8bd2aa332119fdbc (diff)
parentcafe25224fd5f61a74204860348e3f6acf3b2e46 (diff)
downloadnixpkgs-f83bf0e79dc83f4375742839eee6634cb64c1e1b.tar
nixpkgs-f83bf0e79dc83f4375742839eee6634cb64c1e1b.tar.gz
nixpkgs-f83bf0e79dc83f4375742839eee6634cb64c1e1b.tar.bz2
nixpkgs-f83bf0e79dc83f4375742839eee6634cb64c1e1b.tar.lz
nixpkgs-f83bf0e79dc83f4375742839eee6634cb64c1e1b.tar.xz
nixpkgs-f83bf0e79dc83f4375742839eee6634cb64c1e1b.tar.zst
nixpkgs-f83bf0e79dc83f4375742839eee6634cb64c1e1b.zip
Merge pull request #34170 from dtzWill/fix/flex-cross
flex: fix for cross
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/parsing/flex/default.nix29
1 files changed, 14 insertions, 15 deletions
diff --git a/pkgs/development/tools/parsing/flex/default.nix b/pkgs/development/tools/parsing/flex/default.nix
index 4ea11a622ea..17323a06cc1 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,28 +19,27 @@ stdenv.mkDerivation rec {
         + "/tools/flex/patches/200-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch";
     sha256 = "1aarhcmz7mfrgh15pkj6f7ikxa2m0mllw1i1vscsf1kw5d05lw6f";
   })];
-  nativeBuildInputs = [ autoreconfHook help2man ];
+  postPatch = stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+    substituteInPlace Makefile.in --replace "tests" " "
 
-  buildInputs = [ bison ];
+    substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: '
+  '';
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ autoreconfHook help2man ];
+  buildInputs = [ bison ];
   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" " ";
-    '';
-
-    preConfigure = ''
-      export ac_cv_func_malloc_0_nonnull=yes
-      export ac_cv_func_realloc_0_nonnull=yes
-    '';
-  };
+  dontDisableStatic = stdenv.buildPlatform != stdenv.hostPlatform;
 
   meta = {
     homepage = https://github.com/westes/flex;