summary refs log tree commit diff
path: root/pkgs/build-support/libredirect
diff options
context:
space:
mode:
authorDmitry Bogatov <kaction@disroot.org>2022-01-08 09:14:35 -0500
committerGitHub <noreply@github.com>2022-01-08 14:14:35 +0000
commit17577f6b54d71875b6c14edb31dbd474282d663e (patch)
tree5dbeda895ecd203f02e5d797ebe25c291a2ceec0 /pkgs/build-support/libredirect
parent9a7742d5485e7fa3e3ffa36c29e6d3e703f00eef (diff)
downloadnixpkgs-17577f6b54d71875b6c14edb31dbd474282d663e.tar
nixpkgs-17577f6b54d71875b6c14edb31dbd474282d663e.tar.gz
nixpkgs-17577f6b54d71875b6c14edb31dbd474282d663e.tar.bz2
nixpkgs-17577f6b54d71875b6c14edb31dbd474282d663e.tar.lz
nixpkgs-17577f6b54d71875b6c14edb31dbd474282d663e.tar.xz
nixpkgs-17577f6b54d71875b6c14edb31dbd474282d663e.tar.zst
nixpkgs-17577f6b54d71875b6c14edb31dbd474282d663e.zip
pkgsStatic.libredirect: print error message why it won't work
The whole point of libredirect is manipulation with LD_PRELOAD, which is not
supposed to work on static builds.
Diffstat (limited to 'pkgs/build-support/libredirect')
-rw-r--r--pkgs/build-support/libredirect/default.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/pkgs/build-support/libredirect/default.nix b/pkgs/build-support/libredirect/default.nix
index f87c6d23dd7..0c86ea9a793 100644
--- a/pkgs/build-support/libredirect/default.nix
+++ b/pkgs/build-support/libredirect/default.nix
@@ -1,6 +1,22 @@
-{ stdenv, lib, coreutils }:
+{ stdenv, runCommand, lib, coreutils }:
 
-stdenv.mkDerivation rec {
+if stdenv.hostPlatform.isStatic
+then throw ''
+  libredirect is not available on static builds.
+
+  Please fix your derivation to not depend on libredirect on static
+  builds, using something like following:
+
+    nativeBuildInputs =
+      lib.optional (!stdenv.buildPlatform.isStatic) libredirect;
+
+  and disable tests as necessary, although fixing tests to work without
+  libredirect is even better.
+
+  libredirect uses LD_PRELOAD feature of dynamic loader and does not
+  work on static builds where dynamic loader is not used.
+  ''
+else stdenv.mkDerivation rec {
   pname = "libredirect";
   version = "0";