2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, pkg-config, musl-fts
|
|
|
|
, musl-obstack, m4, zlib, zstd, bzip2, bison, flex, gettext, xz, setupDebugInfoDirs
|
2021-04-05 15:23:46 +00:00
|
|
|
, argp-standalone
|
2022-10-21 18:38:19 +00:00
|
|
|
, enableDebuginfod ? false, sqlite, curl, libmicrohttpd, libarchive
|
2022-05-18 14:49:53 +00:00
|
|
|
, gitUpdater
|
2021-04-05 15:23:46 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# TODO: Look at the hardcoded paths to kernel, modules etc.
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "elfutils";
|
2023-03-15 16:39:30 +00:00
|
|
|
version = "0.189";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://sourceware.org/elfutils/ftp/${version}/${pname}-${version}.tar.bz2";
|
2023-03-15 16:39:30 +00:00
|
|
|
sha256 = "sha256-Ob2PGjOOK3zUq8P/EaDt3G5pD2lXildHjYF5tBSHCMg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
patches = [
|
|
|
|
./debug-info-from-env.patch
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-aarch64_fregs.patch";
|
|
|
|
url = "https://git.alpinelinux.org/aports/plain/main/elfutils/fix-aarch64_fregs.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9";
|
|
|
|
sha256 = "zvncoRkQx3AwPx52ehjA2vcFroF+yDC2MQR5uS6DATs=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "musl-asm-ptrace-h.patch";
|
|
|
|
url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-asm-ptrace-h.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9";
|
|
|
|
sha256 = "8D1wPcdgAkE/TNBOgsHaeTZYhd9l+9TrZg8d5C7kG6k=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "musl-macros.patch";
|
|
|
|
url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-macros.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9";
|
|
|
|
sha256 = "tp6O1TRsTAMsFe8vw3LMENT/vAu6OmyA8+pzgThHeA8=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "musl-strndupa.patch";
|
|
|
|
url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-strndupa.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9";
|
|
|
|
sha256 = "sha256-7daehJj1t0wPtQzTv+/Rpuqqs5Ng/EYnZzrcf2o/Lb0=";
|
|
|
|
})
|
2021-12-06 16:07:01 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isMusl [ ./musl-error_h.patch ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs tests/*.sh
|
2023-02-02 18:25:31 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isRiscV ''
|
|
|
|
# disable failing test:
|
|
|
|
#
|
|
|
|
# > dwfl_thread_getframes: No DWARF information found
|
|
|
|
sed -i s/run-backtrace-dwarf.sh//g tests/Makefile.in
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
outputs = [ "bin" "dev" "out" "man" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# We need bzip2 in NativeInputs because otherwise we can't unpack the src,
|
|
|
|
# as the host-bzip2 will be in the path.
|
2021-02-19 19:06:45 +00:00
|
|
|
nativeBuildInputs = [ m4 bison flex gettext bzip2 ]
|
2021-12-06 16:07:01 +00:00
|
|
|
++ lib.optional enableDebuginfod pkg-config;
|
|
|
|
buildInputs = [ zlib zstd bzip2 xz ]
|
2021-04-12 18:23:04 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isMusl [
|
2021-02-19 19:06:45 +00:00
|
|
|
argp-standalone
|
|
|
|
musl-fts
|
|
|
|
musl-obstack
|
2021-04-05 15:23:46 +00:00
|
|
|
] ++ lib.optionals enableDebuginfod [
|
|
|
|
sqlite
|
|
|
|
curl
|
2022-10-21 18:38:19 +00:00
|
|
|
libmicrohttpd
|
2021-04-05 15:23:46 +00:00
|
|
|
libarchive
|
2021-02-19 19:06:45 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedNativeBuildInputs = [ setupDebugInfoDirs ];
|
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--program-prefix=eu-" # prevent collisions with binutils
|
|
|
|
"--enable-deterministic-archives"
|
2021-12-06 16:07:01 +00:00
|
|
|
(lib.enableFeature enableDebuginfod "libdebuginfod")
|
|
|
|
(lib.enableFeature enableDebuginfod "debuginfod")
|
2021-02-19 19:06:45 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Backtrace unwinding tests rely on glibc-internal symbol names.
|
|
|
|
# Musl provides slightly different forms and fails.
|
|
|
|
# Let's disable tests there until musl support is fully upstreamed.
|
|
|
|
doCheck = !stdenv.hostPlatform.isMusl;
|
|
|
|
doInstallCheck = !stdenv.hostPlatform.isMusl;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
passthru.updateScript = gitUpdater {
|
|
|
|
url = "https://sourceware.org/git/elfutils.git";
|
|
|
|
rev-prefix = "elfutils-";
|
|
|
|
};
|
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://sourceware.org/elfutils/";
|
|
|
|
description = "A set of utilities to handle ELF objects";
|
2021-02-19 19:06:45 +00:00
|
|
|
platforms = platforms.linux;
|
2022-05-18 14:49:53 +00:00
|
|
|
# https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-November/004223.html
|
|
|
|
broken = stdenv.hostPlatform.isStatic;
|
2021-02-19 19:06:45 +00:00
|
|
|
# licenses are GPL2 or LGPL3+ for libraries, GPL3+ for bins,
|
|
|
|
# but since this package isn't split that way, all three are listed.
|
|
|
|
license = with licenses; [ gpl2Only lgpl3Plus gpl3Plus ];
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ eelco r-burns ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|