diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/os-specific/linux/klibc | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/klibc')
3 files changed, 87 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/klibc/default.nix b/nixpkgs/pkgs/os-specific/linux/klibc/default.nix new file mode 100644 index 000000000000..8cae61d56a92 --- /dev/null +++ b/nixpkgs/pkgs/os-specific/linux/klibc/default.nix @@ -0,0 +1,48 @@ +{ stdenv, fetchurl, linuxHeaders, perl }: + +let + commonMakeFlags = [ + "prefix=$(out)" + "SHLIBDIR=$(out)/lib" + ]; +in + +stdenv.mkDerivation rec { + name = "klibc-${version}"; + version = "2.0.4"; + + src = fetchurl { + url = "mirror://kernel/linux/libs/klibc/2.0/klibc-${version}.tar.xz"; + sha256 = "7f9a0850586def7cf4faeeb75e5d0f66e613674c524f6e77b0f4d93a26c801cb"; + }; + + patches = [ ./no-reinstall-kernel-headers.patch ]; + + nativeBuildInputs = [ perl ]; + + hardeningDisable = [ "format" "stackprotector" ]; + + makeFlags = commonMakeFlags ++ [ + "KLIBCARCH=${stdenv.hostPlatform.platform.kernelArch}" + "KLIBCKERNELSRC=${linuxHeaders}" + ] # TODO(@Ericson2314): We now can get the ABI from + # `stdenv.hostPlatform.parsed.abi`, is this still a good idea? + ++ stdenv.lib.optional (stdenv.hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y" + ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "CROSS_COMPILE=${stdenv.cc.targetPrefix}"; + + # 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/ + + for file in ${linuxHeaders}/include/*; do + ln -sv $file $out/lib/klibc/include + done + ''; + + meta = { + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch b/nixpkgs/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch new file mode 100644 index 000000000000..d3e55fc8731d --- /dev/null +++ b/nixpkgs/pkgs/os-specific/linux/klibc/no-reinstall-kernel-headers.patch @@ -0,0 +1,11 @@ +diff -Naur klibc-2.0.3-orig/scripts/Kbuild.install klibc-2.0.3/scripts/Kbuild.install +--- klibc-2.0.3-orig/scripts/Kbuild.install 2013-12-03 13:53:46.000000000 -0500 ++++ klibc-2.0.3/scripts/Kbuild.install 2014-01-04 18:17:09.342609021 -0500 +@@ -95,7 +95,6 @@ + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin +- $(Q)$(MAKE) -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install + $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. + $(Q)chmod -R a+rX $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 diff --git a/nixpkgs/pkgs/os-specific/linux/klibc/shrunk.nix b/nixpkgs/pkgs/os-specific/linux/klibc/shrunk.nix new file mode 100644 index 000000000000..f01f3b6a4ec3 --- /dev/null +++ b/nixpkgs/pkgs/os-specific/linux/klibc/shrunk.nix @@ -0,0 +1,28 @@ +{stdenv, klibc}: + +stdenv.mkDerivation { + # !!! For now, the name has to be exactly as long as the original + # name due to the sed hackery below. Once patchelf 0.4 is in the + # tree, we can do this properly. + #name = "${klibc.name}-shrunk"; + name = "${klibc.name}"; + buildCommand = '' + mkdir -p $out/lib + cp -prd ${klibc.out}/lib/klibc/bin $out/ + cp -p ${klibc.out}/lib/*.so $out/lib/ + chmod +w $out/* + old=$(echo ${klibc.out}/lib/klibc-*.so) + new=$(echo $out/lib/klibc-*.so) + for i in $out/bin/*; do + echo $i + sed "s^$old^$new^" -i $i + # !!! use patchelf + #patchelf --set-interpreter $new $i + done + ''; # */ + allowedReferences = ["out"]; + + meta = { + platforms = stdenv.lib.platforms.linux; + }; +} |