summary refs log tree commit diff
path: root/pkgs/stdenv/generic/setup.sh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-01 16:17:23 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-09 12:44:50 +0200
commit15103e5e5fb01556e9c5758ef99d7e7f5d0f7699 (patch)
tree60703d89736b62590f620995e4bca23315104e75 /pkgs/stdenv/generic/setup.sh
parent9f822e5477bc32b77af39b5bf8cf50b56b97c196 (diff)
downloadnixlib-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar
nixlib-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.gz
nixlib-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.bz2
nixlib-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.lz
nixlib-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.xz
nixlib-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.zst
nixlib-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.zip
stdenv: Remove the special handling of gcc
Now gcc is just another build input, making it possible in the future
to have a stdenv that doesn't depend on a C compiler. This is very
useful on NixOS, since it would allow trivial builders like
writeTextFile to work without pulling in the C compiler.
Diffstat (limited to 'pkgs/stdenv/generic/setup.sh')
-rw-r--r--pkgs/stdenv/generic/setup.sh53
1 files changed, 24 insertions, 29 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 72db7dc6004f..675d8ce797d1 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -1,3 +1,5 @@
+set -e
+
 : ${outputs:=out}
 
 
@@ -115,7 +117,7 @@ trap "exitHandler" EXIT
 
 
 ######################################################################
-# Helper functions that might be useful in setup hooks.
+# Helper functions.
 
 
 addToSearchPathWithCustomDelimiter() {
@@ -134,12 +136,23 @@ addToSearchPath() {
 }
 
 
-######################################################################
-# Initialisation.
+ensureDir() {
+    echo "warning: ‘ensureDir’ is deprecated; use ‘mkdir’ instead" >&2
+    local dir
+    for dir in "$@"; do
+        if ! [ -x "$dir" ]; then mkdir -p "$dir"; fi
+    done
+}
+
+
+installBin() {
+    mkdir -p $out/bin
+    cp "$@" $out/bin
+}
 
-set -e
 
-[ -z $NIX_GCC ] && NIX_GCC=@gcc@
+######################################################################
+# Initialisation.
 
 
 # Wildcard expansions that don't match should expand to an empty list.
@@ -150,7 +163,7 @@ shopt -s nullglob
 
 # Set up the initial path.
 PATH=
-for i in $NIX_GCC @initialPath@; do
+for i in @initialPath@; do
     if [ "$i" = / ]; then i=; fi
     addToSearchPath PATH $i/bin
     addToSearchPath PATH $i/sbin
@@ -171,27 +184,9 @@ runHook preHook
 # Check that the pre-hook initialised SHELL.
 if [ -z "$SHELL" ]; then echo "SHELL not set"; exit 1; fi
 
-# Hack: run gcc's setup hook.
+
 envHooks=()
 crossEnvHooks=()
-if [ -f $NIX_GCC/nix-support/setup-hook ]; then
-    source $NIX_GCC/nix-support/setup-hook
-fi
-
-
-# Ensure that the given directories exists.
-ensureDir() {
-    echo "warning: ‘ensureDir’ is deprecated; use ‘mkdir’ instead" >&2
-    local dir
-    for dir in "$@"; do
-        if ! [ -x "$dir" ]; then mkdir -p "$dir"; fi
-    done
-}
-
-installBin() {
-    mkdir -p $out/bin
-    cp "$@" $out/bin
-}
 
 
 # Allow the caller to augment buildInputs (it's not always possible to
@@ -242,7 +237,7 @@ done
 
 # Set the relevant environment variables to point to the build inputs
 # found above.
-addToNativeEnv() {
+_addToNativeEnv() {
     local pkg=$1
 
     if [ -d $1/bin ]; then
@@ -256,10 +251,10 @@ addToNativeEnv() {
 }
 
 for i in $nativePkgs; do
-    addToNativeEnv $i
+    _addToNativeEnv $i
 done
 
-addToCrossEnv() {
+_addToCrossEnv() {
     local pkg=$1
 
     # Some programs put important build scripts (freetype-config and similar)
@@ -276,7 +271,7 @@ addToCrossEnv() {
 }
 
 for i in $crossPkgs; do
-    addToCrossEnv $i
+    _addToCrossEnv $i
 done