summary refs log tree commit diff
path: root/pkgs/build-support/cc-wrapper/setup-hook.sh
diff options
context:
space:
mode:
authorEric Seidel <gridaphobe@gmail.com>2015-01-09 11:22:12 -0800
committerEric Seidel <gridaphobe@gmail.com>2015-01-14 20:26:56 -0800
commit48f63c2f2e3752df2a0b73cad9b9bba9eda8ac60 (patch)
tree6081b12a343a31bcc0dcf3f50b3a891f80d12bb1 /pkgs/build-support/cc-wrapper/setup-hook.sh
parente38c351f2b06f866537a3d584d1f9b95bdf25a0e (diff)
downloadnixlib-48f63c2f2e3752df2a0b73cad9b9bba9eda8ac60.tar
nixlib-48f63c2f2e3752df2a0b73cad9b9bba9eda8ac60.tar.gz
nixlib-48f63c2f2e3752df2a0b73cad9b9bba9eda8ac60.tar.bz2
nixlib-48f63c2f2e3752df2a0b73cad9b9bba9eda8ac60.tar.lz
nixlib-48f63c2f2e3752df2a0b73cad9b9bba9eda8ac60.tar.xz
nixlib-48f63c2f2e3752df2a0b73cad9b9bba9eda8ac60.tar.zst
nixlib-48f63c2f2e3752df2a0b73cad9b9bba9eda8ac60.zip
rename gcc-wrapper to cc-wrapper.
also makes cc-wrapper compatible with clang in the darwin fork.
Diffstat (limited to 'pkgs/build-support/cc-wrapper/setup-hook.sh')
-rw-r--r--pkgs/build-support/cc-wrapper/setup-hook.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh
new file mode 100644
index 000000000000..218899e9d8fc
--- /dev/null
+++ b/pkgs/build-support/cc-wrapper/setup-hook.sh
@@ -0,0 +1,38 @@
+export NIX_CC=@out@
+
+addCVars () {
+    if [ -d $1/include ]; then
+        export NIX_CFLAGS_COMPILE+=" -isystem $1/include"
+    fi
+
+    if [ -d $1/lib64 -a ! -L $1/lib64 ]; then
+        export NIX_LDFLAGS+=" -L$1/lib64"
+    fi
+
+    if [ -d $1/lib ]; then
+        export NIX_LDFLAGS+=" -L$1/lib"
+    fi
+}
+
+envHooks+=(addCVars)
+
+# Note: these come *after* $out in the PATH (see setup.sh).
+
+if [ -n "@cc@" ]; then
+    addToSearchPath PATH @cc@/bin
+fi
+
+if [ -n "@binutils@" ]; then
+    addToSearchPath PATH @binutils@/bin
+fi
+
+if [ -n "@libc@" ]; then
+    addToSearchPath PATH @libc@/bin
+fi
+
+if [ -n "@coreutils@" ]; then
+    addToSearchPath PATH @coreutils@/bin
+fi
+
+export CC=cc
+export CXX=c++