summary refs log tree commit diff
path: root/pkgs/tools/compression/zstd
diff options
context:
space:
mode:
authorJonathan Ringer <jonringer117@gmail.com>2021-07-10 12:08:31 -0700
committerJonathan Ringer <jonringer@users.noreply.github.com>2021-07-11 15:44:09 -0700
commit03e499425d2f3968eeb9b568d0350b6cf3da6b64 (patch)
treeec5e9c8933736a90366c966caa5e24dd384d64d8 /pkgs/tools/compression/zstd
parentbabb761ac622c87ca51dbcede7668c73ba1217df (diff)
zstd: don't build contrib when cross-compiling
Tests and `./gen_html` from contrib need to run
on host architecture. Disable them when doing
cross-compiliation.
Diffstat (limited to 'pkgs/tools/compression/zstd')
-rw-r--r--pkgs/tools/compression/zstd/default.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgs/tools/compression/zstd/default.nix b/pkgs/tools/compression/zstd/default.nix
index 5253d7faa4010..16504d50dbf40 100644
--- a/pkgs/tools/compression/zstd/default.nix
+++ b/pkgs/tools/compression/zstd/default.nix
@@ -3,6 +3,9 @@
 , file
 , legacySupport ? false
 , static ? stdenv.hostPlatform.isStatic
+# these need to be ran on the host, thus disable when cross-compiling
+, buildContrib ? stdenv.hostPlatform == stdenv.buildPlatform
+, doCheck ? stdenv.hostPlatform == stdenv.buildPlatform
 }:
 
 stdenv.mkDerivation rec {
@@ -40,7 +43,7 @@ stdenv.mkDerivation rec {
     (name: value: "-DZSTD_${name}:BOOL=${if value then "ON" else "OFF"}") {
       BUILD_SHARED = !static;
       BUILD_STATIC = static;
-      BUILD_CONTRIB = true;
+      BUILD_CONTRIB = buildContrib;
       PROGRAMS_LINK_SHARED = !static;
       LEGACY_SUPPORT = legacySupport;
       BUILD_TESTS = doCheck;
@@ -53,7 +56,7 @@ stdenv.mkDerivation rec {
   '';
 
   checkInputs = [ file ];
-  doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
+  inherit doCheck;
   checkPhase = ''
     runHook preCheck
     # Patch shebangs for playTests
@@ -64,7 +67,6 @@ stdenv.mkDerivation rec {
 
   preInstall = ''
     mkdir -p $bin/bin
-    cp contrib/pzstd/pzstd $bin/bin/pzstd
     substituteInPlace ../programs/zstdgrep \
       --replace ":-grep" ":-${gnugrep}/bin/grep" \
       --replace ":-zstdcat" ":-$bin/bin/zstdcat"
@@ -73,6 +75,8 @@ stdenv.mkDerivation rec {
       --replace "zstdcat" "$bin/bin/zstdcat"
   '' + lib.optionalString stdenv.isDarwin ''
     install_name_tool -change @rpath/libzstd.1.dylib $out/lib/libzstd.1.dylib $bin/bin/pzstd
+  '' + lib.optionalString buildContrib ''
+    cp contrib/pzstd/pzstd $bin/bin/pzstd
   '';
 
   outputs = [ "bin" "dev" ]