Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 44 lines 1.1 kB view raw
1{ stdenvNoCC, lib, glibc, musl }: 2 3let 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"; 12in 13 14stdenvNoCC.mkDerivation { 15 pname = "elf-header"; 16 inherit (libc) version; 17 18 src = null; 19 20 dontUnpack = 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 outputsToInstall = [ "out" ]; 36 description = "Datastructures of ELF according to the target platform's libc"; 37 longDescription = '' 38 The Executable and Linkable Format (ELF, formerly named Extensible Linking 39 Format), is usually defined in a header like this. 40 ''; 41 platforms = lib.platforms.all; 42 maintainers = [ lib.maintainers.ericson2314 ]; 43 }; 44}