From e999def1597de9d03a35cfa6b62277adb0e9a7ad Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 4 Dec 2018 21:14:41 -0600 Subject: [PATCH] zlib: clean up static/shared distincion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is kind of a mess, but basically: - static=true, shared=true means to build statically but move it to the static output - static=true, shared=false means to build statically and leave it in the main output - static=false, shared=true means to not build static at all Confusingly, the old default was static=true, shared=true even though static=false? Still can’t figure out what was meant by that. --- pkgs/development/libraries/zlib/default.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index fe1c275aeda5..3a5638b22814 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -1,6 +1,7 @@ { stdenv , fetchurl -, static ? false +, static ? true +, shared ? true }: stdenv.mkDerivation (rec { @@ -24,13 +25,15 @@ stdenv.mkDerivation (rec { --replace 'ARFLAGS="-o"' 'ARFLAGS="-r"' ''; - outputs = [ "out" "dev" "static" ]; + outputs = [ "out" "dev" ] + ++ stdenv.lib.optional (shared && static) "static"; setOutputFlags = false; outputDoc = "dev"; # single tiny man3 page - configureFlags = stdenv.lib.optional (!static) "--shared"; + configureFlags = stdenv.lib.optional shared "--shared" + ++ stdenv.lib.optional (static && !shared) "--static"; - postInstall = '' + postInstall = stdenv.lib.optionalString (shared && static) '' moveToOutput lib/libz.a "$static" '' # jww (2015-01-06): Sometimes this library install as a .so, even on @@ -64,7 +67,7 @@ stdenv.mkDerivation (rec { "PREFIX=${stdenv.cc.targetPrefix}" ] ++ stdenv.lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ "-f" "win32/Makefile.gcc" - ] ++ stdenv.lib.optionals (!static) [ + ] ++ stdenv.lib.optionals shared [ "SHARED_MODE=1" ];