zlib: refactor (and darwin fix), add meta.platforms

This commit is contained in:
Vladimír Čunát 2015-05-03 13:35:58 +02:00
parent 4949d5ec4a
commit 2be435422c

View File

@ -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 {}))
}