summary refs log tree commit diff
path: root/pkgs/os-specific/linux/musl
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-07 13:07:19 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-07 15:10:37 -0400
commit2110c0bd3009279ceec291f07bfbf063cb5ba6a0 (patch)
tree7c981653734d64a2b9c1859233b9902aa36f4ab1 /pkgs/os-specific/linux/musl
parent34a3233a2e1e8ed2f005a3a86cfca02d5f2769ae (diff)
downloadnixpkgs-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar
nixpkgs-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.gz
nixpkgs-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.bz2
nixpkgs-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.lz
nixpkgs-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.xz
nixpkgs-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.zst
nixpkgs-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.zip
treewide: Use pkgs/build-support/roles.bash to remove copy pasta
Also fix some setup hooks that unnecessarily used environment hooks,
which revolted in the same variable being modified too many times.
Diffstat (limited to 'pkgs/os-specific/linux/musl')
-rw-r--r--pkgs/os-specific/linux/musl/fts-setup-hook.sh19
-rw-r--r--pkgs/os-specific/linux/musl/fts.nix5
2 files changed, 7 insertions, 17 deletions
diff --git a/pkgs/os-specific/linux/musl/fts-setup-hook.sh b/pkgs/os-specific/linux/musl/fts-setup-hook.sh
index 3962dcb19a2..5cf8c753aec 100644
--- a/pkgs/os-specific/linux/musl/fts-setup-hook.sh
+++ b/pkgs/os-specific/linux/musl/fts-setup-hook.sh
@@ -1,17 +1,4 @@
-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
+# See pkgs/build-support/setup-hooks/role.bash
+getHostRole
 
+export NIX_${role_pre}LDFLAGS+=" -lfts"
diff --git a/pkgs/os-specific/linux/musl/fts.nix b/pkgs/os-specific/linux/musl/fts.nix
index 0f16e8cc79b..24d25de3a2d 100644
--- a/pkgs/os-specific/linux/musl/fts.nix
+++ b/pkgs/os-specific/linux/musl/fts.nix
@@ -12,5 +12,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
 
-  setupHook = ./fts-setup-hook.sh;
+  setupHooks = [
+    ../../../build-support/setup-hooks/role.bash
+    ./fts-setup-hook.sh
+  ];
 }