forked from mirrors/nixpkgs
Trying to make gcc 4.5 cross-buildable
svn path=/nixpkgs/branches/stdenv-updates/; revision=22848
This commit is contained in:
parent
2954596106
commit
da3ba13fb5
|
@ -54,11 +54,52 @@ if test "$noSysDirs" = "1"; then
|
|||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
|
||||
done
|
||||
|
||||
if test -z "$targetConfig"; then
|
||||
EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS"
|
||||
EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
|
||||
if test -n "$targetConfig"; then
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build
|
||||
# the g++ compiler (after the specs for the cross-gcc are created).
|
||||
# Having LIBRARY_PATH= makes gcc read the specs from ., and the build
|
||||
# breaks. Having this variable comes from the default.nix code to bring
|
||||
# gcj in.
|
||||
unset LIBRARY_PATH
|
||||
unset CPATH
|
||||
if test -z "$crossStageStatic"; then
|
||||
EXTRA_TARGET_CFLAGS="-g0 -O2 -B${libcCross}/lib -idirafter ${libcCross}/include"
|
||||
EXTRA_TARGET_LDFLAGS="-Wl,-L${libcCross}/lib"
|
||||
fi
|
||||
else
|
||||
if test -z "$NIX_GCC_CROSS"; then
|
||||
EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS"
|
||||
EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
|
||||
else
|
||||
# This the case of cross-building the gcc.
|
||||
# We need special flags for the target, different than those of the build
|
||||
# Assertion:
|
||||
test -e $NIX_GCC_CROSS/nix-support/orig-libc
|
||||
|
||||
# Figure out what extra flags to pass to the gcc compilers
|
||||
# being generated to make sure that they use our glibc.
|
||||
extraFlags="$(cat $NIX_GCC_CROSS/nix-support/libc-cflags)"
|
||||
extraLDFlags="$(cat $NIX_GCC_CROSS/nix-support/libc-ldflags) $(cat $NIX_GCC_CROSS/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).
|
||||
NIX_FIXINC_DUMMY_CROSS=$(cat $NIX_GCC_CROSS/nix-support/orig-libc)/include
|
||||
|
||||
# The path to the Glibc binaries such as `crti.o'.
|
||||
glibc_libdir="$(cat $NIX_GCC_CROSS/nix-support/orig-libc)/lib"
|
||||
|
||||
extraFlags="-g0 -O2 -I$NIX_FIXINC_DUMMY_CROSS $extraFlags"
|
||||
extraLDFlags="--strip-debug -L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
|
||||
|
||||
EXTRA_TARGET_CFLAGS="$extraFlags"
|
||||
for i in $extraLDFlags; do
|
||||
EXTRA_TARGET_LDFLAGS="$EXTRA_TARGET_LDFLAGS -Wl,$i"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
|
||||
# the startfiles.
|
||||
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
|
||||
|
@ -68,17 +109,17 @@ if test "$noSysDirs" = "1"; then
|
|||
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||
CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||
CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS" \
|
||||
CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||
FLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||
LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||
LDFLAGS_FOR_TARGET="$EXTRA_TARGET_LDFLAGS" \
|
||||
LDFLAGS_FOR_TARGET="$EXTRA_TARGET_LDFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||
)
|
||||
|
||||
if test -z "$targetConfig"; then
|
||||
makeFlagsArray=( \
|
||||
"${makeFlagsArray[@]}" \
|
||||
BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||
BOOT_LDFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||
BOOT_LDFLAGS="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||
)
|
||||
fi
|
||||
|
||||
|
@ -161,7 +202,7 @@ postInstall() {
|
|||
}
|
||||
|
||||
|
||||
if test -z "$targetConfig"; then
|
||||
if test -z "$targetConfig" && test -z "$crossConfig"; then
|
||||
if test -z "$profiledCompiler"; then
|
||||
buildFlags="bootstrap $buildFlags"
|
||||
else
|
||||
|
|
|
@ -169,8 +169,9 @@ stdenv.mkDerivation ({
|
|||
inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic
|
||||
libcCross crossMingw;
|
||||
|
||||
buildInputs = [ texinfo gmp mpfr mpc libelf gettext which ]
|
||||
++ (optional (perl != null) perl)
|
||||
buildNativeInputs = [ texinfo which ]
|
||||
++ optional (perl != null) perl;
|
||||
buildInputs = [ gmp mpfr mpc libelf gettext ]
|
||||
++ (optional (ppl != null) ppl)
|
||||
++ (optional (cloogppl != null) cloogppl)
|
||||
++ (optionals langTreelang [bison flex])
|
||||
|
@ -225,6 +226,51 @@ stdenv.mkDerivation ({
|
|||
|
||||
targetConfig = if (cross != null) then cross.config else null;
|
||||
|
||||
crossAttrs = {
|
||||
AR = "${stdenv.cross.config}-ar";
|
||||
LD = "${stdenv.cross.config}-ld";
|
||||
CC = "${stdenv.cross.config}-gcc";
|
||||
CXX = "${stdenv.cross.config}-gcc";
|
||||
AR_FOR_TARGET = "${stdenv.cross.config}-ar";
|
||||
LD_FOR_TARGET = "${stdenv.cross.config}-ld";
|
||||
CC_FOR_TARGET = "${stdenv.cross.config}-gcc";
|
||||
NM_FOR_TARGET = "${stdenv.cross.config}-nm";
|
||||
CXX_FOR_TARGET = "${stdenv.cross.config}-g++";
|
||||
# If we are making a cross compiler, cross != null
|
||||
NIX_GCC_CROSS = if cross == null then "${stdenv.gccCross}" else "";
|
||||
configureFlags = "
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
${if enableShared then "" else "--disable-shared"}
|
||||
${if ppl != null then "--with-ppl=${ppl.hostDrv}" else ""}
|
||||
${if cloogppl != null then "--with-cloog=${cloogppl.hostDrv}" else ""}
|
||||
${if langJava then "--with-ecj-jar=${javaEcj.hostDrv}" else ""}
|
||||
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
||||
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.hostDrv}" else ""}
|
||||
--with-gmp=${gmp.hostDrv}
|
||||
--with-mpfr=${mpfr.hostDrv}
|
||||
--disable-libstdcxx-pch
|
||||
--without-included-gettext
|
||||
--with-system-zlib
|
||||
--enable-languages=${
|
||||
concatStrings (intersperse ","
|
||||
( optional langC "c"
|
||||
++ optional langCC "c++"
|
||||
++ optional langFortran "fortran"
|
||||
++ optional langJava "java"
|
||||
++ optional langTreelang "treelang"
|
||||
++ optional langAda "ada"
|
||||
++ optional langVhdl "vhdl"
|
||||
)
|
||||
)
|
||||
}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
--target=${stdenv.cross.config}
|
||||
";
|
||||
};
|
||||
|
||||
|
||||
# Needed for the cross compilation to work
|
||||
AR = "ar";
|
||||
LD = "ld";
|
||||
|
|
|
@ -12,6 +12,10 @@ stdenv.mkDerivation rec {
|
|||
|
||||
configureFlags = "--with-ppl=${ppl}";
|
||||
|
||||
crossAttrs = {
|
||||
configureFlags = "--with-ppl=${ppl.hostDrv}";
|
||||
};
|
||||
|
||||
doCheck = true;
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -26,6 +26,8 @@ stdenv.mkDerivation (rec {
|
|||
crossAttrs = {
|
||||
buildInputs = stdenv.lib.optional (stdenv.gccCross.libc ? libiconv)
|
||||
stdenv.gccCross.libc.libiconv.hostDrv;
|
||||
# Gettext fails to guess the cross compiler
|
||||
configureFlags = "CXX=${stdenv.cross.config}-g++";
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -9,7 +9,7 @@ let version = "0.10.2"; in
|
|||
sha256 = "0lly44sac4jd72klnhhil3wha15vak76r6gy88sh0zjsaww9hf6h";
|
||||
};
|
||||
|
||||
buildInputs = [ perl gnum4 ];
|
||||
buildNativeInputs = [ perl gnum4 ];
|
||||
propagatedBuildInputs = [ gmpxx ];
|
||||
|
||||
# Beware! It took ~6 hours to compile PPL and run its tests on a 1.2 GHz
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
assert stdenv.isLinux;
|
||||
|
||||
let
|
||||
version = "1.5.15";
|
||||
version = "1.5.18";
|
||||
baseMakeFlags = ["V=1" "prefix=$out" "SHLIBDIR=$out/lib"];
|
||||
in
|
||||
|
||||
|
@ -11,8 +11,8 @@ stdenv.mkDerivation {
|
|||
name = "klibc-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://kernel/linux/libs/klibc/klibc-${version}.tar.bz2";
|
||||
sha256 = "1x401wmjca6zkyikf9xz45b3wb1hnj0m2s9in1sg6xdhi3pk8lwb";
|
||||
url = "mirror://kernel/linux/libs/klibc/1.5/klibc-${version}.tar.bz2";
|
||||
sha256 = "0ik4ddkfzjrrhpb50i31f2zihqlcnm82yqnl5ci59wx56j5ly474";
|
||||
};
|
||||
|
||||
makeFlags = baseMakeFlags;
|
||||
|
@ -20,17 +20,14 @@ stdenv.mkDerivation {
|
|||
inherit linuxHeaders;
|
||||
|
||||
crossAttrs = {
|
||||
name = "klibc-1.5.17";
|
||||
src = fetchurl {
|
||||
url = "mirror://kernel/linux/libs/klibc/Testing/klibc-1.5.17.tar.bz2";
|
||||
sha256 = "1jmiszf9pdlzj9f72nkv50d7aqrzz12hrmw792xnd2lmn5nrfyx6";
|
||||
};
|
||||
|
||||
makeFlags = baseMakeFlags ++ [ "CROSS_COMPILE=${stdenv.cross.config}-"
|
||||
"KLIBCARCH=${stdenv.cross.arch}" ];
|
||||
|
||||
patchPhase = ''
|
||||
sed -i 's/-fno-pic -mno-abicalls/& -mabi=32/' usr/klibc/arch/mips/MCONFIG
|
||||
sed -i /KLIBCKERNELSRC/d scripts/Kbuild.install
|
||||
# Wrong check for __mips64 in klibc
|
||||
sed -i s/__mips64__/__mips64/ usr/include/fcntl.h
|
||||
'';
|
||||
|
||||
linuxHeaders = linuxHeadersCross;
|
||||
|
|
|
@ -42,6 +42,10 @@ stdenv.mkDerivation {
|
|||
-e 's@.*UCLIBC_HAS_RPC.*@UCLIBC_HAS_RPC=y@' \
|
||||
-e 's@.*DO_C99_MATH.*@DO_C99_MATH=y@' \
|
||||
-e 's@.*UCLIBC_HAS_PROGRAM_INVOCATION_NAME.*@UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y@' \
|
||||
-e 's@.*CONFIG_MIPS_ISA_1.*@#CONFIG_MIPS_ISA_1=y@' \
|
||||
-e 's@.*CONFIG_MIPS_ISA_3.*@CONFIG_MIPS_ISA_3=y@' \
|
||||
-e 's@.*CONFIG_MIPS_O32_ABI.*@#CONFIG_MIPS_O32_ABI=y@' \
|
||||
-e 's@.*CONFIG_MIPS_N32_ABI.*@CONFIG_MIPS_N32_ABI=y@' \
|
||||
${configArmEABI} \
|
||||
${configBigEndian} \
|
||||
-i .config
|
||||
|
|
|
@ -187,7 +187,7 @@ let
|
|||
gccCrossStageFinal;
|
||||
|
||||
stdenv =
|
||||
if bootStdenv != null then bootStdenv else
|
||||
if bootStdenv != null then (bootStdenv // {inherit platform;}) else
|
||||
let changer = getConfig ["replaceStdenv"] null;
|
||||
in if changer != null then
|
||||
changer {
|
||||
|
|
Loading…
Reference in a new issue