[email protected] (Ludovic Courtès) skribis:

> It turns out that getting GCC 4.6 to build on Darwin wasn’t so
> difficult.  The patch below fixes that, by adding lipo(1) to stdenv.
> However, since it modifies stdenv, it entails a full rebuild.

Here’s an updated patch, along with the addition of GFortran for Darwin.

Ludo’.

This patch adds lipo(1) (and other commands) to `stdenv' on Darwin, which
allows GCC 4.6 to build.

Index: pkgs/build-support/native-darwin-cctools-wrapper/builder.sh
===================================================================
--- pkgs/build-support/native-darwin-cctools-wrapper/builder.sh	(revision 33620)
+++ pkgs/build-support/native-darwin-cctools-wrapper/builder.sh	(working copy)
@@ -1,6 +1,16 @@
 source $stdenv/setup
 
 mkdir -p $out/bin
-for i in ar as c++filt gprof ld nm nmedit ranlib size strings strip dsymutil libtool; do 
-    ln -s /usr/bin/$i $out/bin/
+for i in $binaries
+do 
+    ln -s "/usr/bin/$i" "$out/bin/"
 done
+
+# MIG assumes the standard Darwin core utilities (e.g., `rm -d'), so
+# let it see the impure directories.
+cat > "$out/bin/mig" <<EOF
+#!/bin/sh
+export PATH="/usr/bin:/bin:\$PATH"
+exec /usr/bin/mig "\$@"
+EOF
+chmod +x "$out/bin/mig"
Index: pkgs/build-support/native-darwin-cctools-wrapper/default.nix
===================================================================
--- pkgs/build-support/native-darwin-cctools-wrapper/default.nix	(revision 33620)
+++ pkgs/build-support/native-darwin-cctools-wrapper/default.nix	(working copy)
@@ -2,5 +2,14 @@
 
 stdenv.mkDerivation {
   name = "native-darwin-cctools-wrapper";
+
+  # Standard binaries normally found under /usr/bin (MIG is omitted here, and
+  # handled specially in ./builder.sh).
+  binaries =
+    [ "ar" "as" "c++filt" "gprof" "ld" "nm" "nmedit" "ranlib"
+      "size" "strings" "strip" "dsymutil" "libtool" "lipo"
+      "install_name_tool"
+    ];
+
   builder = ./builder.sh;
 }
Use the real GFortran on Darwin.

--- pkgs/top-level/all-packages.nix
+++ pkgs/top-level/all-packages.nix
@@ -1969,13 +1969,7 @@ let
     texinfo = texinfo49;
   });
 
-  gfortran =
-    if stdenv.isDarwin
-    then wrapGCC (gccApple.gcc.override {
-      langF77 = true;
-      inherit gmp mpfr bison flex;
-    })
-    else gfortran46;
+  gfortran = gfortran46;
 
   gfortran40 = wrapGCC (gcc40.gcc.override {
     langFortran = true;
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to