Making a bunch of basic programs cross-buildable.

After this, the 'bootstrap-tools' can be cross-built.


svn path=/nixpkgs/branches/stdenv-updates/; revision=20945
This commit is contained in:
Lluís Batlle i Rossell 2010-04-04 18:10:42 +00:00
parent 2d261d1c1e
commit 19b9811012
9 changed files with 63 additions and 8 deletions

View File

@ -10,6 +10,10 @@ stdenv.mkDerivation rec {
doCheck = true;
crossAttrs = {
compileFlags = [ "CC=${stdenv.cross.config}-gcc" ];
};
meta = {
description = "GNU ed, an implementation of the standard Unix editor";

View File

@ -1,8 +1,11 @@
{stdenv, fetchurl, perl, bison, mktemp, linuxHeaders}:
{stdenv, fetchurl, perl, bison, mktemp, linuxHeaders, linuxHeadersCross}:
assert stdenv.isLinux;
let version = "1.5.15"; in
let
version = "1.5.15";
baseMakeFlags = ["V=1" "prefix=$out" "SHLIBDIR=$out/lib"];
in
stdenv.mkDerivation {
name = "klibc-${version}";
@ -12,15 +15,36 @@ stdenv.mkDerivation {
sha256 = "1x401wmjca6zkyikf9xz45b3wb1hnj0m2s9in1sg6xdhi3pk8lwb";
};
makeFlags = ["V=1" "prefix=$out" "SHLIBDIR=$out/lib"];
makeFlags = baseMakeFlags;
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 /KLIBCKERNELSRC/d scripts/Kbuild.install
'';
linuxHeaders = linuxHeadersCross;
};
# The AEABI option concerns only arm systems, and does not affect the build for
# other systems.
preBuild = ''
sed -i /CONFIG_AEABI/d defconfig
echo "CONFIG_AEABI=y" >> defconfig
makeFlags=$(eval "echo $makeFlags")
mkdir linux
cp -prsd ${linuxHeaders}/include linux/
cp -prsd $linuxHeaders/include linux/
chmod -R u+w linux/include/
''; # */
@ -32,5 +56,5 @@ stdenv.mkDerivation {
cp usr/dash/sh $dir/
'';
buildInputs = [perl bison mktemp];
buildNativeInputs = [ perl bison mktemp ];
}

View File

@ -10,6 +10,16 @@ stdenv.mkDerivation {
sha256 = "08py2s9vw6dgw457lbklh1vsr3b8x8dlv7d8ygdfaxlx61l57gzp";
};
crossAttrs = {
patchPhase = ''
sed -i -e 's/CC=gcc/CC=${stdenv.cross.config}-gcc/' \
-e 's/AR=ar/AR=${stdenv.cross.config}-ar/' \
-e 's/RANLIB=ranlib/RANLIB=${stdenv.cross.config}-ranlib/' \
-e 's/bzip2recover test/bzip2recover/' \
Makefile*
'';
};
sharedLibrary =
!stdenv.isDarwin && !(stdenv ? isDietLibC) && !(stdenv ? isStatic) && stdenv.system != "i686-cygwin" && !linkStatic;

View File

@ -16,6 +16,10 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional aclSupport acl.hostDrv
++ stdenv.lib.optional (stdenv.gccCross.libc ? libiconv)
stdenv.gccCross.libc.libiconv.hostDrv;
# Needed for fstatfs()
# I don't know why it is not properly detected cross building with glibc.
configureFlags = [ "fu_cv_sys_stat_statfs2_bsize=yes" ];
};
# The tests are known broken on Cygwin

View File

@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
sha256 = "0f61phan4q8w5i1lz768q973c1spfqgvc470jc89rpg0gxfvi9bp";
};
buildInputs = [coreutils];
buildNativeInputs = [coreutils];
patches = [ ./findutils-path.patch ./change_echo_path.patch ]
# Note: the dietlibc patch is just to get findutils to compile.
@ -17,6 +17,11 @@ stdenv.mkDerivation rec {
doCheck = true;
crossAttrs = {
# http://osdir.com/ml/bug-findutils-gnu/2009-08/msg00026.html
configureFlags = [ "gl_cv_func_wcwidth_works=yes" ];
};
meta = {
homepage = http://www.gnu.org/software/findutils/;
description = "GNU Find Utilities, the basic directory searching utilities of the GNU operating system";

View File

@ -9,7 +9,7 @@ stdenv.mkDerivation {
};
/* If no explicit coreutils is given, use the one from stdenv. */
buildInputs = [coreutils];
buildNativeInputs = [coreutils];
meta = {
homepage = http://www.gnu.org/software/diffutils/diffutils.html;

View File

@ -17,6 +17,10 @@ stdenv.mkDerivation rec {
buildInputs = (stdenv.lib.optional doCheck ed);
crossAttrs = {
configureFlags = [ "ac_cv_func_strnlen_working=yes" ];
};
doCheck = true;
meta = {

View File

@ -10,6 +10,10 @@ stdenv.mkDerivation {
makeFlags = ["TREE=\$(out)"];
crossAttrs = {
makeFlags = [ "TREE=\$(out)" "CC=${stdenv.cross.config}-gcc" ];
};
postInstall = "mv \$out/bin/replace \$out/bin/replace-literal";
patches = [./malloc.patch];

View File

@ -6143,7 +6143,7 @@ let
};
klibc = makeOverridable (import ../os-specific/linux/klibc) {
inherit fetchurl stdenv perl bison mktemp;
inherit fetchurl stdenv perl bison mktemp linuxHeadersCross;
linuxHeaders = glibc.kernelHeaders;
};