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
|
@ -31,6 +31,7 @@ if test "$noSysDirs" = "1"; then
|
||||||
export NIX_FIXINC_DUMMY=/usr/include
|
export NIX_FIXINC_DUMMY=/usr/include
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
extraCFlags="-g0 -I$gmp/include -I$mpfr/include $extraCFlags"
|
extraCFlags="-g0 -I$gmp/include -I$mpfr/include $extraCFlags"
|
||||||
extraLDFlags="--strip-debug $extraLDFlags"
|
extraLDFlags="--strip-debug $extraLDFlags"
|
||||||
|
|
||||||
|
@ -39,14 +40,37 @@ if test "$noSysDirs" = "1"; then
|
||||||
export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
|
export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
makeFlagsArray=( \
|
set -x
|
||||||
"${makeFlagsArray[@]}" \
|
if test -n "$cross"; then
|
||||||
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
if test -z "$crossStageStatic"; then
|
||||||
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include"
|
||||||
X_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
extraXLDFlags="-L${glibcCross}/lib"
|
||||||
LDFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
export NIX_EXTRA_CFLAGS_TARGET=$extraXCFlags
|
||||||
LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
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" \
|
||||||
|
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
|
if test -n "$cross" -a "$crossStageStatic" == 1; then
|
||||||
# We don't want the gcc build to assume there will be a libc providing
|
# 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 \
|
LIMITS_H_TEST=true \
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
set +x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$cross"; then
|
if test -n "$cross"; then
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
, name ? "gcc"
|
, name ? "gcc"
|
||||||
, cross ? null
|
, cross ? null
|
||||||
, binutilsCross ? null
|
, binutilsCross ? null
|
||||||
, glibcHeadersCross ? null
|
, glibcCross ? null
|
||||||
, crossStageStatic ? true
|
, crossStageStatic ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -34,8 +34,12 @@ let
|
||||||
" --disable-threads " +
|
" --disable-threads " +
|
||||||
" --disable-libmudflap " +
|
" --disable-libmudflap " +
|
||||||
" --disable-libgomp " +
|
" --disable-libgomp " +
|
||||||
" --disable-shared" else
|
" --disable-shared"
|
||||||
" --with-headers=${glibcHeadersCross}"
|
else
|
||||||
|
" --with-headers=${glibcCross}/include" +
|
||||||
|
" --enable-__cxa_atexit" +
|
||||||
|
" --enable-long-long" +
|
||||||
|
" --enable-threads=posix"
|
||||||
);
|
);
|
||||||
stageNameAddon = if (crossStageStatic) then "-stage-static" else
|
stageNameAddon = if (crossStageStatic) then "-stage-static" else
|
||||||
"-stage-final";
|
"-stage-final";
|
||||||
|
@ -72,7 +76,8 @@ stdenv.mkDerivation ({
|
||||||
++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
|
++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
|
||||||
++ optional langJava ./java-jvgenmain-link.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]
|
buildInputs = [texinfo gmp mpfr]
|
||||||
++ (optionals langTreelang [bison flex])
|
++ (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.
|
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
|
||||||
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||||
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
+# 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?
|
# Is the compiler the GNU compiler?
|
||||||
with_gcc=$GCC
|
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.
|
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
|
||||||
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||||
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
+# 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?
|
# Is the compiler the GNU compiler?
|
||||||
with_gcc=$GCC
|
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.
|
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
|
||||||
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||||
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
+# 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?
|
# Is the compiler the GNU compiler?
|
||||||
with_gcc=$GCC
|
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)
|
+CFLAGS += $(NIX_EXTRA_CFLAGS)
|
||||||
+CPPFLAGS_FOR_TARGET += $(NIX_EXTRA_CFLAGS)
|
+CPPFLAGS_FOR_TARGET += $(NIX_EXTRA_CFLAGS_TARGET)
|
||||||
+CXXFLAGS += $(NIX_EXTRA_CFLAGS)
|
+CXXFLAGS += $(NIX_EXTRA_CFLAGS)
|
||||||
+LDFLAGS += $(NIX_EXTRA_LDFLAGS)
|
+LDFLAGS += $(NIX_EXTRA_LDFLAGS)
|
||||||
+LDFLAGS_FOR_TARGET += $(NIX_EXTRA_LDFLAGS)
|
+LDFLAGS_FOR_TARGET += $(NIX_EXTRA_LDFLAGS_TARGET)
|
||||||
+BOOT_CFLAGS += $(NIX_EXTRA_CFLAGS)
|
+BOOT_CFLAGS += $(NIX_EXTRA_CFLAGS)
|
||||||
+BOOT_LDFLAGS += $(NIX_EXTRA_LDFLAGS)
|
+BOOT_LDFLAGS += $(NIX_EXTRA_LDFLAGS)
|
||||||
+
|
+
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{ system, name, preHook ? null, postHook ? null, initialPath, gcc, shell
|
{ system, name, preHook ? null, postHook ? null, initialPath, gcc, shell
|
||||||
|
, cross ? null
|
||||||
, param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
|
, param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
|
||||||
, extraAttrs ? {}
|
, extraAttrs ? {}
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ let
|
||||||
result =
|
result =
|
||||||
|
|
||||||
derivation {
|
derivation {
|
||||||
inherit system name;
|
inherit system cross name;
|
||||||
|
|
||||||
builder = shell;
|
builder = shell;
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ let
|
||||||
["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
|
["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
|
||||||
stdenv = result;
|
stdenv = result;
|
||||||
system = result.system;
|
system = result.system;
|
||||||
|
cross = result.cross;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
# The meta attribute is passed in the resulting attribute set,
|
# The meta attribute is passed in the resulting attribute set,
|
||||||
|
|
|
@ -219,6 +219,13 @@ rec {
|
||||||
[ (stdenvLinuxBoot3Pkgs.binutilsCross cross)
|
[ (stdenvLinuxBoot3Pkgs.binutilsCross cross)
|
||||||
(stdenvLinuxBoot3Pkgs.gccCrossStageFinal 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 {
|
gcc = wrapGCC rec {
|
||||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||||
inherit (stdenvLinuxBoot3Pkgs) coreutils;
|
inherit (stdenvLinuxBoot3Pkgs) coreutils;
|
||||||
|
|
|
@ -1895,7 +1895,7 @@ let
|
||||||
#stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc);
|
#stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc);
|
||||||
inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross;
|
inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross;
|
||||||
binutilsCross = binutilsCross cross;
|
binutilsCross = binutilsCross cross;
|
||||||
glibcHeadersCross = glibcCross cross;
|
glibcCross = glibcCross cross;
|
||||||
profiledCompiler = false;
|
profiledCompiler = false;
|
||||||
enableMultilib = true;
|
enableMultilib = true;
|
||||||
crossStageStatic = false;
|
crossStageStatic = false;
|
||||||
|
@ -1904,6 +1904,7 @@ let
|
||||||
gccCrossStageStatic = cross: (gcc43_realCross cross).override {
|
gccCrossStageStatic = cross: (gcc43_realCross cross).override {
|
||||||
crossStageStatic = true;
|
crossStageStatic = true;
|
||||||
langCC = false;
|
langCC = false;
|
||||||
|
glibcCross = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
gccCrossStageFinal = cross: wrapGCCCross {
|
gccCrossStageFinal = cross: wrapGCCCross {
|
||||||
|
|
Loading…
Reference in New Issue