Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bzip2, zstd: Add enableStatic option #243161

Merged
merged 2 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pkgs/stdenv/darwin/make-bootstrap-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; });
Expand Down
11 changes: 8 additions & 3 deletions pkgs/tools/compression/bzip2/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ lib, stdenv, fetchurl
, linkStatic ? with stdenv.hostPlatform; isStatic || isCygwin
, enableStatic ? with stdenv.hostPlatform; isStatic || isCygwin
, enableShared ? true
, autoreconfHook
, testers
}:
Expand Down Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions pkgs/tools/compression/zstd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down