about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/compression/zstd/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/compression/zstd/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/compression/zstd/default.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/tools/compression/zstd/default.nix b/nixpkgs/pkgs/tools/compression/zstd/default.nix
index 2f89331f92c6..f919fb92ed1d 100644
--- a/nixpkgs/pkgs/tools/compression/zstd/default.nix
+++ b/nixpkgs/pkgs/tools/compression/zstd/default.nix
@@ -30,6 +30,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [
     "-DZSTD_BUILD_SHARED:BOOL=${if enableShared then "ON" else "OFF"}"
+    # They require STATIC for bin/zstd and tests.
     "-DZSTD_LEGACY_SUPPORT:BOOL=${if legacySupport then "ON" else "OFF"}"
     "-DZSTD_BUILD_TESTS:BOOL=ON"
   ];
@@ -50,11 +51,15 @@ stdenv.mkDerivation rec {
   preInstall = ''
     substituteInPlace ../programs/zstdgrep \
       --replace ":-grep" ":-${gnugrep}/bin/grep" \
-      --replace ":-zstdcat" ":-$out/bin/zstdcat"
+      --replace ":-zstdcat" ":-$bin/bin/zstdcat"
 
     substituteInPlace ../programs/zstdless \
-      --replace "zstdcat" "$out/bin/zstdcat"
+      --replace "zstdcat" "$bin/bin/zstdcat"
   '';
+  # Don't duplicate the library code in runtime closures.
+  postInstall = stdenv.lib.optionalString enableShared ''rm "$out"/lib/libzstd.a'';
+
+  outputs = [ "bin" "dev" "man" "out" ];
 
   meta = with stdenv.lib; {
     description = "Zstandard real-time compression algorithm";