summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-09-19 12:10:09 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-09-19 12:10:09 -0400
commitcc83d5933373e256e4d31599d3f4e85ee80915a6 (patch)
tree272f3568895471250c1d472f1325f5b6a704053b /pkgs
parent750933a17ceb4a6fed892c11f5d5219dbd91ad5b (diff)
downloadnixlib-cc83d5933373e256e4d31599d3f4e85ee80915a6.tar
nixlib-cc83d5933373e256e4d31599d3f4e85ee80915a6.tar.gz
nixlib-cc83d5933373e256e4d31599d3f4e85ee80915a6.tar.bz2
nixlib-cc83d5933373e256e4d31599d3f4e85ee80915a6.tar.lz
nixlib-cc83d5933373e256e4d31599d3f4e85ee80915a6.tar.xz
nixlib-cc83d5933373e256e4d31599d3f4e85ee80915a6.tar.zst
nixlib-cc83d5933373e256e4d31599d3f4e85ee80915a6.zip
zlib: Fix iOS cross build
  1. CHOST is how one specifies the cross host platform with this
  non-standard configure script. We were just getting lucky with Linux
  cross.

  2. install_name_tool needs the the binutils prefix.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/zlib/default.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index d3fb0970cd00..d348f877f722 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -3,7 +3,7 @@
 , static ? false
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (rec {
   name = "zlib-${version}";
   version = "1.2.11";
 
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
     # what causes this difference.
   + stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
     for file in $out/lib/*.so* $out/lib/*.dylib* ; do
-      install_name_tool -id "$file" $file
+      ${stdenv.cc.bintools.targetPrefix}install_name_tool -id "$file" $file
     done
   ''
     # Non-typical naming confuses libtool which then refuses to use zlib's DLL
@@ -78,4 +78,8 @@ stdenv.mkDerivation rec {
     license = licenses.zlib;
     platforms = platforms.all;
   };
-}
+} // stdenv.lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
+  preConfigure = ''
+    export CHOST=${stdenv.hostPlatform.config}
+  '';
+})