git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #46574 from obsidiansystems/elf-header

elf-header: Init at <libc version>

commit0bfdab21cf69f823b6fe647192bb063a93618fc2 authorJohn Ericson <subscribe@JohnEricson.me> dateSat 15 Sep 2018, 01:37 (8 years ago) parent218ce4db8ce6a3
5 files changed+56−6
pkgs/development/libraries/elf-header/default.nix+43 pkgs/development/libraries/glibc/common.nix+2 pkgs/development/libraries/glibc/default.nix+2−3 pkgs/os-specific/linux/kernel-headers/default.nix+1−3 pkgs/top-level/all-packages.nix+8
pkgs/development/libraries/elf-header/default.nixnew file+43
@@ -0,0 +1,43 @@
1+{ stdenvNoCC, lib, glibc, musl }:
2+
3+let
4+ libc =
5+ if stdenvNoCC.targetPlatform.isMusl
6+ then musl
7+ else glibc;
8+ headerPath =
9+ if stdenvNoCC.targetPlatform.isMusl
10+ then "musl-${libc.version}/include/elf.h"
11+ else "glibc-${libc.version}/elf/elf.h";
12+in
13+
14+stdenvNoCC.mkDerivation {
15+ name = "elf-header";
16+ inherit (libc) version;
17+
18+ src = null;
19+
20+ unpackPhase = "true";
21+
22+ dontBuild = true;
23+
24+ installPhase = ''
25+ mkdir -p "$out/include";
26+ tar -xf \
27+ ${lib.escapeShellArg libc.src} \
28+ ${lib.escapeShellArg headerPath} \
29+ --to-stdout \
30+ | sed -e '/features\.h/d' \
31+ > "$out/include/elf.h"
32+ '';
33+
34+ meta = libc.meta // {
35+ description = "The datastructures of ELF according to the target platform's libc";
36+ longDescription = ''
37+ The Executable and Linkable Format (ELF, formerly named Extensible Linking
38+ Format), is usually defined in a header like this.
39+ '';
40+ platforms = lib.platforms.all;
41+ maintainers = [ lib.maintainers.ericson2314 ];
42+ };
43+}
pkgs/development/libraries/glibc/common.nix+2
@@ -139,6 +139,8 @@ stdenv.mkDerivation ({
139139 # prevent a retained dependency on the bootstrap tools in the stdenv-linux
140140 # bootstrap.
141141 BASH_SHELL = "/bin/sh";
142+
143+ passthru = { inherit version; };
142144}
143145
144146// (removeAttrs args [ "withLinuxHeaders" "withGd" ]) //
pkgs/development/libraries/glibc/default.nix+2−3
@@ -5,8 +5,6 @@
55, withGd ? false
66}:
77
8−assert stdenv.cc.isGNU;
9−
108callPackage ./common.nix { inherit stdenv; } {
119 name = "glibc" + stdenv.lib.optionalString withGd "-gd";
1210
@@ -96,7 +94,8 @@ callPackage ./common.nix { inherit stdenv; } {
9694 mv $bin/bin/getconf_ $bin/bin/getconf
9795 '';
9896
99− separateDebugInfo = true;
97+ # Hack to get around eval issue.
98+ separateDebugInfo = !stdenv.isDarwin;
10099
101100 meta.description = "The GNU C Library";
102101 }
pkgs/os-specific/linux/kernel-headers/default.nix+1−3
@@ -2,8 +2,6 @@
22, fetchurl, perl
33}:
44
5−assert stdenvNoCC.hostPlatform.isLinux;
6−
75let
86 common = { version, sha256, patches ? null }: stdenvNoCC.mkDerivation {
97 name = "linux-headers-${version}";
@@ -13,7 +11,7 @@ let
1311 inherit sha256;
1412 };
1513
16− ARCH = stdenvNoCC.hostPlatform.platform.kernelArch;
14+ ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or (throw "missing kernelArch");
1715
1816 # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
1917 # We do this so we have a build->build, not build->host, C compiler.
pkgs/top-level/all-packages.nix+8
@@ -9536,6 +9536,14 @@ with pkgs;
95369536 installLocales = config.glibc.locales or false;
95379537 };
95389538
9539+ # Provided by libc on Operating Systems that use the Extensible Linker Format.
9540+ elf-header =
9541+ if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf"
9542+ then null
9543+ else elf-header-real;
9544+
9545+ elf-header-real = callPackage ../development/libraries/elf-header { };
9546+
95399547 glibc_memusage = callPackage ../development/libraries/glibc {
95409548 installLocales = false;
95419549 withGd = true;