summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc/libstdc++-hook.sh
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/development/compilers/gcc/libstdc++-hook.sh
parent34a3233a2e1e8ed2f005a3a86cfca02d5f2769ae (diff)
downloadnixlib-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar
nixlib-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.gz
nixlib-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.bz2
nixlib-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.lz
nixlib-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.xz
nixlib-2110c0bd3009279ceec291f07bfbf063cb5ba6a0.tar.zst
nixlib-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/development/compilers/gcc/libstdc++-hook.sh')
-rw-r--r--pkgs/development/compilers/gcc/libstdc++-hook.sh16
1 files changed, 4 insertions, 12 deletions
diff --git a/pkgs/development/compilers/gcc/libstdc++-hook.sh b/pkgs/development/compilers/gcc/libstdc++-hook.sh
index 2325eeb9e2cf..8b1d5d2da678 100644
--- a/pkgs/development/compilers/gcc/libstdc++-hook.sh
+++ b/pkgs/development/compilers/gcc/libstdc++-hook.sh
@@ -1,13 +1,5 @@
-# The `hostOffset` describes how the host platform of the dependencies are slid
-# 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
 
-export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)"
-export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libstdc++"
+export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)"
+export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libstdc++"