summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-03 17:52:11 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-03 17:55:03 -0400
commit39df5831cae0dce4628e80cf7f6f5520a9dae18e (patch)
treeb36300395928c7624a5c5f7258fdad85b8935a82
parentb45ef79b74d267891a11c1775a473c610ecebe78 (diff)
downloadnixpkgs-39df5831cae0dce4628e80cf7f6f5520a9dae18e.tar
nixpkgs-39df5831cae0dce4628e80cf7f6f5520a9dae18e.tar.gz
nixpkgs-39df5831cae0dce4628e80cf7f6f5520a9dae18e.tar.bz2
nixpkgs-39df5831cae0dce4628e80cf7f6f5520a9dae18e.tar.lz
nixpkgs-39df5831cae0dce4628e80cf7f6f5520a9dae18e.tar.xz
nixpkgs-39df5831cae0dce4628e80cf7f6f5520a9dae18e.tar.zst
nixpkgs-39df5831cae0dce4628e80cf7f6f5520a9dae18e.zip
lib{std,}c++: Fix setup hooks for cross
-rw-r--r--pkgs/development/compilers/gcc/libstdc++-hook.sh15
-rw-r--r--pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh15
-rw-r--r--pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh15
-rw-r--r--pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh15
-rw-r--r--pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh15
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/setup-hook.sh15
-rw-r--r--pkgs/development/compilers/llvm/5/libc++/setup-hook.sh15
-rw-r--r--pkgs/development/compilers/llvm/6/libc++/setup-hook.sh15
8 files changed, 104 insertions, 16 deletions
diff --git a/pkgs/development/compilers/gcc/libstdc++-hook.sh b/pkgs/development/compilers/gcc/libstdc++-hook.sh
index 893bbbc0c2d..2325eeb9e2c 100644
--- a/pkgs/development/compilers/gcc/libstdc++-hook.sh
+++ b/pkgs/development/compilers/gcc/libstdc++-hook.sh
@@ -1,2 +1,13 @@
-export NIX_CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/$(@gcc@/bin/gcc -dumpmachine)"
-export NIX_CXXSTDLIB_LINK=" -stdlib=libstdc++"
+# 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
+
+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++"
diff --git a/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh
index 9022fced6ec..e18733b5ea3 100644
--- a/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh
+++ b/pkgs/development/compilers/llvm/3.5/libc++/setup-hook.sh
@@ -1,3 +1,14 @@
+# 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
+
 linkCxxAbi="@linkCxxAbi@"
-export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh
index 9022fced6ec..e18733b5ea3 100644
--- a/pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh
+++ b/pkgs/development/compilers/llvm/3.7/libc++/setup-hook.sh
@@ -1,3 +1,14 @@
+# 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
+
 linkCxxAbi="@linkCxxAbi@"
-export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh
index 9022fced6ec..bcd93cf486f 100644
--- a/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh
+++ b/pkgs/development/compilers/llvm/3.8/libc++/setup-hook.sh
@@ -1,3 +1,14 @@
+# 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
+
 linkCxxAbi="@linkCxxAbi@"
-export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh
index 9022fced6ec..bcd93cf486f 100644
--- a/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh
+++ b/pkgs/development/compilers/llvm/3.9/libc++/setup-hook.sh
@@ -1,3 +1,14 @@
+# 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
+
 linkCxxAbi="@linkCxxAbi@"
-export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh
index 9022fced6ec..bcd93cf486f 100644
--- a/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh
+++ b/pkgs/development/compilers/llvm/4/libc++/setup-hook.sh
@@ -1,3 +1,14 @@
+# 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
+
 linkCxxAbi="@linkCxxAbi@"
-export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh
index 9022fced6ec..bcd93cf486f 100644
--- a/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh
+++ b/pkgs/development/compilers/llvm/5/libc++/setup-hook.sh
@@ -1,3 +1,14 @@
+# 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
+
 linkCxxAbi="@linkCxxAbi@"
-export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh
index 9022fced6ec..bcd93cf486f 100644
--- a/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh
+++ b/pkgs/development/compilers/llvm/6/libc++/setup-hook.sh
@@ -1,3 +1,14 @@
+# 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
+
 linkCxxAbi="@linkCxxAbi@"
-export NIX_CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
-export NIX_CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
+export NIX_${role}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"