Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 108 lines 4.1 kB view raw
1{ lib, stdenv, fetchurl, fetchpatch, pkg-config, musl-fts 2, musl-obstack, m4, zlib, zstd, bzip2, bison, flex, gettext, xz, setupDebugInfoDirs 3, argp-standalone 4, enableDebuginfod ? true, sqlite, curl, libmicrohttpd, libarchive 5, gitUpdater 6}: 7 8# TODO: Look at the hardcoded paths to kernel, modules etc. 9stdenv.mkDerivation rec { 10 pname = "elfutils"; 11 version = "0.191"; 12 13 src = fetchurl { 14 url = "https://sourceware.org/elfutils/ftp/${version}/${pname}-${version}.tar.bz2"; 15 hash = "sha256-33bbcTZtHXCDZfx6bGDKSDmPFDZ+sriVTvyIlxR62HE="; 16 }; 17 18 patches = [ 19 ./debug-info-from-env.patch 20 (fetchpatch { 21 name = "fix-aarch64_fregs.patch"; 22 url = "https://git.alpinelinux.org/aports/plain/main/elfutils/fix-aarch64_fregs.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9"; 23 sha256 = "zvncoRkQx3AwPx52ehjA2vcFroF+yDC2MQR5uS6DATs="; 24 }) 25 (fetchpatch { 26 name = "musl-asm-ptrace-h.patch"; 27 url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-asm-ptrace-h.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9"; 28 sha256 = "8D1wPcdgAkE/TNBOgsHaeTZYhd9l+9TrZg8d5C7kG6k="; 29 }) 30 (fetchpatch { 31 name = "musl-macros.patch"; 32 url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-macros.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9"; 33 sha256 = "tp6O1TRsTAMsFe8vw3LMENT/vAu6OmyA8+pzgThHeA8="; 34 }) 35 (fetchpatch { 36 name = "musl-strndupa.patch"; 37 url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-strndupa.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9"; 38 sha256 = "sha256-7daehJj1t0wPtQzTv+/Rpuqqs5Ng/EYnZzrcf2o/Lb0="; 39 }) 40 ] ++ lib.optionals stdenv.hostPlatform.isMusl [ ./musl-error_h.patch ]; 41 42 postPatch = '' 43 patchShebangs tests/*.sh 44 '' + lib.optionalString stdenv.hostPlatform.isRiscV '' 45 # disable failing test: 46 # 47 # > dwfl_thread_getframes: No DWARF information found 48 sed -i s/run-backtrace-dwarf.sh//g tests/Makefile.in 49 ''; 50 51 outputs = [ "bin" "dev" "out" "man" ]; 52 53 # We need bzip2 in NativeInputs because otherwise we can't unpack the src, 54 # as the host-bzip2 will be in the path. 55 nativeBuildInputs = [ m4 bison flex gettext bzip2 ] 56 ++ lib.optional enableDebuginfod pkg-config; 57 buildInputs = [ zlib zstd bzip2 xz ] 58 ++ lib.optionals stdenv.hostPlatform.isMusl [ 59 argp-standalone 60 musl-fts 61 musl-obstack 62 ] ++ lib.optionals enableDebuginfod [ 63 sqlite 64 curl 65 libmicrohttpd 66 libarchive 67 ]; 68 69 propagatedNativeBuildInputs = [ setupDebugInfoDirs ]; 70 71 configureFlags = [ 72 "--program-prefix=eu-" # prevent collisions with binutils 73 "--enable-deterministic-archives" 74 (lib.enableFeature enableDebuginfod "libdebuginfod") 75 (lib.enableFeature enableDebuginfod "debuginfod") 76 ]; 77 78 enableParallelBuilding = true; 79 80 81 doCheck = 82 # Backtrace unwinding tests rely on glibc-internal symbol names. 83 # Musl provides slightly different forms and fails. 84 # Let's disable tests there until musl support is fully upstreamed. 85 !stdenv.hostPlatform.isMusl 86 # Test suite tries using `uname` to determine whether certain tests 87 # can be executed, so we need to match build and host platform exactly. 88 && (stdenv.hostPlatform == stdenv.buildPlatform); 89 doInstallCheck = !stdenv.hostPlatform.isMusl 90 && (stdenv.hostPlatform == stdenv.buildPlatform); 91 92 passthru.updateScript = gitUpdater { 93 url = "https://sourceware.org/git/elfutils.git"; 94 rev-prefix = "elfutils-"; 95 }; 96 97 meta = with lib; { 98 homepage = "https://sourceware.org/elfutils/"; 99 description = "A set of utilities to handle ELF objects"; 100 platforms = platforms.linux; 101 # https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-November/004223.html 102 badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ]; 103 # licenses are GPL2 or LGPL3+ for libraries, GPL3+ for bins, 104 # but since this package isn't split that way, all three are listed. 105 license = with licenses; [ gpl2Only lgpl3Plus gpl3Plus ]; 106 maintainers = with maintainers; [ eelco r-burns ]; 107 }; 108}