summary refs log tree commit diff
path: root/pkgs/development/compilers/llvm/5
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/llvm/5')
-rw-r--r--pkgs/development/compilers/llvm/5/libc++/default.nix5
-rw-r--r--pkgs/development/compilers/llvm/5/libc++/setup-hook.sh16
2 files changed, 8 insertions, 13 deletions
diff --git a/pkgs/development/compilers/llvm/5/libc++/default.nix b/pkgs/development/compilers/llvm/5/libc++/default.nix
index 9ddeea7ef79..cb6dfe2808e 100644
--- a/pkgs/development/compilers/llvm/5/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/5/libc++/default.nix
@@ -40,7 +40,10 @@ stdenv.mkDerivation rec {
 
   linkCxxAbi = stdenv.isLinux;
 
-  setupHook = ./setup-hook.sh;
+  setupHooks = [
+    ../../../../../build-support/setup-hooks/role.bash
+    ./setup-hook.sh
+  ];
 
   meta = {
     homepage = http://libcxx.llvm.org/;
diff --git a/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh
index bcd93cf486f..6611259165a 100644
--- a/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh
+++ b/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh
@@ -1,14 +1,6 @@
-# The `hostOffset` describes how the host platform of the dependencies
-# relative to the depending package. It is brought into scope of the setup hook
-# defined as the role of the dependency whose hooks is being run.
-case $hostOffset in
-    -1) local role='BUILD_' ;;
-    0)  local role='' ;;
-    1)  local role='TARGET_' ;;
-    *)  echo "cc-wrapper: Error: Cannot be used with $hostOffset-offset deps" >2;
-        return 1 ;;
-esac
+# See pkgs/build-support/setup-hooks/role.bash
+getHostRole
 
 linkCxxAbi="@linkCxxAbi@"
-export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"