summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Kampka <christian@kampka.net>2020-09-02 16:36:38 +0200
committerChristian Kampka <christian@kampka.net>2020-09-02 16:41:51 +0200
commit67f0a216e5c8cec5a1d1787c57dbf8b4fb56ccf9 (patch)
treee45f53cfd3997adc3305ee6f6265fb63f8a346a9
parentef55e4b525e4038419026476dfc9df36df2c821f (diff)
downloadnixpkgs-67f0a216e5c8cec5a1d1787c57dbf8b4fb56ccf9.tar
nixpkgs-67f0a216e5c8cec5a1d1787c57dbf8b4fb56ccf9.tar.gz
nixpkgs-67f0a216e5c8cec5a1d1787c57dbf8b4fb56ccf9.tar.bz2
nixpkgs-67f0a216e5c8cec5a1d1787c57dbf8b4fb56ccf9.tar.lz
nixpkgs-67f0a216e5c8cec5a1d1787c57dbf8b4fb56ccf9.tar.xz
nixpkgs-67f0a216e5c8cec5a1d1787c57dbf8b4fb56ccf9.tar.zst
nixpkgs-67f0a216e5c8cec5a1d1787c57dbf8b4fb56ccf9.zip
hspell: fix cross-platform build issues
hspell uses a couple of binaries it generates during it's own build.
These will cause the build to fail later in cross-platform builds as
these binaries have the wrong executable format.
Using a hspell to bootstrap it's own build natively resolves this issue.
-rw-r--r--pkgs/development/libraries/hspell/default.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkgs/development/libraries/hspell/default.nix b/pkgs/development/libraries/hspell/default.nix
index 8501bf88b6d..813bbef26b7 100644
--- a/pkgs/development/libraries/hspell/default.nix
+++ b/pkgs/development/libraries/hspell/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, zlib }:
+{ stdenv, fetchurl, perl, zlib, buildPackages }:
 
 stdenv.mkDerivation rec {
   name = "${passthru.pname}-${passthru.version}";
@@ -16,7 +16,18 @@ stdenv.mkDerivation rec {
   };
 
   patchPhase = ''patchShebangs .'';
-  buildInputs = [ perl zlib ];
+  preBuild = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    make CC=${buildPackages.stdenv.cc}/bin/cc find_sizes
+    mv find_sizes find_sizes_build
+    make clean
+
+    substituteInPlace Makefile --replace "./find_sizes" "./find_sizes_build"
+    substituteInPlace Makefile --replace "ar cr" "${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar cr"
+    substituteInPlace Makefile --replace "ranlib" "${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
+    substituteInPlace Makefile --replace "STRIP=strip" "STRIP=${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip"
+  '';
+  nativeBuildInputs = [ perl zlib ];
+#  buildInputs = [ zlib ];
 
   meta = with stdenv.lib; {
     description = "Hebrew spell checker";