summary refs log tree commit diff
path: root/pkgs/stdenv
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
parent9f822e5477bc32b77af39b5bf8cf50b56b97c196 (diff)
downloadnixpkgs-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar
nixpkgs-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.gz
nixpkgs-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.bz2
nixpkgs-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.lz
nixpkgs-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.xz
nixpkgs-15103e5e5fb01556e9c5758ef99d7e7f5d0f7699.tar.zst
nixpkgs-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')
-rw-r--r--pkgs/stdenv/generic/builder.sh1
-rw-r--r--pkgs/stdenv/generic/default.nix5
-rw-r--r--pkgs/stdenv/generic/setup.sh53
3 files changed, 28 insertions, 31 deletions
diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh
index fd4c17ca251..fc41976b7d1 100644
--- a/pkgs/stdenv/generic/builder.sh
+++ b/pkgs/stdenv/generic/builder.sh
@@ -10,7 +10,6 @@ echo "$preHook" > $out/setup
 cat "$setup" >> $out/setup
 
 sed -e "s^@initialPath@^$initialPath^g" \
-    -e "s^@gcc@^$gcc^g" \
     -e "s^@shell@^$shell^g" \
     < $out/setup > $out/setup.tmp
 mv $out/setup.tmp $out/setup
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 28a3c1e9f3b..3d9cec05a35 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -33,6 +33,7 @@ let
     [ ../../build-support/setup-hooks/compress-man-pages.sh
       ../../build-support/setup-hooks/strip.sh
       ../../build-support/setup-hooks/patch-shebangs.sh
+      gcc
     ];
 
   # The stdenv that we are producing.
@@ -52,7 +53,7 @@ let
 
       setup = setupScript;
 
-      inherit preHook initialPath gcc shell;
+      inherit preHook initialPath shell;
 
       propagatedUserEnvPkgs = [gcc] ++
         lib.filter lib.isDerivation initialPath;
@@ -186,6 +187,8 @@ let
       inherit fetchurlBoot;
 
       inherit overrides;
+
+      inherit gcc;
     }
 
     # Propagate any extra attributes.  For instance, we use this to
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 72db7dc6004..675d8ce797d 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