Trying to get the gcc-4.4 cross-build also.

Fixing the glibc-2.10 expression on cross-builds (which should be ported to
the glibc-2.11 expression once we get "ports" there)

Making kde3 and cyrus-sasl use gcc-4.3, because the strictness in gcc-4.4 does
not allow them build.


svn path=/nixpkgs/branches/stdenv-updates/; revision=18706
This commit is contained in:
Lluís Batlle i Rossell 2009-11-29 23:27:35 +00:00
parent 6089b48c03
commit f4720cd5f9
5 changed files with 127 additions and 32 deletions

View File

@ -29,14 +29,14 @@ if test "$noSysDirs" = "1"; then
# SSIZE_MAX, which breaks the build). # SSIZE_MAX, which breaks the build).
export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include
# The path to the Glibc binaries such as `crti.o'. # The path to the Glibc binaries such as `crti.o'.
glibc_libdir="$(cat $NIX_GCC/nix-support/orig-libc)/lib" glibc_libdir="$(cat $NIX_GCC/nix-support/orig-libc)/lib"
else else
# Hack: support impure environments. # Hack: support impure environments.
extraCFlags="-isystem /usr/include" extraCFlags="-isystem /usr/include"
extraLDFlags="-L/usr/lib64 -L/usr/lib" extraLDFlags="-L/usr/lib64 -L/usr/lib"
glibc_libdir="/usr/lib" glibc_libdir="/usr/lib"
export NIX_FIXINC_DUMMY=/usr/include export NIX_FIXINC_DUMMY=/usr/include
fi fi
@ -58,17 +58,56 @@ if test "$noSysDirs" = "1"; then
export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i" export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
done done
makeFlagsArray=( \ if test -n "$targetConfig"; then
"${makeFlagsArray[@]}" \ if test -z "$crossStageStatic"; then
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include"
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \ extraXLDFlags="-L${glibcCross}/lib"
LIMITS_H_TEST=true \ export EXTRA_CFLAGS_TARGET=$extraXCFlags
X_CFLAGS="$extraCflags $EXTRA_LDFLAGS" \ for i in $extraXLDFlags; do
LDFLAGS="$extraCflags $EXTRA_LDFLAGS" \ export EXTRA_LDFLAGS_TARGET="$EXTRA_LDFLAGS_TARGET -Wl,$i"
LDFLAGS_FOR_TARGET="$extraCflags $EXTRA_LDFLAGS" \ done
) fi
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
CFLAGS_FOR_TARGET="$EXTRA_CFLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \
LDFLAGS_FOR_TARGET="$EXTRA_CFLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \
)
else
export EXTRA_CFLAGS_TARGET=$EXTRA_CFLAGS
export EXTRA_LDFLAGS_TARGET=$EXTRA_LDFLAGS
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
CFLAGS_FOR_BUILD="$extraCflags $EXTRA_CFLAGS $EXTRA_LDFLAGS" \
CFLAGS_FOR_TARGET="$EXTRA_CFLAGS $EXTRA_LDFLAGS" \
LDFLAGS_FOR_BUILD="$extraCflags $EXTRA_CFLAGS $EXTRA_LDFLAGS" \
LDFLAGS_FOR_TARGET="$EXTRA_CFLAGS $EXTRA_LDFLAGS" \
)
fi
if test -n "$targetConfig" -a "$crossStageStatic" == 1; then
# We don't want the gcc build to assume there will be a libc providing
# limits.h in this stagae
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
LIMITS_H_TEST=false \
)
else
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
LIMITS_H_TEST=true \
)
fi
fi fi
if test -n "$targetConfig"; then
# The host strip will destroy some important details of the objects
dontStrip=1
fi
preConfigure() { preConfigure() {
# Perform the build in a different directory. # Perform the build in a different directory.
@ -106,10 +145,12 @@ postInstall() {
} }
if test -z "$profiledCompiler"; then if test -z "$targetConfig"; then
buildFlags="bootstrap $buildFlags" if test -z "$profiledCompiler"; then
else buildFlags="bootstrap $buildFlags"
buildFlags="profiledbootstrap $buildFlags" else
buildFlags="profiledbootstrap $buildFlags"
fi
fi fi
genericBuild genericBuild

View File

@ -3,6 +3,7 @@
, langJava ? false , langJava ? false
, profiledCompiler ? false , profiledCompiler ? false
, staticCompiler ? false , staticCompiler ? false
, enableShared ? true
, texinfo ? null , texinfo ? null
, gmp, mpfr, gettext, which , gmp, mpfr, gettext, which
, ppl ? null, cloogppl ? null # used by the Graphite optimization framework , ppl ? null, cloogppl ? null # used by the Graphite optimization framework
@ -14,6 +15,10 @@
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null , libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, enableMultilib ? false , enableMultilib ? false
, name ? "gcc" , name ? "gcc"
, cross ? null
, binutilsCross ? null
, glibcCross ? null
, crossStageStatic ? true
}: }:
assert langTreelang -> bison != null && flex != null; assert langTreelang -> bison != null && flex != null;
@ -46,13 +51,33 @@ let version = "4.4.2";
javaAwtGtk = langJava && gtk != null; javaAwtGtk = langJava && gtk != null;
crossConfigureFlags =
"--target=${cross.config}" +
(if crossStageStatic then
" --disable-libssp --disable-nls" +
" --without-headers" +
" --disable-threads " +
" --disable-libmudflap " +
" --disable-libgomp " +
" --disable-shared"
else
" --with-headers=${glibcCross}/include" +
" --enable-__cxa_atexit" +
" --enable-long-long" +
" --enable-threads=posix" +
" --enable-nls"
);
stageNameAddon = if (crossStageStatic) then "-stage-static" else
"-stage-final";
crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else "";
in in
# We need all these X libraries when building AWT with GTK+. # We need all these X libraries when building AWT with GTK+.
assert gtk != null -> (filter (x: x == null) xlibs) == []; assert gtk != null -> (filter (x: x == null) xlibs) == [];
stdenv.mkDerivation ({ stdenv.mkDerivation ({
name = "${name}-${version}"; name = "${name}-${version}" + crossNameAddon;
builder = ./builder.sh; builder = ./builder.sh;
@ -79,6 +104,7 @@ stdenv.mkDerivation ({
configureFlags = " configureFlags = "
${if enableMultilib then "" else "--disable-multilib"} ${if enableMultilib then "" else "--disable-multilib"}
${if enableShared then "" else "--disable-shared"}
${if ppl != null then "--with-ppl=${ppl}" else ""} ${if ppl != null then "--with-ppl=${ppl}" else ""}
${if cloogppl != null then "--with-cloog=${cloogppl}" else ""} ${if cloogppl != null then "--with-cloog=${cloogppl}" else ""}
${if langJava then "--with-ecj-jar=${javaEcj}" else ""} ${if langJava then "--with-ecj-jar=${javaEcj}" else ""}
@ -100,8 +126,16 @@ stdenv.mkDerivation ({
) )
} }
${if stdenv.isi686 then "--with-arch=i686" else ""} ${if stdenv.isi686 then "--with-arch=i686" else ""}
${if cross != null then crossConfigureFlags else ""}
"; ";
targetConfig = if (cross != null) then cross.config else null;
# Needed for the cross compilation to work
AR = "ar";
LD = "ld";
CC = "gcc";
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
# the library headers and binaries, regarless of the language being # the library headers and binaries, regarless of the language being
# compiled. # compiled.

View File

@ -1,8 +1,8 @@
/* Build configuration used to build glibc, Info files, and locale /* Build configuration used to build glibc, Info files, and locale
information. */ information. */
{ name, fetchurl, stdenv, installLocales ? false cross : { name, fetchurl, stdenv, installLocales ? false
, cross ? null, gccCross ? null, kernelHeaders ? null , gccCross ? null, kernelHeaders ? null
, profilingLibraries ? false, meta, ... }@args : , profilingLibraries ? false, meta, ... }@args :
let version = "2.10.1"; let version = "2.10.1";

View File

@ -8,11 +8,11 @@ let
build = import ./common.nix; build = import ./common.nix;
cross = if gccCross != null then gccCross.target else null; cross = if gccCross != null then gccCross.target else null;
in in
build ({ build cross ({
name = "glibc"; name = "glibc";
inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
cross; gccCross;
builder = ./builder.sh; builder = ./builder.sh;

View File

@ -1774,9 +1774,9 @@ let
profiledCompiler = false; profiledCompiler = false;
}); });
gcc43 = useFromStdenv "gcc" gcc43_real; gcc44 = useFromStdenv "gcc" gcc44_real;
gcc43_real = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc-4.3) { gcc43 = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc-4.3) {
inherit stdenv fetchurl texinfo gmp mpfr noSysDirs; inherit stdenv fetchurl texinfo gmp mpfr noSysDirs;
profiledCompiler = true; profiledCompiler = true;
})); }));
@ -1790,8 +1790,18 @@ let
crossStageStatic = false; crossStageStatic = false;
}; };
gcc44_realCross = cross : makeOverridable (import ../development/compilers/gcc-4.4) {
inherit stdenv fetchurl texinfo gmp mpfr ppl cloogppl noSysDirs cross
gettext which;
binutilsCross = binutilsCross cross;
glibcCross = glibcCross cross;
profiledCompiler = false;
enableMultilib = true;
crossStageStatic = false;
};
gccCrossStageStatic = cross: wrapGCCCross { gccCrossStageStatic = cross: wrapGCCCross {
gcc = forceBuildDrv ((gcc43_realCross cross).override { gcc = forceBuildDrv ((gcc44_realCross cross).override {
crossStageStatic = true; crossStageStatic = true;
langCC = false; langCC = false;
glibcCross = null; glibcCross = null;
@ -1802,19 +1812,19 @@ let
}; };
gccCrossStageFinal = cross: wrapGCCCross { gccCrossStageFinal = cross: wrapGCCCross {
gcc = forceBuildDrv (gcc43_realCross cross); gcc = forceBuildDrv (gcc44_realCross cross);
libc = glibcCross cross; libc = glibcCross cross;
binutils = binutilsCross cross; binutils = binutilsCross cross;
inherit cross; inherit cross;
}; };
gcc43_multi = lowPrio (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi (gcc43_real.gcc.override { gcc43_multi = lowPrio (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi (gcc43.gcc.override {
stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc); stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc);
profiledCompiler = false; profiledCompiler = false;
enableMultilib = true; enableMultilib = true;
})); }));
gcc44 = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc-4.4) { gcc44_real = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc-4.4) {
inherit fetchurl stdenv texinfo gmp mpfr ppl cloogppl inherit fetchurl stdenv texinfo gmp mpfr ppl cloogppl
gettext which noSysDirs; gettext which noSysDirs;
profiledCompiler = true; profiledCompiler = true;
@ -1855,7 +1865,7 @@ let
inherit gmp mpfr; inherit gmp mpfr;
}); });
gfortran43 = wrapGCC (gcc43_real.gcc.override { gfortran43 = wrapGCC (gcc43.gcc.override {
name = "gfortran"; name = "gfortran";
langFortran = true; langFortran = true;
langCC = false; langCC = false;
@ -3205,7 +3215,8 @@ let
}; };
cyrus_sasl = import ../development/libraries/cyrus-sasl { cyrus_sasl = import ../development/libraries/cyrus-sasl {
inherit fetchurl stdenv openssl db4 gettext; inherit fetchurl openssl db4 gettext;
stdenv = overrideGCC stdenv gcc43;
}; };
db4 = db45; db4 = db45;
@ -3443,7 +3454,14 @@ let
installLocales = getPkgConfig "glibc" "locales" false; installLocales = getPkgConfig "glibc" "locales" false;
}); });
glibcCross = cross: glibc29Cross cross; glibc210Cross = cross: forceBuildDrv (makeOverridable (import ../development/libraries/glibc-2.10) {
inherit stdenv fetchurl;
gccCross = gccCrossStageStatic cross;
kernelHeaders = kernelHeadersCross cross;
installLocales = getPkgConfig "glibc" "locales" false;
});
glibcCross = cross: glibc210Cross cross;
glibc210 = makeOverridable (import ../development/libraries/glibc-2.10) { glibc210 = makeOverridable (import ../development/libraries/glibc-2.10) {
inherit fetchurl stdenv kernelHeaders; inherit fetchurl stdenv kernelHeaders;
@ -8157,16 +8175,18 @@ let
kdelibs = import ../desktops/kde-3/kdelibs { kdelibs = import ../desktops/kde-3/kdelibs {
inherit inherit
fetchurl stdenv xlibs zlib perl openssl pcre pkgconfig fetchurl xlibs zlib perl openssl pcre pkgconfig
libjpeg libpng libtiff libxml2 libxslt libtool libjpeg libpng libtiff libxml2 libxslt libtool
expat freetype bzip2 cups attr acl; expat freetype bzip2 cups attr acl;
stdenv = overrideGCC stdenv gcc43;
qt = qt3; qt = qt3;
}; };
kdebase = import ../desktops/kde-3/kdebase { kdebase = import ../desktops/kde-3/kdebase {
inherit inherit
fetchurl stdenv pkgconfig x11 xlibs zlib libpng libjpeg perl fetchurl pkgconfig x11 xlibs zlib libpng libjpeg perl
kdelibs openssl bzip2 fontconfig pam hal dbus glib; kdelibs openssl bzip2 fontconfig pam hal dbus glib;
stdenv = overrideGCC stdenv gcc43;
qt = qt3; qt = qt3;
}; };