2024-06-05 15:53:02 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, autoreconfHook, xz, buildPackages }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libunwind";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.8.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libunwind";
|
|
|
|
repo = "libunwind";
|
|
|
|
rev = "v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-rCFBHs6rCSnp5FEwbUR5veNNTqSQpFblAv8ebSPX0qE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
postPatch = if (stdenv.cc.isClang || stdenv.hostPlatform.isStatic) then ''
|
2021-12-19 01:06:50 +00:00
|
|
|
substituteInPlace configure.ac --replace "-lgcc_s" ""
|
|
|
|
'' else lib.optionalString stdenv.hostPlatform.isMusl ''
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace configure.ac --replace "-lgcc_s" "-lgcc_eh"
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
outputs = [ "out" "dev" "devman" ];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
configureFlags = [
|
|
|
|
# Starting from 1.8.1 libunwind installs testsuite by default.
|
|
|
|
# As we don't run the tests we disable it (this also fixes circular
|
|
|
|
# reference install failure).
|
|
|
|
"--disable-tests"
|
|
|
|
# Without latex2man, no man pages are installed despite being
|
|
|
|
# prebuilt in the source tarball.
|
|
|
|
"LATEX2MAN=${buildPackages.coreutils}/bin/true"
|
|
|
|
]
|
2024-01-25 14:12:00 +00:00
|
|
|
# See https://github.com/libunwind/libunwind/issues/693
|
|
|
|
++ lib.optionals (with stdenv.hostPlatform; isAarch64 && isMusl && !isStatic) [
|
|
|
|
"CFLAGS=-mno-outline-atomics"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ xz ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
find $out -name \*.la | while read file; do
|
|
|
|
sed -i 's,-llzma,${xz.out}/lib/liblzma.la,' $file
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = false; # fails
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.nongnu.org/libunwind";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Portable and efficient API to determine the call-chain of a program";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ orivej ];
|
2023-01-20 10:41:00 +00:00
|
|
|
# https://github.com/libunwind/libunwind#libunwind
|
2024-05-15 15:35:15 +00:00
|
|
|
platforms = [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-freebsd" "i686-linux" "loongarch64-linux" "mips64el-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv64-linux" "s390x-linux" "x86_64-freebsd" "x86_64-linux" "x86_64-solaris" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|