Making the definition of the cross compiling target an attribute set.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18378
This commit is contained in:
parent
d82c7e0a69
commit
2c7fa189fb
|
@ -60,24 +60,24 @@ mkGccWrapper() {
|
|||
chmod +x "$dst"
|
||||
}
|
||||
|
||||
mkGccWrapper $out/bin/$cross-gcc $gccPath/$cross-gcc
|
||||
mkGccWrapper $out/bin/$crossConfig-gcc $gccPath/$crossConfig-gcc
|
||||
#ln -s gcc $out/bin/cc
|
||||
|
||||
mkGccWrapper $out/bin/g++ $gccPath/g++
|
||||
ln -s g++ $out/bin/c++
|
||||
mkGccWrapper $out/bin/$crossConfig-g++ $gccPath/$crossConfig-g++
|
||||
ln -s $crossConfig-g++ $out/bin/$crossConfig-c++
|
||||
|
||||
mkGccWrapper $out/bin/g77 $gccPath/g77
|
||||
ln -s g77 $out/bin/f77
|
||||
mkGccWrapper $out/bin/$crossConfig-g77 $gccPath/$crossConfig-g77
|
||||
ln -s $crossConfig-g77 $out/bin/$crossConfig-f77
|
||||
|
||||
ln -s $binutils/bin/$cross-ar $out/bin/$cross-ar
|
||||
ln -s $binutils/bin/$cross-as $out/bin/$cross-as
|
||||
ln -s $binutils/bin/$cross-nm $out/bin/$cross-nm
|
||||
ln -s $binutils/bin/$cross-strip $out/bin/$cross-strip
|
||||
ln -s $binutils/bin/$crossConfig-ar $out/bin/$crossConfig-ar
|
||||
ln -s $binutils/bin/$crossConfig-as $out/bin/$crossConfig-as
|
||||
ln -s $binutils/bin/$crossConfig-nm $out/bin/$crossConfig-nm
|
||||
ln -s $binutils/bin/$crossConfig-strip $out/bin/$crossConfig-strip
|
||||
|
||||
|
||||
# Make a wrapper around the linker.
|
||||
doSubstitute "$ldWrapper" "$out/bin/$cross-ld"
|
||||
chmod +x "$out/bin/$cross-ld"
|
||||
doSubstitute "$ldWrapper" "$out/bin/$crossConfig-ld"
|
||||
chmod +x "$out/bin/$crossConfig-ld"
|
||||
|
||||
|
||||
# Emit a setup hook. Also store the path to the original GCC and
|
||||
|
|
|
@ -20,7 +20,8 @@ stdenv.mkDerivation {
|
|||
ldWrapper = ./ld-wrapper.sh;
|
||||
utils = ./utils.sh;
|
||||
addFlags = ./add-flags;
|
||||
inherit nativeTools nativeLibc nativePrefix gcc libc binutils cross;
|
||||
inherit nativeTools nativeLibc nativePrefix gcc libc binutils;
|
||||
crossConfig = if (cross != null) then cross.config else null;
|
||||
name = if name == "" then gcc.name else name;
|
||||
langC = if nativeTools then true else gcc.langC;
|
||||
langCC = if nativeTools then true else gcc.langCC;
|
||||
|
|
|
@ -40,7 +40,7 @@ if test "$noSysDirs" = "1"; then
|
|||
export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
|
||||
done
|
||||
|
||||
if test -n "$cross"; then
|
||||
if test -n "$crossConfig"; then
|
||||
if test -z "$crossStageStatic"; then
|
||||
extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include"
|
||||
extraXLDFlags="-L${glibcCross}/lib"
|
||||
|
@ -71,7 +71,7 @@ if test "$noSysDirs" = "1"; then
|
|||
)
|
||||
fi
|
||||
|
||||
if test -n "$cross" -a "$crossStageStatic" == 1; then
|
||||
if test -n "$crossConfig" -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=( \
|
||||
|
@ -86,8 +86,8 @@ if test "$noSysDirs" = "1"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if test -n "$cross"; then
|
||||
# The host stripp will destroy everything in the target binaries otherwise
|
||||
if test -n "$crossConfig"; then
|
||||
# The host strip will destroy everything in the target binaries otherwise
|
||||
dontStrip=1
|
||||
fi
|
||||
|
||||
|
@ -126,13 +126,13 @@ postInstall() {
|
|||
done
|
||||
|
||||
# gcc will look for the binutils there, called through collect2
|
||||
if test -n "$cross"; then
|
||||
ln -s $binutilsCross/$cross/bin $out/$cross/bin
|
||||
if test -n "$crossConfig"; then
|
||||
ln -s $binutilsCross/$crossConfig/bin $out/$crossConfig/bin
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if test -z "$cross"; then
|
||||
if test -z "$crossConfig"; then
|
||||
if test -z "$profiledCompiler"; then
|
||||
buildFlags="bootstrap $buildFlags"
|
||||
else
|
||||
|
|
|
@ -27,7 +27,7 @@ with stdenv.lib;
|
|||
let
|
||||
version = "4.3.4";
|
||||
crossConfigureFlags =
|
||||
"--target=${cross}" +
|
||||
"--target=${cross.config}" +
|
||||
(if crossStageStatic then
|
||||
" --disable-libssp --disable-nls" +
|
||||
" --without-headers" +
|
||||
|
@ -43,7 +43,7 @@ let
|
|||
);
|
||||
stageNameAddon = if (crossStageStatic) then "-stage-static" else
|
||||
"-stage-final";
|
||||
crossNameAddon = if (cross != null) then "-${cross}" + stageNameAddon else "";
|
||||
crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else "";
|
||||
|
||||
in
|
||||
|
||||
|
@ -76,8 +76,9 @@ stdenv.mkDerivation ({
|
|||
++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
|
||||
++ optional langJava ./java-jvgenmain-link.patch;
|
||||
|
||||
inherit noSysDirs profiledCompiler staticCompiler cross crossStageStatic
|
||||
inherit noSysDirs profiledCompiler staticCompiler crossStageStatic
|
||||
binutilsCross glibcCross;
|
||||
crossConfig = if (cross != null) then cross.config else null;
|
||||
|
||||
buildInputs = [texinfo gmp mpfr]
|
||||
++ (optionals langTreelang [bison flex])
|
||||
|
|
|
@ -29,7 +29,7 @@ preConfigure() {
|
|||
|
||||
tar xvjf "$srcPorts"
|
||||
|
||||
if test -n "$cross"; then
|
||||
if test -n "$crossConfig"; then
|
||||
sed -i s/-lgcc_eh//g Makeconfig
|
||||
fi
|
||||
|
||||
|
@ -37,16 +37,16 @@ preConfigure() {
|
|||
cd build
|
||||
|
||||
configureScript=../configure
|
||||
if test -n "$cross"; then
|
||||
if test -n "$crossConfig"; then
|
||||
cat > config.cache << "EOF"
|
||||
libc_cv_forced_unwind=yes
|
||||
libc_cv_c_cleanup=yes
|
||||
libc_cv_gnu89_inline=yes
|
||||
EOF
|
||||
export BUILD_CC=gcc
|
||||
export CC="${cross}-gcc"
|
||||
export AR="${cross}-ar"
|
||||
export RANLIB="${cross}-ranlib"
|
||||
export CC="${crossConfig}-gcc"
|
||||
export AR="${crossConfig}-ar"
|
||||
export RANLIB="${crossConfig}-ranlib"
|
||||
configureFlags="${configureFlags} --cache-file=config.cache"
|
||||
|
||||
# The host stripp will destroy everything in the target binaries otherwise
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "glibc-2.9" +
|
||||
stdenv.lib.optionalString (cross != null) "-${cross}";
|
||||
stdenv.lib.optionalString (cross != null) "-${cross.config}";
|
||||
|
||||
builder = ./builder.sh;
|
||||
|
||||
|
@ -22,7 +22,8 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "0r2sn527wxqifi63di7ns9wbjh1cainxn978w178khhy7yw9fk42";
|
||||
};
|
||||
|
||||
inherit kernelHeaders installLocales cross;
|
||||
inherit kernelHeaders installLocales;
|
||||
crossConfig = if (cross != null) then cross.config else null;
|
||||
|
||||
inherit (stdenv) is64bit;
|
||||
|
||||
|
@ -67,7 +68,7 @@ stdenv.mkDerivation rec {
|
|||
"--with-headers=${kernelHeaders}/include"
|
||||
(if profilingLibraries then "--enable-profile" else "--disable-profile")
|
||||
] ++ stdenv.lib.optionals (cross != null) [
|
||||
"--host=${cross}"
|
||||
"--host=${cross.config}"
|
||||
"--build=${stdenv.system}"
|
||||
"--with-tls"
|
||||
"--enable-kernel=2.6.0"
|
||||
|
|
|
@ -4,7 +4,7 @@ let
|
|||
basename = "binutils-2.20";
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = basename + stdenv.lib.optionalString (cross != null) "-${cross}";
|
||||
name = basename + stdenv.lib.optionalString (cross != null) "-${cross.config}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/binutils/${basename}.tar.bz2";
|
||||
|
@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
configureFlags = "--disable-werror" # needed for dietlibc build
|
||||
+ stdenv.lib.optionalString (cross != null) " --target=${cross}";
|
||||
+ stdenv.lib.optionalString (cross != null) " --target=${cross.config}";
|
||||
|
||||
meta = {
|
||||
description = "GNU Binutils, tools for manipulating binaries (linker, assembler, etc.)";
|
||||
|
|
|
@ -14,11 +14,10 @@ stdenv.mkDerivation {
|
|||
sha256 = "0hifjh75sinifr5138v22zwbpqln6lhn65k8b57a1dyzlqca7cl9";
|
||||
};
|
||||
|
||||
inherit cross;
|
||||
crossConfig = if (cross != null) then cross.config else null;
|
||||
|
||||
platform =
|
||||
if cross == "armv5tel-unknown-linux-gnueabi" then "arm" else
|
||||
assert(cross == null);
|
||||
if cross != null then cross.arch else
|
||||
if stdenv.system == "i686-linux" then "i386" else
|
||||
if stdenv.system == "x86_64-linux" then "x86_64" else
|
||||
if stdenv.system == "powerpc-linux" then "powerpc" else
|
||||
|
@ -29,14 +28,16 @@ stdenv.mkDerivation {
|
|||
buildInputs = [perl];
|
||||
|
||||
extraIncludeDirs =
|
||||
if stdenv.system == "powerpc-linux" then ["ppc"] else [];
|
||||
if cross != null then
|
||||
(if cross.arch == "powerpc" then ["ppc"] else [])
|
||||
else if stdenv.system == "powerpc-linux" then ["ppc"] else [];
|
||||
|
||||
patchPhase = ''
|
||||
sed -i '/scsi/d' include/Kbuild
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
if test -n "$cross"; then
|
||||
if test -n "$crossConfig"; then
|
||||
export ARCH=$platform
|
||||
fi
|
||||
make mrproper headers_check
|
||||
|
|
|
@ -18,7 +18,7 @@ let
|
|||
result =
|
||||
|
||||
derivation {
|
||||
inherit system name cross;
|
||||
inherit system name;
|
||||
|
||||
builder = shell;
|
||||
|
||||
|
@ -55,7 +55,7 @@ let
|
|||
system = result.system;
|
||||
# The env variable 'cross' is used in all the crosscompiler
|
||||
# bootstrapping in another sense
|
||||
crossTarget = result.cross;
|
||||
crossTarget = if (cross != null) then cross.config else null;
|
||||
})
|
||||
)
|
||||
# The meta attribute is passed in the resulting attribute set,
|
||||
|
|
|
@ -206,7 +206,7 @@ rec {
|
|||
# dependency (`nix-store -qR') on bootstrapTools.
|
||||
stdenvLinux = import ../generic {
|
||||
name = "stdenv-linux" +
|
||||
stdenvLinuxBoot3Pkgs.lib.optionalString (cross != null) "-${cross}";
|
||||
stdenvLinuxBoot3Pkgs.lib.optionalString (cross != null) "-${cross.config}";
|
||||
|
||||
inherit system cross;
|
||||
|
||||
|
@ -221,7 +221,7 @@ rec {
|
|||
|
||||
postHook = if (cross != null) then
|
||||
(builtins.toFile "cross-posthook.sh" ''
|
||||
configureFlags="$configureFlags --build=${system} --host=${cross}"
|
||||
configureFlags="$configureFlags --build=${system} --host=${cross.config}"
|
||||
dontStrip=1
|
||||
'')
|
||||
else null;
|
||||
|
|
|
@ -2720,7 +2720,12 @@ let
|
|||
|
||||
bisonArm = import ../development/tools/parsing/bison/bison-2.3.nix {
|
||||
inherit fetchurl m4;
|
||||
stdenv = stdenvCross "armv5tel-unknown-linux-gnueabi";
|
||||
stdenv = stdenvCross {
|
||||
config = "armv5tel-unknown-linux-gnueabi";
|
||||
bigEndian = false;
|
||||
arch = "arm";
|
||||
float = "soft";
|
||||
};
|
||||
};
|
||||
|
||||
bison1875 = import ../development/tools/parsing/bison/bison-1.875.nix {
|
||||
|
|
Loading…
Reference in a new issue