2010-04-04 19:10:42 +01:00
|
|
|
{stdenv, fetchurl, perl, bison, mktemp, linuxHeaders, linuxHeadersCross}:
|
2005-08-27 21:48:05 +01:00
|
|
|
|
2006-11-25 00:28:15 +00:00
|
|
|
assert stdenv.isLinux;
|
2005-08-27 21:48:05 +01:00
|
|
|
|
2010-04-04 19:10:42 +01:00
|
|
|
let
|
|
|
|
version = "1.5.15";
|
|
|
|
baseMakeFlags = ["V=1" "prefix=$out" "SHLIBDIR=$out/lib"];
|
|
|
|
in
|
2009-01-29 15:44:37 +00:00
|
|
|
|
2005-08-27 21:48:05 +01:00
|
|
|
stdenv.mkDerivation {
|
2008-08-09 09:40:37 +01:00
|
|
|
name = "klibc-${version}";
|
2009-01-29 15:44:37 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2010-06-01 13:13:59 +01:00
|
|
|
url = "mirror://kernel/linux/libs/klibc/klibc-${version}.tar.bz2";
|
2009-06-22 15:14:58 +01:00
|
|
|
sha256 = "1x401wmjca6zkyikf9xz45b3wb1hnj0m2s9in1sg6xdhi3pk8lwb";
|
2009-01-29 15:44:37 +00:00
|
|
|
};
|
|
|
|
|
2010-04-04 19:10:42 +01:00
|
|
|
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;
|
|
|
|
};
|
2009-01-29 15:44:37 +00:00
|
|
|
|
2010-04-04 19:10:42 +01:00
|
|
|
# The AEABI option concerns only arm systems, and does not affect the build for
|
|
|
|
# other systems.
|
2008-11-02 15:53:55 +00:00
|
|
|
preBuild = ''
|
2009-11-08 00:32:12 +00:00
|
|
|
sed -i /CONFIG_AEABI/d defconfig
|
|
|
|
echo "CONFIG_AEABI=y" >> defconfig
|
2008-11-02 15:53:55 +00:00
|
|
|
makeFlags=$(eval "echo $makeFlags")
|
|
|
|
|
2009-01-29 15:44:37 +00:00
|
|
|
mkdir linux
|
2010-04-04 19:10:42 +01:00
|
|
|
cp -prsd $linuxHeaders/include linux/
|
2008-11-02 15:53:55 +00:00
|
|
|
chmod -R u+w linux/include/
|
2009-01-29 15:44:37 +00:00
|
|
|
''; # */
|
|
|
|
|
|
|
|
# Install static binaries as well.
|
|
|
|
postInstall = ''
|
|
|
|
dir=$out/lib/klibc/bin.static
|
|
|
|
mkdir $dir
|
|
|
|
cp $(find $(find . -name static) -type f ! -name "*.g" -a ! -name ".*") $dir/
|
|
|
|
cp usr/dash/sh $dir/
|
|
|
|
'';
|
|
|
|
|
2010-04-04 19:10:42 +01:00
|
|
|
buildNativeInputs = [ perl bison mktemp ];
|
2005-08-27 21:48:05 +01:00
|
|
|
}
|