summary refs log tree commit diff
path: root/pkgs/development/libraries/zlib
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2016-04-18 13:00:40 +0000
committerRobin Gloster <mail@glob.in>2016-04-18 13:49:22 +0000
commitd020caa5b2eca90ea051403fbb4c52b99ee071b9 (patch)
treeba44ef1e784bca89e0df6b249956fd035b1d86e3 /pkgs/development/libraries/zlib
parent3e68106afd95df012ddb548575f0133681687a90 (diff)
parent0729f606973870c03d21bb2f21b70d91216943ca (diff)
downloadnixpkgs-d020caa5b2eca90ea051403fbb4c52b99ee071b9.tar
nixpkgs-d020caa5b2eca90ea051403fbb4c52b99ee071b9.tar.gz
nixpkgs-d020caa5b2eca90ea051403fbb4c52b99ee071b9.tar.bz2
nixpkgs-d020caa5b2eca90ea051403fbb4c52b99ee071b9.tar.lz
nixpkgs-d020caa5b2eca90ea051403fbb4c52b99ee071b9.tar.xz
nixpkgs-d020caa5b2eca90ea051403fbb4c52b99ee071b9.tar.zst
nixpkgs-d020caa5b2eca90ea051403fbb4c52b99ee071b9.zip
Merge remote-tracking branch 'upstream/master' into hardened-stdenv
Diffstat (limited to 'pkgs/development/libraries/zlib')
-rw-r--r--pkgs/development/libraries/zlib/default.nix34
1 files changed, 21 insertions, 13 deletions
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index 77ab0f8ffa9..6d0f8185921 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -2,7 +2,7 @@
 
 let version = "1.2.8"; in
 
-stdenv.mkDerivation (rec {
+stdenv.mkDerivation rec {
   name = "zlib-${version}";
 
   src = fetchurl {
@@ -20,18 +20,34 @@ stdenv.mkDerivation (rec {
       --replace 'ARFLAGS="-o"' 'ARFLAGS="-r"'
   '';
 
-  configureFlags = if static then "" else "--shared";
+  outputs = [ "dev" "out" "static" ];
+  setOutputFlags = false;
+  outputDoc = "dev"; # single tiny man3 page
+
 
   preConfigure = ''
     if test -n "$crossConfig"; then
       export CC=$crossConfig-gcc
-      configureFlags=${if static then "" else "--shared"}
     fi
   '';
 
   # FIXME needs gcc 4.9 in bootstrap tools
   hardeningDisable = [ "stackprotector" ];
 
+  configureFlags = stdenv.lib.optional (!static) "--shared";
+
+  postInstall = ''
+    moveToOutput lib/libz.a "$static"
+  ''
+    # jww (2015-01-06): Sometimes this library install as a .so, even on
+    # Darwin; others time it installs as a .dylib.  I haven't yet figured out
+    # what causes this difference.
+  + stdenv.lib.optionalString stdenv.isDarwin ''
+    for file in $out/lib/*.so* $out/lib/*.dylib* ; do
+      install_name_tool -id "$file" $file
+    done
+  '';
+
   # As zlib takes part in the stdenv building, we don't want references
   # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.isDarwin) "-static-libgcc";
@@ -60,13 +76,5 @@ stdenv.mkDerivation (rec {
     license = licenses.zlib;
     platforms = platforms.all;
   };
-} // (if stdenv.isDarwin then {
-  postInstall = ''
-    # jww (2015-01-06): Sometimes this library install as a .so, even on
-    # Darwin; others time it installs as a .dylib.  I haven't yet figured out
-    # what causes this difference.
-    for file in $out/lib/*.so* $out/lib/*.dylib* ; do
-      install_name_tool -id "$file" $file
-    done
-  '';
-} else {}))
+}
+