···55# stdenv.mkDerivation provides a wrapper that sets up the right environment
66# variables so that the compiler and the linker just "work".
7788-{ name ? "gcc-wrapper", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
88+{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
99, gcc ? null, libc ? null, binutils ? null, shell ? ""
1010}:
1111···1313assert !nativeTools -> gcc != null && binutils != null;
1414assert !nativeLibc -> libc != null;
15151616-let gccVersion = (builtins.parseDrvName gcc.name).version; in
1616+let
1717+1818+ gccVersion = (builtins.parseDrvName gcc.name).version;
1919+ gccName = (builtins.parseDrvName gcc.name).name;
2020+2121+in
17221823stdenv.mkDerivation {
1919- name = name + (if gcc != null && gccVersion != "" then "-" + gccVersion else "");
2424+ name =
2525+ (if name != "" then name else gccName + "-wrapper") +
2626+ (if gcc != null && gccVersion != "" then "-" + gccVersion else "");
20272128 builder = ./builder.sh;
2229 setupHook = ./setup-hook.sh;
+1-1
pkgs/development/compilers/gcc-3.3/builder.sh
···2626 if test -n "$langCC"; then
2727 langs="$langs,c++"
2828 fi
2929- if test -n "$langF77"; then
2929+ if test -n "$langFortran"; then
3030 langs="$langs,f77"
3131 fi
3232
···11-source $stdenv/setup
22-33-44-export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
55-mkdir $NIX_FIXINC_DUMMY
66-77-export X_CFLAGS="-I${gmp}/include -I${mpfr}/include -L${gmp}/lib -L${mpfr}/lib";
88-99-# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
1010-# Thing.
1111-export CPP="gcc -E"
1212-1313-1414-if test "$noSysDirs" = "1"; then
1515-1616- if test -e $NIX_GCC/nix-support/orig-libc; then
1717-1818- # Figure out what extra flags to pass to the gcc compilers
1919- # being generated to make sure that they use our glibc.
2020- extraCFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
2121- extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)"
2222-2323- # Use *real* header files, otherwise a limits.h is generated
2424- # that does not include Glibc's limits.h (notably missing
2525- # SSIZE_MAX, which breaks the build).
2626- export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include
2727-2828- else
2929- # Hack: support impure environments.
3030- extraCFlags="-isystem /usr/include"
3131- extraLDFlags="-L/usr/lib64 -L/usr/lib"
3232- export NIX_FIXINC_DUMMY=/usr/include
3333- fi
3434-3535- extraCFlags="-g0 $extraCFlags"
3636- extraLDFlags="--strip-debug $extraLDFlags"
3737-3838- export NIX_EXTRA_CFLAGS=$extraCFlags
3939- for i in $extraLDFlags; do
4040- export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
4141- done
4242-4343- makeFlagsArray=( \
4444- NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
4545- SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
4646- LIMITS_H_TEST=true \
4747- X_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
4848- LDFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
4949- LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
5050- )
5151-fi
5252-5353-5454-preConfigure=preConfigure
5555-preConfigure() {
5656- # Perform the build in a different directory.
5757- mkdir ../build
5858- cd ../build
5959- configureScript=../$sourceRoot/configure
6060-}
6161-6262-6363-postInstall=postInstall
6464-postInstall() {
6565- # Remove precompiled headers for now. They are very big and
6666- # probably not very useful yet.
6767- find $out/include -name "*.gch" -exec rm -rf {} \; -prune
6868-6969- # Remove `fixincl' to prevent a retained dependency on the
7070- # previous gcc.
7171- rm -rf $out/libexec/gcc/*/*/install-tools
7272-7373- # Get rid of some "fixed" header files
7474- rm -rf $out/lib/gcc/*/*/include/root
7575-}
7676-7777-7878-if test -z "$staticCompiler"; then
7979- if test -z "$profiledCompiler"; then
8080- buildFlags="bootstrap $buildFlags"
8181- else
8282- buildFlags="profiledbootstrap $buildFlags"
8383- fi
8484-fi
8585-8686-genericBuild
···11-source $stdenv/setup
22-33-44-export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
55-mkdir $NIX_FIXINC_DUMMY
66-77-export X_CFLAGS="-I${gmp}/include -I${mpfr}/include -L${gmp}/lib -L${mpfr}/lib";
88-99-# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
1010-# Thing.
1111-export CPP="gcc -E"
1212-1313-1414-if test "$noSysDirs" = "1"; then
1515-1616- if test -e $NIX_GCC/nix-support/orig-libc; then
1717-1818- # Figure out what extra flags to pass to the gcc compilers
1919- # being generated to make sure that they use our glibc.
2020- extraCFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
2121- extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)"
2222-2323- # Use *real* header files, otherwise a limits.h is generated
2424- # that does not include Glibc's limits.h (notably missing
2525- # SSIZE_MAX, which breaks the build).
2626- export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include
2727-2828- else
2929- # Hack: support impure environments.
3030- extraCFlags="-isystem /usr/include"
3131- extraLDFlags="-L/usr/lib64 -L/usr/lib"
3232- export NIX_FIXINC_DUMMY=/usr/include
3333- fi
3434-3535- extraCFlags="-g0 $extraCFlags"
3636- extraLDFlags="--strip-debug $extraLDFlags"
3737-3838- export NIX_EXTRA_CFLAGS=$extraCFlags
3939- for i in $extraLDFlags; do
4040- export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
4141- done
4242-4343- makeFlagsArray=( \
4444- NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
4545- SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
4646- LIMITS_H_TEST=true \
4747- X_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
4848- LDFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
4949- LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
5050- )
5151-fi
5252-5353-5454-preConfigure=preConfigure
5555-preConfigure() {
5656- # Perform the build in a different directory.
5757- mkdir ../build
5858- cd ../build
5959- configureScript=../$sourceRoot/configure
6060-}
6161-6262-6363-postInstall=postInstall
6464-postInstall() {
6565- # Remove precompiled headers for now. They are very big and
6666- # probably not very useful yet.
6767- find $out/include -name "*.gch" -exec rm -rf {} \; -prune
6868-6969- # Remove `fixincl' to prevent a retained dependency on the
7070- # previous gcc.
7171- rm -rf $out/libexec/gcc/*/*/install-tools
7272-7373- # Get rid of some "fixed" header files
7474- rm -rf $out/lib/gcc/*/*/include/root
7575-}
7676-7777-7878-if test -z "$staticCompiler"; then
7979- if test -z "$profiledCompiler"; then
8080- buildFlags="bootstrap $buildFlags"
8181- else
8282- buildFlags="profiledbootstrap $buildFlags"
8383- fi
8484-fi
8585-8686-genericBuild