Author: viric
Date: Sun Aug 1 21:21:26 2010
New Revision: 22848
URL: https://svn.nixos.org/websvn/nix/?rev=22848&sc=1
Log:
Trying to make gcc 4.5 cross-buildable
Modified:
nixpkgs/branches/stdenv-updates/pkgs/development/compilers/gcc-4.5/builder.sh
nixpkgs/branches/stdenv-updates/pkgs/development/compilers/gcc-4.5/default.nix
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/cloog-ppl/default.nix
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/gettext/default.nix
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/ppl/default.nix
nixpkgs/branches/stdenv-updates/pkgs/os-specific/linux/klibc/default.nix
nixpkgs/branches/stdenv-updates/pkgs/os-specific/linux/uclibc/default.nix
nixpkgs/branches/stdenv-updates/pkgs/top-level/all-packages.nix
Modified:
nixpkgs/branches/stdenv-updates/pkgs/development/compilers/gcc-4.5/builder.sh
==============================================================================
---
nixpkgs/branches/stdenv-updates/pkgs/development/compilers/gcc-4.5/builder.sh
Sun Aug 1 21:17:29 2010 (r22847)
+++
nixpkgs/branches/stdenv-updates/pkgs/development/compilers/gcc-4.5/builder.sh
Sun Aug 1 21:21:26 2010 (r22848)
@@ -54,11 +54,52 @@
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 @@
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=( \
"${makeflagsarr...@]}" \
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 @@
}
-if test -z "$targetConfig"; then
+if test -z "$targetConfig" && test -z "$crossConfig"; then
if test -z "$profiledCompiler"; then
buildFlags="bootstrap $buildFlags"
else
Modified:
nixpkgs/branches/stdenv-updates/pkgs/development/compilers/gcc-4.5/default.nix
==============================================================================
---
nixpkgs/branches/stdenv-updates/pkgs/development/compilers/gcc-4.5/default.nix
Sun Aug 1 21:17:29 2010 (r22847)
+++
nixpkgs/branches/stdenv-updates/pkgs/development/compilers/gcc-4.5/default.nix
Sun Aug 1 21:21:26 2010 (r22848)
@@ -169,8 +169,9 @@
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 @@
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";
Modified:
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/cloog-ppl/default.nix
==============================================================================
---
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/cloog-ppl/default.nix
Sun Aug 1 21:17:29 2010 (r22847)
+++
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/cloog-ppl/default.nix
Sun Aug 1 21:21:26 2010 (r22848)
@@ -12,6 +12,10 @@
configureFlags = "--with-ppl=${ppl}";
+ crossAttrs = {
+ configureFlags = "--with-ppl=${ppl.hostDrv}";
+ };
+
doCheck = true;
meta = {
Modified:
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/gettext/default.nix
==============================================================================
---
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/gettext/default.nix
Sun Aug 1 21:17:29 2010 (r22847)
+++
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/gettext/default.nix
Sun Aug 1 21:21:26 2010 (r22848)
@@ -26,6 +26,8 @@
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 = {
Modified:
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/ppl/default.nix
==============================================================================
--- nixpkgs/branches/stdenv-updates/pkgs/development/libraries/ppl/default.nix
Sun Aug 1 21:17:29 2010 (r22847)
+++ nixpkgs/branches/stdenv-updates/pkgs/development/libraries/ppl/default.nix
Sun Aug 1 21:21:26 2010 (r22848)
@@ -9,7 +9,7 @@
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
Modified:
nixpkgs/branches/stdenv-updates/pkgs/os-specific/linux/klibc/default.nix
==============================================================================
--- nixpkgs/branches/stdenv-updates/pkgs/os-specific/linux/klibc/default.nix
Sun Aug 1 21:17:29 2010 (r22847)
+++ nixpkgs/branches/stdenv-updates/pkgs/os-specific/linux/klibc/default.nix
Sun Aug 1 21:21:26 2010 (r22848)
@@ -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 @@
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 @@
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;
Modified:
nixpkgs/branches/stdenv-updates/pkgs/os-specific/linux/uclibc/default.nix
==============================================================================
--- nixpkgs/branches/stdenv-updates/pkgs/os-specific/linux/uclibc/default.nix
Sun Aug 1 21:17:29 2010 (r22847)
+++ nixpkgs/branches/stdenv-updates/pkgs/os-specific/linux/uclibc/default.nix
Sun Aug 1 21:21:26 2010 (r22848)
@@ -42,6 +42,10 @@
-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
Modified: nixpkgs/branches/stdenv-updates/pkgs/top-level/all-packages.nix
==============================================================================
--- nixpkgs/branches/stdenv-updates/pkgs/top-level/all-packages.nix Sun Aug
1 21:17:29 2010 (r22847)
+++ nixpkgs/branches/stdenv-updates/pkgs/top-level/all-packages.nix Sun Aug
1 21:21:26 2010 (r22848)
@@ -187,7 +187,7 @@
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 {
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits