mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
First attempt for the full stdenvCross. I think that it should work. The
toolchain for arm built. svn path=/nixpkgs/branches/stdenv-updates/; revision=18355
This commit is contained in:
parent
2412034611
commit
307cbd7b3b
6 changed files with 59 additions and 19 deletions
|
@ -31,6 +31,7 @@ if test "$noSysDirs" = "1"; then
|
|||
export NIX_FIXINC_DUMMY=/usr/include
|
||||
fi
|
||||
|
||||
|
||||
extraCFlags="-g0 -I$gmp/include -I$mpfr/include $extraCFlags"
|
||||
extraLDFlags="--strip-debug $extraLDFlags"
|
||||
|
||||
|
@ -39,14 +40,37 @@ if test "$noSysDirs" = "1"; then
|
|||
export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
|
||||
done
|
||||
|
||||
set -x
|
||||
if test -n "$cross"; then
|
||||
if test -z "$crossStageStatic"; then
|
||||
extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include"
|
||||
extraXLDFlags="-L${glibcCross}/lib"
|
||||
export NIX_EXTRA_CFLAGS_TARGET=$extraXCFlags
|
||||
for i in $extraXLDFlags; do
|
||||
export NIX_EXTRA_LDFLAGS_TARGET="$NIX_EXTRA_LDFLAGS_TARGET -Wl,$i"
|
||||
done
|
||||
fi
|
||||
|
||||
makeFlagsArray=( \
|
||||
"${makeFlagsArray[@]}" \
|
||||
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||
X_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
||||
LDFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
||||
LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
||||
CFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \
|
||||
LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \
|
||||
)
|
||||
else
|
||||
export NIX_EXTRA_CFLAGS_TARGET=$NIX_EXTRA_CFLAGS
|
||||
export NIX_EXTRA_LDFLAGS_TARGET=$NIX_EXTRA_LDFLAGS
|
||||
makeFlagsArray=( \
|
||||
"${makeFlagsArray[@]}" \
|
||||
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||
CFLAGS_FOR_BUILD="$NIX_EXTRA_X_CFLAGS $NIX_EXTRA_X_LDFLAGS" \
|
||||
CFLAGS_FOR_TARGET="$NIX_EXTRA_X_CFLAGS $NIX_EXTRA_X_LDFLAGS" \
|
||||
LDFLAGS_FOR_BUILD="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
||||
LDFLAGS_FOR_TARGET="$NIX_EXTRA_X_CFLAGS $NIX_EXTRA_X_LDFLAGS" \
|
||||
)
|
||||
fi
|
||||
|
||||
if test -n "$cross" -a "$crossStageStatic" == 1; then
|
||||
# We don't want the gcc build to assume there will be a libc providing
|
||||
|
@ -61,6 +85,7 @@ if test "$noSysDirs" = "1"; then
|
|||
LIMITS_H_TEST=true \
|
||||
)
|
||||
fi
|
||||
set +x
|
||||
fi
|
||||
|
||||
if test -n "$cross"; then
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
, name ? "gcc"
|
||||
, cross ? null
|
||||
, binutilsCross ? null
|
||||
, glibcHeadersCross ? null
|
||||
, glibcCross ? null
|
||||
, crossStageStatic ? true
|
||||
}:
|
||||
|
||||
|
@ -34,8 +34,12 @@ let
|
|||
" --disable-threads " +
|
||||
" --disable-libmudflap " +
|
||||
" --disable-libgomp " +
|
||||
" --disable-shared" else
|
||||
" --with-headers=${glibcHeadersCross}"
|
||||
" --disable-shared"
|
||||
else
|
||||
" --with-headers=${glibcCross}/include" +
|
||||
" --enable-__cxa_atexit" +
|
||||
" --enable-long-long" +
|
||||
" --enable-threads=posix"
|
||||
);
|
||||
stageNameAddon = if (crossStageStatic) then "-stage-static" else
|
||||
"-stage-final";
|
||||
|
@ -72,7 +76,8 @@ stdenv.mkDerivation ({
|
|||
++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
|
||||
++ optional langJava ./java-jvgenmain-link.patch;
|
||||
|
||||
inherit noSysDirs profiledCompiler staticCompiler cross crossStageStatic binutilsCross;
|
||||
inherit noSysDirs profiledCompiler staticCompiler cross crossStageStatic
|
||||
binutilsCross glibcCross;
|
||||
|
||||
buildInputs = [texinfo gmp mpfr]
|
||||
++ (optionals langTreelang [bison flex])
|
||||
|
|
|
@ -74,7 +74,7 @@ diff -ru gcc-4.3.1-orig/libgomp/configure gcc-4.3.1/libgomp/configure
|
|||
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
|
||||
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
||||
+CC="\$CC $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS"
|
||||
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
|
||||
+
|
||||
# Is the compiler the GNU compiler?
|
||||
with_gcc=$GCC
|
||||
|
@ -90,7 +90,7 @@ diff -ru gcc-4.3.1-orig/libmudflap/configure gcc-4.3.1/libmudflap/configure
|
|||
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
|
||||
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
||||
+CC="\$CC $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS"
|
||||
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
|
||||
+
|
||||
# Is the compiler the GNU compiler?
|
||||
with_gcc=$GCC
|
||||
|
@ -106,7 +106,7 @@ diff -ru gcc-4.3.1-orig/libssp/configure gcc-4.3.1/libssp/configure
|
|||
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
|
||||
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
||||
+CC="\$CC $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS"
|
||||
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
|
||||
+
|
||||
# Is the compiler the GNU compiler?
|
||||
with_gcc=$GCC
|
||||
|
@ -120,10 +120,10 @@ diff -ru gcc-4.3.1-orig/Makefile.in gcc-4.3.1/Makefile.in
|
|||
###
|
||||
|
||||
+CFLAGS += $(NIX_EXTRA_CFLAGS)
|
||||
+CPPFLAGS_FOR_TARGET += $(NIX_EXTRA_CFLAGS)
|
||||
+CPPFLAGS_FOR_TARGET += $(NIX_EXTRA_CFLAGS_TARGET)
|
||||
+CXXFLAGS += $(NIX_EXTRA_CFLAGS)
|
||||
+LDFLAGS += $(NIX_EXTRA_LDFLAGS)
|
||||
+LDFLAGS_FOR_TARGET += $(NIX_EXTRA_LDFLAGS)
|
||||
+LDFLAGS_FOR_TARGET += $(NIX_EXTRA_LDFLAGS_TARGET)
|
||||
+BOOT_CFLAGS += $(NIX_EXTRA_CFLAGS)
|
||||
+BOOT_LDFLAGS += $(NIX_EXTRA_LDFLAGS)
|
||||
+
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ system, name, preHook ? null, postHook ? null, initialPath, gcc, shell
|
||||
, cross ? null
|
||||
, param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
|
||||
, extraAttrs ? {}
|
||||
|
||||
|
@ -17,7 +18,7 @@ let
|
|||
result =
|
||||
|
||||
derivation {
|
||||
inherit system name;
|
||||
inherit system cross name;
|
||||
|
||||
builder = shell;
|
||||
|
||||
|
@ -52,6 +53,7 @@ let
|
|||
["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
|
||||
stdenv = result;
|
||||
system = result.system;
|
||||
cross = result.cross;
|
||||
})
|
||||
)
|
||||
# The meta attribute is passed in the resulting attribute set,
|
||||
|
|
|
@ -219,6 +219,13 @@ rec {
|
|||
[ (stdenvLinuxBoot3Pkgs.binutilsCross cross)
|
||||
(stdenvLinuxBoot3Pkgs.gccCrossStageFinal cross) ];
|
||||
|
||||
postHook = if (cross != null) then
|
||||
(builtins.toFile "cross-posthook.sh" ''
|
||||
configureFlags="$configureFlags --build=${system} --host=${cross}"
|
||||
dontStrip=1
|
||||
'')
|
||||
else null;
|
||||
|
||||
gcc = wrapGCC rec {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||
inherit (stdenvLinuxBoot3Pkgs) coreutils;
|
||||
|
|
|
@ -1895,7 +1895,7 @@ let
|
|||
#stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc);
|
||||
inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross;
|
||||
binutilsCross = binutilsCross cross;
|
||||
glibcHeadersCross = glibcCross cross;
|
||||
glibcCross = glibcCross cross;
|
||||
profiledCompiler = false;
|
||||
enableMultilib = true;
|
||||
crossStageStatic = false;
|
||||
|
@ -1904,6 +1904,7 @@ let
|
|||
gccCrossStageStatic = cross: (gcc43_realCross cross).override {
|
||||
crossStageStatic = true;
|
||||
langCC = false;
|
||||
glibcCross = null;
|
||||
};
|
||||
|
||||
gccCrossStageFinal = cross: wrapGCCCross {
|
||||
|
|
Loading…
Reference in a new issue