1 { stdenv, lib, fetchurl, fetchpatch, autoreconfHook, xz, buildPackages }:
3 stdenv.mkDerivation rec {
8 url = "mirror://savannah/libunwind/${pname}-${version}.tar.gz";
9 sha256 = "sha256-SmrsZmmR+0XQiJxErt6K1usQgHHDVU/N/2cfnJR5SXY=";
13 # Fix for aarch64 and non-4K pages. Remove once upgraded past 1.6.2.
15 url = "https://github.com/libunwind/libunwind/commit/e85b65cec757ef589f28957d0c6c21c498a03bdf.patch";
16 sha256 = "1lnlygvhqrdrjgw303pg2k2k4ms4gaghpjsgmhk47q83vy1yjwfg";
20 postPatch = if (stdenv.cc.isClang || stdenv.hostPlatform.isStatic) then ''
21 substituteInPlace configure.ac --replace "-lgcc_s" ""
22 '' else lib.optionalString stdenv.hostPlatform.isMusl ''
23 substituteInPlace configure.ac --replace "-lgcc_s" "-lgcc_eh"
26 nativeBuildInputs = [ autoreconfHook ];
28 outputs = [ "out" "dev" "devman" ];
30 # Without latex2man, no man pages are installed despite being
31 # prebuilt in the source tarball.
32 configureFlags = [ "LATEX2MAN=${buildPackages.coreutils}/bin/true" ];
34 propagatedBuildInputs = [ xz ];
37 find $out -name \*.la | while read file; do
38 sed -i 's,-llzma,${xz.out}/lib/liblzma.la,' $file
42 doCheck = false; # fails
45 homepage = "https://www.nongnu.org/libunwind";
46 description = "A portable and efficient API to determine the call-chain of a program";
47 maintainers = with maintainers; [ orivej ];
48 # https://github.com/libunwind/libunwind#libunwind
49 platforms = [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-freebsd13" "i686-linux" "mips64el-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv64-linux" "x86_64-freebsd13" "x86_64-linux" "x86_64-solaris" ];
50 license = licenses.mit;