From e73b7f8d63d2f940ab8110001942b5491d07fd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Mon, 12 Jun 2023 23:51:59 +0000 Subject: [PATCH 1/2] bzip2: Add `enableStatic`. See #61575 --- pkgs/stdenv/darwin/make-bootstrap-tools.nix | 2 +- pkgs/tools/compression/bzip2/default.nix | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix index 9c580447a6f4..bf6a3fb96a79 100644 --- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix +++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix @@ -29,7 +29,7 @@ in rec { cctools_ = darwin.cctools; # Avoid debugging larger changes for now. - bzip2_ = bzip2.override (args: { linkStatic = true; }); + bzip2_ = bzip2.override (args: { enableStatic = true; enableShared = false; }); # Avoid messing with libkrb5 and libnghttp2. curl_ = curlMinimal.override (args: { gssSupport = false; http2Support = false; }); diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix index be456cf59442..bfab2dbb9467 100644 --- a/pkgs/tools/compression/bzip2/default.nix +++ b/pkgs/tools/compression/bzip2/default.nix @@ -1,5 +1,6 @@ { lib, stdenv, fetchurl -, linkStatic ? with stdenv.hostPlatform; isStatic || isCygwin +, enableStatic ? with stdenv.hostPlatform; isStatic || isCygwin +, enableShared ? true , autoreconfHook , testers }: @@ -47,8 +48,12 @@ in { outputs = [ "bin" "dev" "out" "man" ]; - configureFlags = - lib.optionals linkStatic [ "--enable-static" "--disable-shared" ]; + configureFlags = lib.concatLists [ + (lib.optional enableStatic "--enable-static") + (lib.optional (!enableShared) "--disable-shared") + ]; + + dontDisableStatic = enableStatic; enableParallelBuilding = true; From ef4c88d1f67efe6a36b40119ebf11ff134f40724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Mon, 12 Jun 2023 23:53:35 +0000 Subject: [PATCH 2/2] zstd: Add `enableStatic`. See #61575 --- pkgs/tools/compression/zstd/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/compression/zstd/default.nix b/pkgs/tools/compression/zstd/default.nix index 3a51bdce190b..346daf115820 100644 --- a/pkgs/tools/compression/zstd/default.nix +++ b/pkgs/tools/compression/zstd/default.nix @@ -3,7 +3,8 @@ , file , fetchpatch , legacySupport ? false -, static ? stdenv.hostPlatform.isStatic +, static ? stdenv.hostPlatform.isStatic # generates static libraries *only* +, enableStatic ? static # these need to be ran on the host, thus disable when cross-compiling , buildContrib ? stdenv.hostPlatform == stdenv.buildPlatform , doCheck ? stdenv.hostPlatform == stdenv.buildPlatform @@ -55,7 +56,7 @@ stdenv.mkDerivation rec { cmakeFlags = lib.attrsets.mapAttrsToList (name: value: "-DZSTD_${name}:BOOL=${if value then "ON" else "OFF"}") { BUILD_SHARED = !static; - BUILD_STATIC = static; + BUILD_STATIC = enableStatic; BUILD_CONTRIB = buildContrib; PROGRAMS_LINK_SHARED = !static; LEGACY_SUPPORT = legacySupport;