summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-03-26 13:50:01 -0500
committerWill Dietz <w@wdtz.org>2018-03-26 13:59:59 -0500
commitebf04d83c028906570d6cd09fc29780732888a50 (patch)
treec49a3d511debd82d579070048375fe66581bdd2f /pkgs/os-specific
parent59a53aada0965bbbfa79349f4d7eed9ff50b4058 (diff)
downloadnixlib-ebf04d83c028906570d6cd09fc29780732888a50.tar
nixlib-ebf04d83c028906570d6cd09fc29780732888a50.tar.gz
nixlib-ebf04d83c028906570d6cd09fc29780732888a50.tar.bz2
nixlib-ebf04d83c028906570d6cd09fc29780732888a50.tar.lz
nixlib-ebf04d83c028906570d6cd09fc29780732888a50.tar.xz
nixlib-ebf04d83c028906570d6cd09fc29780732888a50.tar.zst
nixlib-ebf04d83c028906570d6cd09fc29780732888a50.zip
musl-fts: add setup-hook to add -lfts
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/musl/fts-setup-hook.sh17
-rw-r--r--pkgs/os-specific/linux/musl/fts.nix2
2 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/musl/fts-setup-hook.sh b/pkgs/os-specific/linux/musl/fts-setup-hook.sh
new file mode 100644
index 000000000000..3962dcb19a20
--- /dev/null
+++ b/pkgs/os-specific/linux/musl/fts-setup-hook.sh
@@ -0,0 +1,17 @@
+ftsLdflags() {
+    # The `depHostOffset` describes how the host platform of the dependencies
+    # are slid relative to the depending package. It is brought into scope of
+    # the environment hook defined as the role of the dependency being applied.
+    case $depHostOffset in
+        -1) local role='BUILD_' ;;
+        0)  local role='' ;;
+        1)  local role='TARGET_' ;;
+        *)  echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2;
+            return 1 ;;
+    esac
+
+    export NIX_${role}LDFLAGS+=" -lfts"
+}
+
+addEnvHooks "$hostOffset" ftsLdflags
+
diff --git a/pkgs/os-specific/linux/musl/fts.nix b/pkgs/os-specific/linux/musl/fts.nix
index 083541e5e935..0f16e8cc79bf 100644
--- a/pkgs/os-specific/linux/musl/fts.nix
+++ b/pkgs/os-specific/linux/musl/fts.nix
@@ -11,4 +11,6 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  setupHook = ./fts-setup-hook.sh;
 }