3
0
Fork 0
forked from mirrors/nixpkgs

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

@ -58,17 +58,56 @@ if test "$noSysDirs" = "1"; then
export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
done
if test -n "$targetConfig"; then
if test -z "$crossStageStatic"; then
extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include"
extraXLDFlags="-L${glibcCross}/lib"
export EXTRA_CFLAGS_TARGET=$extraXCFlags
for i in $extraXLDFlags; do
export EXTRA_LDFLAGS_TARGET="$EXTRA_LDFLAGS_TARGET -Wl,$i"
done
fi
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
LIMITS_H_TEST=true \
X_CFLAGS="$extraCflags $EXTRA_LDFLAGS" \
LDFLAGS="$extraCflags $EXTRA_LDFLAGS" \
LDFLAGS_FOR_TARGET="$extraCflags $EXTRA_LDFLAGS" \
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
if test -n "$targetConfig"; then
# The host strip will destroy some important details of the objects
dontStrip=1
fi
preConfigure() {
# Perform the build in a different directory.
@ -106,10 +145,12 @@ postInstall() {
}
if test -z "$targetConfig"; then
if test -z "$profiledCompiler"; then
buildFlags="bootstrap $buildFlags"
else
buildFlags="profiledbootstrap $buildFlags"
fi
fi
genericBuild

View file

@ -3,6 +3,7 @@
, langJava ? false
, profiledCompiler ? false
, staticCompiler ? false
, enableShared ? true
, texinfo ? null
, gmp, mpfr, gettext, which
, ppl ? null, cloogppl ? null # used by the Graphite optimization framework
@ -14,6 +15,10 @@
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, enableMultilib ? false
, name ? "gcc"
, cross ? null
, binutilsCross ? null
, glibcCross ? null
, crossStageStatic ? true
}:
assert langTreelang -> bison != null && flex != null;
@ -46,13 +51,33 @@ let version = "4.4.2";
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
# We need all these X libraries when building AWT with GTK+.
assert gtk != null -> (filter (x: x == null) xlibs) == [];
stdenv.mkDerivation ({
name = "${name}-${version}";
name = "${name}-${version}" + crossNameAddon;
builder = ./builder.sh;
@ -79,6 +104,7 @@ stdenv.mkDerivation ({
configureFlags = "
${if enableMultilib then "" else "--disable-multilib"}
${if enableShared then "" else "--disable-shared"}
${if ppl != null then "--with-ppl=${ppl}" else ""}
${if cloogppl != null then "--with-cloog=${cloogppl}" else ""}
${if langJava then "--with-ecj-jar=${javaEcj}" else ""}
@ -100,8 +126,16 @@ stdenv.mkDerivation ({
)
}
${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
# the library headers and binaries, regarless of the language being
# compiled.

View file

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

View file

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

View file

@ -1774,9 +1774,9 @@ let
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;
profiledCompiler = true;
}));
@ -1790,8 +1790,18 @@ let
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 {
gcc = forceBuildDrv ((gcc43_realCross cross).override {
gcc = forceBuildDrv ((gcc44_realCross cross).override {
crossStageStatic = true;
langCC = false;
glibcCross = null;
@ -1802,19 +1812,19 @@ let
};
gccCrossStageFinal = cross: wrapGCCCross {
gcc = forceBuildDrv (gcc43_realCross cross);
gcc = forceBuildDrv (gcc44_realCross cross);
libc = glibcCross cross;
binutils = binutilsCross 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);
profiledCompiler = false;
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
gettext which noSysDirs;
profiledCompiler = true;
@ -1855,7 +1865,7 @@ let
inherit gmp mpfr;
});
gfortran43 = wrapGCC (gcc43_real.gcc.override {
gfortran43 = wrapGCC (gcc43.gcc.override {
name = "gfortran";
langFortran = true;
langCC = false;
@ -3205,7 +3215,8 @@ let
};
cyrus_sasl = import ../development/libraries/cyrus-sasl {
inherit fetchurl stdenv openssl db4 gettext;
inherit fetchurl openssl db4 gettext;
stdenv = overrideGCC stdenv gcc43;
};
db4 = db45;
@ -3443,7 +3454,14 @@ let
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) {
inherit fetchurl stdenv kernelHeaders;
@ -8157,16 +8175,18 @@ let
kdelibs = import ../desktops/kde-3/kdelibs {
inherit
fetchurl stdenv xlibs zlib perl openssl pcre pkgconfig
fetchurl xlibs zlib perl openssl pcre pkgconfig
libjpeg libpng libtiff libxml2 libxslt libtool
expat freetype bzip2 cups attr acl;
stdenv = overrideGCC stdenv gcc43;
qt = qt3;
};
kdebase = import ../desktops/kde-3/kdebase {
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;
stdenv = overrideGCC stdenv gcc43;
qt = qt3;
};