2017-06-28 21:38:33 +01:00
|
|
|
{ stdenv, fetchurl, linuxHeaders, perl
|
|
|
|
, buildPlatform, hostPlatform
|
|
|
|
}:
|
2005-08-27 21:48:05 +01:00
|
|
|
|
2010-04-04 19:10:42 +01:00
|
|
|
let
|
2014-01-05 01:57:21 +00:00
|
|
|
commonMakeFlags = [
|
|
|
|
"prefix=$(out)"
|
|
|
|
"SHLIBDIR=$(out)/lib"
|
|
|
|
];
|
2010-04-04 19:10:42 +01:00
|
|
|
in
|
2009-01-29 15:44:37 +00:00
|
|
|
|
2016-04-18 16:05:40 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "klibc-${version}";
|
|
|
|
version = "2.0.4";
|
2009-01-29 15:44:37 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2014-01-05 01:57:21 +00:00
|
|
|
url = "mirror://kernel/linux/libs/klibc/2.0/klibc-${version}.tar.xz";
|
2014-09-05 21:50:48 +01:00
|
|
|
sha256 = "7f9a0850586def7cf4faeeb75e5d0f66e613674c524f6e77b0f4d93a26c801cb";
|
2009-01-29 15:44:37 +00:00
|
|
|
};
|
2010-09-05 07:00:14 +01:00
|
|
|
|
2014-01-05 01:57:21 +00:00
|
|
|
patches = [ ./no-reinstall-kernel-headers.patch ];
|
2010-04-04 19:10:42 +01:00
|
|
|
|
2014-01-05 01:57:21 +00:00
|
|
|
nativeBuildInputs = [ perl ];
|
2010-04-04 19:10:42 +01:00
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" "stackprotector" ];
|
2016-02-12 02:58:58 +00:00
|
|
|
|
2014-01-05 01:57:21 +00:00
|
|
|
makeFlags = commonMakeFlags ++ [
|
2017-06-28 21:38:33 +01:00
|
|
|
"KLIBCARCH=${hostPlatform.platform.kernelArch}"
|
2016-04-18 16:05:40 +01:00
|
|
|
"KLIBCKERNELSRC=${linuxHeaders}"
|
2017-06-28 21:38:33 +01:00
|
|
|
] # TODO(@Ericson2314): We now can get the ABI from
|
|
|
|
# `hostPlatform.parsed.abi`, is this still a good idea?
|
|
|
|
++ stdenv.lib.optional (hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y"
|
|
|
|
++ stdenv.lib.optional (hostPlatform != buildPlatform) "CROSS_COMPILE=${stdenv.cc.prefix}";
|
2008-11-02 15:53:55 +00:00
|
|
|
|
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/
|
2014-01-05 01:57:21 +00:00
|
|
|
|
2016-04-18 16:05:40 +01:00
|
|
|
for file in ${linuxHeaders}/include/*; do
|
2014-01-05 01:57:21 +00:00
|
|
|
ln -sv $file $out/lib/klibc/include
|
|
|
|
done
|
2009-01-29 15:44:37 +00:00
|
|
|
'';
|
2016-08-02 17:06:29 +01:00
|
|
|
|
|
|
|
meta = {
|
2016-08-06 14:48:17 +01:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2016-08-02 17:06:29 +01:00
|
|
|
};
|
2005-08-27 21:48:05 +01:00
|
|
|
}
|