From aaccd6f6e2c4f1b27c6da0e44b80b32963ee6b6c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 27 Jun 2008 14:43:25 +0000 Subject: [PATCH] * Fix building the Fortran compiler. svn path=/nixpkgs/trunk/; revision=12201 --- pkgs/build-support/gcc-wrapper-new/builder.sh | 9 +- .../build-support/gcc-wrapper-new/default.nix | 2 +- .../development/compilers/gcc-4.3/default.nix | 23 ++--- .../development/compilers/gcc-4.3/fortran.nix | 73 ---------------- pkgs/development/compilers/gcc-4.3/fortran.sh | 86 ------------------- .../gcc-4.3/no-sys-dirs-fortran.patch | 15 ++++ .../tools/parsing/bison/bison-1.875d.nix | 14 --- pkgs/top-level/all-packages.nix | 1 + 8 files changed, 36 insertions(+), 187 deletions(-) delete mode 100644 pkgs/development/compilers/gcc-4.3/fortran.nix delete mode 100644 pkgs/development/compilers/gcc-4.3/fortran.sh create mode 100644 pkgs/development/compilers/gcc-4.3/no-sys-dirs-fortran.patch delete mode 100644 pkgs/development/tools/parsing/bison/bison-1.875d.nix diff --git a/pkgs/build-support/gcc-wrapper-new/builder.sh b/pkgs/build-support/gcc-wrapper-new/builder.sh index 9a28e305b39..b68f241728c 100644 --- a/pkgs/build-support/gcc-wrapper-new/builder.sh +++ b/pkgs/build-support/gcc-wrapper-new/builder.sh @@ -75,7 +75,7 @@ doSubstitute() { } -# Make wrapper scripts around gcc, g++, and g77. Also make symlinks +# Make wrapper scripts around gcc, g++, and gfortran. Also make symlinks # cc, c++, and f77. mkGccWrapper() { local dst=$1 @@ -97,8 +97,11 @@ ln -s gcc $out/bin/cc mkGccWrapper $out/bin/g++ $gccPath/g++ ln -s g++ $out/bin/c++ -mkGccWrapper $out/bin/g77 $gccPath/g77 -ln -s g77 $out/bin/f77 +if test -e $gccPath/gfortran; then + mkGccWrapper $out/bin/gfortran $gccPath/gfortran + ln -s gfortran $out/bin/g77 + ln -s gfortran $out/bin/f77 +fi # Create a symlink to as (the assembler). This is useful when a diff --git a/pkgs/build-support/gcc-wrapper-new/default.nix b/pkgs/build-support/gcc-wrapper-new/default.nix index 1cd84d77547..8d38db791f2 100644 --- a/pkgs/build-support/gcc-wrapper-new/default.nix +++ b/pkgs/build-support/gcc-wrapper-new/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation { name = if name == "" then gcc.name else name; langC = if nativeTools then true else gcc.langC; langCC = if nativeTools then true else gcc.langCC; - langF77 = if nativeTools then false else gcc.langF77; + langFortran = if nativeTools then false else gcc ? langFortran; shell = if shell == "" then stdenv.shell else shell; meta = if gcc != null && (gcc ? meta) then removeAttrs gcc.meta ["priority"] else diff --git a/pkgs/development/compilers/gcc-4.3/default.nix b/pkgs/development/compilers/gcc-4.3/default.nix index c4fa66500e1..003433cf65e 100644 --- a/pkgs/development/compilers/gcc-4.3/default.nix +++ b/pkgs/development/compilers/gcc-4.3/default.nix @@ -1,12 +1,14 @@ { stdenv, fetchurl, noSysDirs -, langC ? true, langCC ? true, langF77 ? false +, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false , profiledCompiler ? false , staticCompiler ? false , texinfo ? null , gmp, mpfr +, bison ? null, flex ? null }: assert langC; +assert langTreelang -> bison != null && flex != null; with import ../../../lib; @@ -25,28 +27,30 @@ stdenv.mkDerivation { url = "mirror://gnu/gcc/gcc-${version}/gcc-g++-${version}.tar.bz2"; sha256 = "0r74s60hylr8xrnb2j3x0dmf3cnxxg609g4h07r6ida8vk33bd25"; }) ++ - optional langF77 (fetchurl { + optional langFortran (fetchurl { url = "mirror://gnu/gcc/gcc-${version}/gcc-fortran-${version}.tar.bz2"; sha256 = "1fl76sajlz1ihnsmqsbs3i8g0h77w9hm35pwb1s2w6p4h5xy5dnb"; }); patches = [./pass-cxxcpp.patch] - ++ optional noSysDirs [./no-sys-dirs.patch]; + ++ optional noSysDirs ./no-sys-dirs.patch + ++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch; inherit noSysDirs profiledCompiler staticCompiler; - buildInputs = [texinfo gmp mpfr]; + buildInputs = [texinfo gmp mpfr] + ++ optionals langTreelang [bison flex]; configureFlags = " - --disable-multilib --disable-libstdcxx-pch --with-system-zlib --enable-languages=${ concatStrings (intersperse "," - ( optional langC "c" - ++ optional langCC "c++" - ++ optional langF77 "f77" + ( optional langC "c" + ++ optional langCC "c++" + ++ optional langFortran "fortran" + ++ optional langTreelang "treelang" ) ) } @@ -56,9 +60,8 @@ stdenv.mkDerivation { NIX_EXTRA_LDFLAGS = if staticCompiler then "-static" else ""; inherit gmp mpfr; - #X_CFLAGS = "-I${gmp}/include -I${mpfr}/include -L${gmp}/lib -L${mpfr}/lib"; - passthru = { inherit langC langCC langF77; }; + passthru = { inherit langC langCC langFortran langTreelang; }; meta = { homepage = "http://gcc.gnu.org/"; diff --git a/pkgs/development/compilers/gcc-4.3/fortran.nix b/pkgs/development/compilers/gcc-4.3/fortran.nix deleted file mode 100644 index 240737a21b3..00000000000 --- a/pkgs/development/compilers/gcc-4.3/fortran.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ 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.3/fortran.sh b/pkgs/development/compilers/gcc-4.3/fortran.sh deleted file mode 100644 index 962e8d37238..00000000000 --- a/pkgs/development/compilers/gcc-4.3/fortran.sh +++ /dev/null @@ -1,86 +0,0 @@ -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 diff --git a/pkgs/development/compilers/gcc-4.3/no-sys-dirs-fortran.patch b/pkgs/development/compilers/gcc-4.3/no-sys-dirs-fortran.patch new file mode 100644 index 00000000000..4568e57819b --- /dev/null +++ b/pkgs/development/compilers/gcc-4.3/no-sys-dirs-fortran.patch @@ -0,0 +1,15 @@ +diff -ru gcc-4.3.1-orig/libgfortran/configure gcc-4.3.1/libgfortran/configure +--- gcc-4.3.1-orig/libgfortran/configure 2008-06-06 16:49:11.000000000 +0200 ++++ gcc-4.3.1/libgfortran/configure 2008-06-27 08:25:08.000000000 +0200 +@@ -35405,6 +35405,11 @@ + # A language specific compiler. + CC=$lt_compiler + ++# Ugly hack to get libmudflap (and possibly other libraries) to build. ++# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag ++# to Glibc gets lost. Here we forcibly add it to any invocation. ++CC="\$CC $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" ++ + # Is the compiler the GNU compiler? + with_gcc=$GCC + diff --git a/pkgs/development/tools/parsing/bison/bison-1.875d.nix b/pkgs/development/tools/parsing/bison/bison-1.875d.nix deleted file mode 100644 index 4bdab887ba5..00000000000 --- a/pkgs/development/tools/parsing/bison/bison-1.875d.nix +++ /dev/null @@ -1,14 +0,0 @@ -{stdenv, fetchurl, m4}: - -assert m4 != null; - -stdenv.mkDerivation { - name = "bison-1.875d"; - src = fetchurl { - url = http://nix.cs.uu.nl/dist/tarballs/bison-1.875d.tar.gz; - md5 = "faaa4a271ca722fb6c769d72e18ade0b"; - }; - buildInputs = [m4]; -} // { - glrSupport = true; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e84e475931a..daabd8c91a6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1336,6 +1336,7 @@ let pkgs = rec { gcc43 = lowPrio (wrapGCCWith (import ../build-support/gcc-wrapper-new) (import ../development/compilers/gcc-4.3 { inherit fetchurl stdenv texinfo gmp mpfr noSysDirs; profiledCompiler = false; + #langFortran = true; })); gccApple = wrapGCC (import ../development/compilers/gcc-apple {