Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions pkgs/development/libraries/zlib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
shared ? !stdenv.hostPlatform.isStatic,
static ? true,
# If true, a separate .static output is created and the .a is moved there.
# In this case `pkg-config` auto detection does not currently work if the
# .static output is given as `buildInputs` to another package (#66461), because
# the `.pc` file lists only the main output's lib dir.
# If false, and if `{ static = true; }`, the .a stays in the main output.
splitStaticOutput ? shared && static,
testers,
Expand Down Expand Up @@ -70,6 +67,11 @@ stdenv.mkDerivation (finalAttrs: {
export CHOST=${stdenv.hostPlatform.config}
'';

configureFlags = [
"--includedir=${placeholder "dev"}/include"
"--sharedlibdir=${placeholder "out"}/lib"
"--libdir=${placeholder (if splitStaticOutput then "static" else "out")}/lib"
]
# For zlib's ./configure (as of version 1.2.11), the order
# of --static/--shared flags matters!
# `--shared --static` builds only static libs, while
Expand All @@ -82,7 +84,8 @@ stdenv.mkDerivation (finalAttrs: {
# `--static --shared`, `--shared` and giving nothing.
# Of these, we choose `--static --shared`, for clarity and simpler
# conditions.
configureFlags = lib.optional static "--static" ++ lib.optional shared "--shared";
++ lib.optional static "--static"
++ lib.optional shared "--shared";
# We do the right thing manually, above, so don't need these.
dontDisableStatic = true;
dontAddStaticConfigureFlags = true;
Expand All @@ -96,13 +99,10 @@ stdenv.mkDerivation (finalAttrs: {
# but we don't do it simply to avoid mass rebuilds.

postInstall =
lib.optionalString splitStaticOutput ''
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.
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
lib.optionalString stdenv.hostPlatform.isDarwin ''
for file in $out/lib/*.so* $out/lib/*.dylib* ; do
${stdenv.cc.bintools.targetPrefix}install_name_tool -id "$file" $file
done
Expand Down Expand Up @@ -144,6 +144,7 @@ stdenv.mkDerivation (finalAttrs: {

makeFlags = [
"PREFIX=${stdenv.cc.targetPrefix}"
"pkgconfigdir=${placeholder "dev"}/share/pkgconfig"
]
++ lib.optionals (stdenv.hostPlatform.isMinGW || stdenv.hostPlatform.isCygwin) [
"-f"
Expand Down
Loading