summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2008-04-01 16:54:05 +0000
committerMichael Raskin <7c6f434c@mail.ru>2008-04-01 16:54:05 +0000
commitbd9b19c180587a5c02d4085f442501a710e11a0a (patch)
tree0893b804d90f9576c34847b2694719bde8d3f232
parent9b67b4ba0f4498adf8d79635c966e0975f876950 (diff)
downloadnixpkgs-bd9b19c180587a5c02d4085f442501a710e11a0a.tar
nixpkgs-bd9b19c180587a5c02d4085f442501a710e11a0a.tar.gz
nixpkgs-bd9b19c180587a5c02d4085f442501a710e11a0a.tar.bz2
nixpkgs-bd9b19c180587a5c02d4085f442501a710e11a0a.tar.lz
nixpkgs-bd9b19c180587a5c02d4085f442501a710e11a0a.tar.xz
nixpkgs-bd9b19c180587a5c02d4085f442501a710e11a0a.tar.zst
nixpkgs-bd9b19c180587a5c02d4085f442501a710e11a0a.zip
GNU Fortran from GCC 4.2 works now
svn path=/nixpkgs/trunk/; revision=11442
-rw-r--r--pkgs/development/compilers/gcc-4.2/fortran.nix73
-rw-r--r--pkgs/development/compilers/gcc-4.2/fortran.sh86
2 files changed, 159 insertions, 0 deletions
diff --git a/pkgs/development/compilers/gcc-4.2/fortran.nix b/pkgs/development/compilers/gcc-4.2/fortran.nix
new file mode 100644
index 00000000000..240737a21b3
--- /dev/null
+++ b/pkgs/development/compilers/gcc-4.2/fortran.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchurl, noSysDirs
+, langC ? true, langCC ? true, langF77 ? false
+, profiledCompiler ? false
+, staticCompiler ? false
+, gmp ? null
+, mpfr ? null
+, texinfo ? null
+}:
+
+assert langC || langF77;
+
+with import ../../../lib;
+
+let version = "4.2.3"; in
+
+stdenv.mkDerivation {
+  name = "gcc-${version}";
+  builder = if langF77 then ./fortran.sh else  ./builder.sh;
+  
+  src =
+    optional /*langC*/ true (fetchurl {
+      url = "mirror://gnu/gcc/gcc-${version}/gcc-core-${version}.tar.bz2";
+      sha256 = "04y84s46wzy4h44hpacf7vyla7b5zfc1qvdq3myvrhp82cp0bv4r";
+    }) ++
+    optional langCC (fetchurl {
+      url = "mirror://gnu/gcc/gcc-${version}/gcc-g++-${version}.tar.bz2";
+      sha256 = "0spzz549fifwv02ym33azzwizl0zkq5m1fgy88ccmcyzmwpgyzfq";
+    }) ++
+    optional langF77 (fetchurl {
+      url = "mirror://gnu/gcc/gcc-${version}/gcc-fortran-${version}.tar.bz2";
+      sha256 = "1l3ww6qymrkcfqlssb41a5fdnh6w2hqk0v2ijx56jgjbdnzawyp0";
+    });
+    
+  patches =
+    optional noSysDirs [./no-sys-dirs.patch];
+    
+  inherit noSysDirs profiledCompiler staticCompiler;
+
+  buildInputs = [gmp mpfr texinfo];
+  
+  configureFlags = "
+    --disable-multilib
+    --disable-libstdcxx-pch
+    --with-system-zlib
+    --enable-languages=${
+      concatStrings (intersperse ","
+        (  optional langC   "c"
+        ++ optional langCC  "c++"
+        ++ optional langF77 "fortran"
+        )
+      )
+    }
+    ${if stdenv.isi686 then "--with-arch=i686" else ""}
+    ${if gmp != null then "--with-gmp=${gmp}" else ""}
+    ${if mpfr != null then "--with-mpfr=${mpfr}" else ""}
+  ";
+
+  makeFlags = if staticCompiler then "LDFLAGS=-static" else "";
+
+  passthru = { inherit langC langCC langF77; };
+
+  postInstall = "if test -f $out/bin/gfrotran; then ln -s $out/bin/gfortran $out/bin/g77; fi";
+
+  meta = {
+    homepage = "http://gcc.gnu.org/";
+    license = "GPL/LGPL";
+    description = "GNU Compiler Collection, 4.2.x";
+
+    # Give the real GCC a lower priority than the GCC wrapper so that
+    # both can be installed at the same time.
+    priority = "7";
+  };
+}
diff --git a/pkgs/development/compilers/gcc-4.2/fortran.sh b/pkgs/development/compilers/gcc-4.2/fortran.sh
new file mode 100644
index 00000000000..962e8d37238
--- /dev/null
+++ b/pkgs/development/compilers/gcc-4.2/fortran.sh
@@ -0,0 +1,86 @@
+source $stdenv/setup
+
+
+export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
+mkdir $NIX_FIXINC_DUMMY
+
+export X_CFLAGS="-I${gmp}/include -I${mpfr}/include -L${gmp}/lib -L${mpfr}/lib";
+
+# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
+# Thing.
+export CPP="gcc -E"
+
+
+if test "$noSysDirs" = "1"; then
+
+    if test -e $NIX_GCC/nix-support/orig-libc; then
+
+        # Figure out what extra flags to pass to the gcc compilers
+        # being generated to make sure that they use our glibc.
+        extraCFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
+        extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)"
+
+        # Use *real* header files, otherwise a limits.h is generated
+        # that does not include Glibc's limits.h (notably missing
+        # SSIZE_MAX, which breaks the build).
+        export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include
+        
+    else
+        # Hack: support impure environments.
+        extraCFlags="-isystem /usr/include"
+        extraLDFlags="-L/usr/lib64 -L/usr/lib"
+        export NIX_FIXINC_DUMMY=/usr/include
+    fi
+
+    extraCFlags="-g0 $extraCFlags"
+    extraLDFlags="--strip-debug $extraLDFlags"
+
+    export NIX_EXTRA_CFLAGS=$extraCFlags
+    for i in $extraLDFlags; do
+        export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
+    done
+
+    makeFlagsArray=( \
+        NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
+        SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
+        LIMITS_H_TEST=true \
+        X_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        LDFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        )
+fi
+
+
+preConfigure=preConfigure
+preConfigure() {
+    # Perform the build in a different directory.
+    mkdir ../build
+    cd ../build
+    configureScript=../$sourceRoot/configure
+}
+
+
+postInstall=postInstall
+postInstall() {
+    # Remove precompiled headers for now.  They are very big and
+    # probably not very useful yet.
+    find $out/include -name "*.gch" -exec rm -rf {} \; -prune
+
+    # Remove `fixincl' to prevent a retained dependency on the
+    # previous gcc.
+    rm -rf $out/libexec/gcc/*/*/install-tools
+
+    # Get rid of some "fixed" header files
+    rm -rf $out/lib/gcc/*/*/include/root
+}
+
+
+if test -z "$staticCompiler"; then
+    if test -z "$profiledCompiler"; then
+        buildFlags="bootstrap $buildFlags"
+    else    
+        buildFlags="profiledbootstrap $buildFlags"
+    fi
+fi
+
+genericBuild