git.iko.soy/typeable/nixpkgs
on master help sign in
elf-header: Init at <libc version>

A little shim derivation to get this header for Darwin, where it is needed for cross compilation. There's no real reason to do glibc and musl like that, but as I'm maintaining it I suppose I can go overboard like that.

commitb8ce6a31f555a2e4471880cc4c01b629e7d6d36f authorJohn Ericson <John.Ericson@Obsidian.Systems> dateTue 11 Sep 2018, 18:17 (8 years ago) parent2205bea
2 files changed+51
pkgs/development/libraries/elf-header/default.nix+43 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/top-level/all-packages.nix+8
@@ -9513,6 +9513,14 @@ with pkgs;
95139513 installLocales = config.glibc.locales or false;
95149514 };
95159515
9516+ # Provided by libc on Operating Systems that use the Extensible Linker Format.
9517+ elf-header =
9518+ if stdenv.hostPlatform.parsed.kernel.execFormat.name == "elf"
9519+ then null
9520+ else elf-header-real;
9521+
9522+ elf-header-real = callPackage ../development/libraries/elf-header { };
9523+
95169524 glibc_memusage = callPackage ../development/libraries/glibc {
95179525 installLocales = false;
95189526 withGd = true;