zlib: refactor (and darwin fix), add meta.platforms
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
let version = "1.2.8"; in
|
let version = "1.2.8"; in
|
||||||
|
|
||||||
stdenv.mkDerivation (rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "zlib-${version}";
|
name = "zlib-${version}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
@@ -16,16 +16,24 @@ stdenv.mkDerivation (rec {
|
|||||||
outputs = [ "dev" "out" "static" "man" ];
|
outputs = [ "dev" "out" "static" "man" ];
|
||||||
setOutputFlags = false;
|
setOutputFlags = false;
|
||||||
|
|
||||||
configureFlags = stdenv.lib.optional (!static) "--shared";
|
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
if test -n "$crossConfig"; then
|
if test -n "$crossConfig"; then
|
||||||
export CC=$crossConfig-gcc
|
export CC=$crossConfig-gcc
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
configureFlags = stdenv.lib.optional (!static) "--shared";
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
_moveToOutput lib/libz.a "$static"
|
_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
|
# As zlib takes part in the stdenv building, we don't want references
|
||||||
@@ -56,13 +64,5 @@ stdenv.mkDerivation (rec {
|
|||||||
license = licenses.zlib;
|
license = licenses.zlib;
|
||||||
platforms = platforms.all;
|
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 {}))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user