diff --git a/pkgs/applications/editors/ed/default.nix b/pkgs/applications/editors/ed/default.nix index 9f26c0a2886e..905cde880edd 100644 --- a/pkgs/applications/editors/ed/default.nix +++ b/pkgs/applications/editors/ed/default.nix @@ -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"; diff --git a/pkgs/os-specific/linux/klibc/default.nix b/pkgs/os-specific/linux/klibc/default.nix index 8bd911ee0805..0a2747eb1657 100644 --- a/pkgs/os-specific/linux/klibc/default.nix +++ b/pkgs/os-specific/linux/klibc/default.nix @@ -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 ]; } diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix index 0523067cbade..e8ac6c6418cb 100644 --- a/pkgs/tools/compression/bzip2/default.nix +++ b/pkgs/tools/compression/bzip2/default.nix @@ -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; diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix index 431684829b5b..6f7c0923d99f 100644 --- a/pkgs/tools/misc/coreutils/default.nix +++ b/pkgs/tools/misc/coreutils/default.nix @@ -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 diff --git a/pkgs/tools/misc/findutils/default.nix b/pkgs/tools/misc/findutils/default.nix index 2350ab260492..887f400b8c59 100644 --- a/pkgs/tools/misc/findutils/default.nix +++ b/pkgs/tools/misc/findutils/default.nix @@ -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"; diff --git a/pkgs/tools/text/diffutils/default.nix b/pkgs/tools/text/diffutils/default.nix index 44b7715607c8..d75485cf0473 100644 --- a/pkgs/tools/text/diffutils/default.nix +++ b/pkgs/tools/text/diffutils/default.nix @@ -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; diff --git a/pkgs/tools/text/gnupatch/default.nix b/pkgs/tools/text/gnupatch/default.nix index cd2a67f69933..e6383f40a7c1 100644 --- a/pkgs/tools/text/gnupatch/default.nix +++ b/pkgs/tools/text/gnupatch/default.nix @@ -17,6 +17,10 @@ stdenv.mkDerivation rec { buildInputs = (stdenv.lib.optional doCheck ed); + crossAttrs = { + configureFlags = [ "ac_cv_func_strnlen_working=yes" ]; + }; + doCheck = true; meta = { diff --git a/pkgs/tools/text/replace/default.nix b/pkgs/tools/text/replace/default.nix index 0182a3bb48df..339bf510c4b2 100644 --- a/pkgs/tools/text/replace/default.nix +++ b/pkgs/tools/text/replace/default.nix @@ -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]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bf09b758d2ec..c1f37aaca9aa 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; };