core/pkgs/by-name/li/libunwind/default.nix

77 lines
2.1 KiB
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{ stdenv, lib, fetchFromGitHub, fetchpatch, autoreconfHook, xz, buildPackages }:
stdenv.mkDerivation rec {
pname = "libunwind";
version = "1.8.1";
src = fetchFromGitHub {
owner = "libunwind";
repo = "libunwind";
rev = "v${version}";
hash = "sha256-rCFBHs6rCSnp5FEwbUR5veNNTqSQpFblAv8ebSPX0qE=";
};
postPatch = if (stdenv.cc.isClang || stdenv.hostPlatform.isStatic) then ''
substituteInPlace configure.ac --replace "-lgcc_s" ""
2024-05-13 21:24:10 +00:00
'' else
lib.optionalString stdenv.hostPlatform.isMusl ''
substituteInPlace configure.ac --replace "-lgcc_s" "-lgcc_eh"
'';
2024-05-02 00:46:19 +00:00
nativeBuildInputs = [ autoreconfHook ];
outputs = [ "out" "dev" "devman" ];
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"
]
# See https://github.com/libunwind/libunwind/issues/693
2024-05-13 21:24:10 +00:00
++ lib.optionals
(with stdenv.hostPlatform; isAarch64 && isMusl && !isStatic)
[ "CFLAGS=-mno-outline-atomics" ];
2024-05-02 00:46:19 +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
meta = with lib; {
homepage = "https://www.nongnu.org/libunwind";
2024-05-13 21:24:10 +00:00
description =
"A portable and efficient API to determine the call-chain of a program";
2024-05-02 00:46:19 +00:00
maintainers = with maintainers; [ orivej ];
# https://github.com/libunwind/libunwind#libunwind
2024-05-13 21:24:10 +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"
];
2024-05-02 00:46:19 +00:00
license = licenses.mit;
};
}