From dd325103dfd192d36c707bc7269e50b1e3339e09 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 14 Jul 2006 11:59:38 +0000 Subject: [PATCH] * Better stdenv for Darwin: uses gcc, coreutils etc. built in Nix, but external binutils (i.e., Apple's cctools in /usr/bin). svn path=/nixpkgs/trunk/; revision=5706 --- .../native-darwin-cctools-wrapper/builder.sh | 4 ++++ .../native-darwin-cctools-wrapper/default.nix | 6 ++++++ pkgs/stdenv/default.nix | 11 +++++------ pkgs/stdenv/nix/default.nix | 10 +++++++--- pkgs/stdenv/nix/prehook.sh | 7 +++++++ 5 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 pkgs/build-support/native-darwin-cctools-wrapper/builder.sh create mode 100644 pkgs/build-support/native-darwin-cctools-wrapper/default.nix diff --git a/pkgs/build-support/native-darwin-cctools-wrapper/builder.sh b/pkgs/build-support/native-darwin-cctools-wrapper/builder.sh new file mode 100644 index 000000000000..583f4ef70f91 --- /dev/null +++ b/pkgs/build-support/native-darwin-cctools-wrapper/builder.sh @@ -0,0 +1,4 @@ +source $stdenv/setup + +ensureDir $out/bin +ln -s /usr/bin/ld /usr/bin/as /usr/bin/ar /usr/bin/ranlib /usr/bin/strip $out/bin diff --git a/pkgs/build-support/native-darwin-cctools-wrapper/default.nix b/pkgs/build-support/native-darwin-cctools-wrapper/default.nix new file mode 100644 index 000000000000..e4f0e3e1dd1e --- /dev/null +++ b/pkgs/build-support/native-darwin-cctools-wrapper/default.nix @@ -0,0 +1,6 @@ +{stdenv}: + +stdenv.mkDerivation { + name = "native-darwin-cctools-wrapper"; + builder = ./builder.sh; +} diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index ee41471d51c7..c84822003931 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -37,14 +37,13 @@ rec { # The Nix build environment. - stdenvNix = (import ./nix) { - stdenv = stdenvNative; + stdenvNix = (import ./nix) (rec { + stdenv = if system == "i686-darwin" then stdenvDarwin else stdenvNative; # !!! hack pkgs = allPackages { - bootStdenv = removeAttrs stdenvNative ["gcc"]; # Hack + bootStdenv = removeAttrs stdenv ["gcc"]; # Hack noSysDirs = false; }; - inherit genericStdenv; - }; + }); # Linux standard environment. @@ -81,6 +80,6 @@ rec { else if system == "i686-freebsd" then stdenvFreeBSD else if system == "i686-cygwin" then stdenvCygwin else if system == "powerpc-darwin" then stdenvDarwin - else if system == "i686-darwin" then stdenvDarwin + else if system == "i686-darwin" then stdenvNix else stdenvNative; } diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix index 34109e2dbc79..f8488615cee2 100644 --- a/pkgs/stdenv/nix/default.nix +++ b/pkgs/stdenv/nix/default.nix @@ -1,6 +1,6 @@ -{stdenv, pkgs, genericStdenv}: +{stdenv, pkgs}: -genericStdenv { +import ../generic { name = "stdenv-nix"; preHook = ./prehook.sh; initialPath = (import ../common-path.nix) {pkgs = pkgs;}; @@ -11,7 +11,11 @@ genericStdenv { nativeTools = false; nativeGlibc = true; inherit stdenv; - inherit (pkgs) binutils; + binutils = + if stdenv.system == "i686-darwin" || stdenv.system == "powerpc-darwin" then + import ../../build-support/native-darwin-cctools-wrapper {inherit stdenv;}; + else + pkgs.binutils; gcc = pkgs.gcc.gcc; shell = pkgs.bash ~ /bin/sh; }; diff --git a/pkgs/stdenv/nix/prehook.sh b/pkgs/stdenv/nix/prehook.sh index 734d0f1ae83a..35adc3745dcd 100644 --- a/pkgs/stdenv/nix/prehook.sh +++ b/pkgs/stdenv/nix/prehook.sh @@ -1,2 +1,9 @@ export NIX_ENFORCE_PURITY=1 export NIX_IGNORE_LD_THROUGH_GCC=1 + +if test "$system" = "i686-darwin" -o "$system" = "powerpc-darwin"; then + export NIX_DONT_SET_RPATH=1 + export NIX_NO_SELF_RPATH=1 + dontFixLibtool=1 + NIX_STRIP_DEBUG=0 # !!! do we still need this? +fi