1{ lib, stdenv, fetchurl, m4, zlib, bzip2, bison, flex, gettext, xz, setupDebugInfoDirs, argp-standalone }:
2
3# TODO: Look at the hardcoded paths to kernel, modules etc.
4stdenv.mkDerivation rec {
5 pname = "elfutils";
6 version = "0.180";
7
8 src = fetchurl {
9 url = "https://sourceware.org/elfutils/ftp/${version}/${pname}-${version}.tar.bz2";
10 sha256 = "17an1f67bfzxin482nbcxdl5qvywm27i9kypjyx8ilarbkivc9xq";
11 };
12
13 patches = [ ./debug-info-from-env.patch ];
14
15 hardeningDisable = [ "format" ];
16
17 # We need bzip2 in NativeInputs because otherwise we can't unpack the src,
18 # as the host-bzip2 will be in the path.
19 nativeBuildInputs = [ m4 bison flex gettext bzip2 ];
20 buildInputs = [ zlib bzip2 xz ]
21 ++ lib.optional stdenv.hostPlatform.isMusl argp-standalone;
22
23 propagatedNativeBuildInputs = [ setupDebugInfoDirs ];
24
25 preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
26 NIX_CFLAGS_COMPILE+=" -fgnu89-inline"
27 '';
28
29 configureFlags =
30 [ "--program-prefix=eu-" # prevent collisions with binutils
31 "--enable-deterministic-archives"
32 "--disable-debuginfod"
33 ];
34
35 enableParallelBuilding = true;
36
37 doCheck = false; # fails 3 out of 174 tests
38 doInstallCheck = false; # fails 70 out of 174 tests
39
40 meta = {
41 homepage = "https://sourceware.org/elfutils/";
42 description = "A set of utilities to handle ELF objects";
43 platforms = lib.platforms.linux;
44 license = lib.licenses.gpl3;
45 maintainers = [ lib.maintainers.eelco ];
46 };
47}