From 2be435422c06849c092a3660c8d3ec430753f425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 3 May 2015 13:35:58 +0200 Subject: [PATCH] zlib: refactor (and darwin fix), add meta.platforms --- pkgs/development/libraries/zlib/default.nix | 26 ++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index e19d8cdfcb2e..38b1d70cc86b 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 { @@ -16,16 +16,24 @@ stdenv.mkDerivation (rec { outputs = [ "dev" "out" "static" "man" ]; setOutputFlags = false; - configureFlags = stdenv.lib.optional (!static) "--shared"; - preConfigure = '' if test -n "$crossConfig"; then export CC=$crossConfig-gcc fi ''; + 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 @@ -56,13 +64,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 {})) +} +