2014-01-05 02:57:21 +01:00
|
|
|
{ stdenv, fetchurl, kernelHeaders, kernel, perl }:
|
2005-08-27 22:48:05 +02:00
|
|
|
|
2010-04-04 20:10:42 +02:00
|
|
|
let
|
2014-09-05 22:50:48 +02:00
|
|
|
version = "2.0.4";
|
2014-01-05 02:57:21 +01:00
|
|
|
|
|
|
|
commonMakeFlags = [
|
|
|
|
"prefix=$(out)"
|
|
|
|
"SHLIBDIR=$(out)/lib"
|
|
|
|
];
|
2010-04-04 20:10:42 +02:00
|
|
|
in
|
2009-01-29 16:44:37 +01:00
|
|
|
|
2005-08-27 22:48:05 +02:00
|
|
|
stdenv.mkDerivation {
|
2014-01-05 02:57:21 +01:00
|
|
|
name = "klibc-${version}-${kernel.version}";
|
2009-01-29 16:44:37 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2014-01-05 02:57:21 +01:00
|
|
|
url = "mirror://kernel/linux/libs/klibc/2.0/klibc-${version}.tar.xz";
|
2014-09-05 22:50:48 +02:00
|
|
|
sha256 = "7f9a0850586def7cf4faeeb75e5d0f66e613674c524f6e77b0f4d93a26c801cb";
|
2009-01-29 16:44:37 +01:00
|
|
|
};
|
2010-09-05 08:00:14 +02:00
|
|
|
|
2014-01-05 02:57:21 +01:00
|
|
|
patches = [ ./no-reinstall-kernel-headers.patch ];
|
2010-04-04 20:10:42 +02:00
|
|
|
|
2014-01-05 02:57:21 +01:00
|
|
|
nativeBuildInputs = [ perl ];
|
2010-04-04 20:10:42 +02:00
|
|
|
|
2016-02-12 03:58:58 +01:00
|
|
|
hardening_format = false;
|
|
|
|
hardening_stackprotector = false;
|
|
|
|
|
2014-01-05 02:57:21 +01:00
|
|
|
makeFlags = commonMakeFlags ++ [
|
|
|
|
"KLIBCARCH=${stdenv.platform.kernelArch}"
|
|
|
|
"KLIBCKERNELSRC=${kernelHeaders}"
|
|
|
|
] ++ stdenv.lib.optional (stdenv.platform.kernelArch == "arm") "CONFIG_AEABI=y";
|
2010-04-04 20:10:42 +02:00
|
|
|
|
2014-01-05 02:57:21 +01:00
|
|
|
crossAttrs = {
|
|
|
|
makeFlags = commonMakeFlags ++ [
|
|
|
|
"KLIBCARCH=${stdenv.cross.platform.kernelArch}"
|
|
|
|
"KLIBCKERNELSRC=${kernelHeaders.crossDrv}"
|
|
|
|
"CROSS_COMPILE=${stdenv.cross.config}-"
|
|
|
|
] ++ stdenv.lib.optional (stdenv.cross.platform.kernelArch == "arm") "CONFIG_AEABI=y";
|
2010-04-04 20:10:42 +02:00
|
|
|
};
|
2008-11-02 16:53:55 +01:00
|
|
|
|
2009-01-29 16:44:37 +01: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/
|
2014-01-05 02:57:21 +01:00
|
|
|
|
|
|
|
for file in ${kernelHeaders}/include/*; do
|
|
|
|
ln -sv $file $out/lib/klibc/include
|
|
|
|
done
|
2009-01-29 16:44:37 +01:00
|
|
|
'';
|
2005-08-27 22:48:05 +02:00
|
|
|
}
|