summaryrefslogtreecommitdiffstats
path: root/pkgs/development/libraries/libunwind/default.nix
blob: b14a0040c43ecd1b2c65dafc9f846d50a34cf94e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
  stdenv,
  lib,
  fetchFromGitHub,
  autoreconfHook,
  buildPackages,
  xz,
  testers,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libunwind";
  version = "1.8.3";

  src = fetchFromGitHub {
    owner = "libunwind";
    repo = "libunwind";
    tag = "v${finalAttrs.version}";
    hash = "sha256-ed+FUPApDxNHxznXMhiTeNr8yRxRDSCyJJdIhouGNho=";
  };

  postPatch =
    if (stdenv.cc.isClang || stdenv.hostPlatform.isStatic) then
      ''
        substituteInPlace configure.ac --replace "-lgcc_s" ""
      ''
    else
      lib.optionalString stdenv.hostPlatform.isMusl ''
        substituteInPlace configure.ac --replace "-lgcc_s" "-lgcc_eh"
      '';

  nativeBuildInputs = [ autoreconfHook ];

  strictDeps = true;

  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"
  ];

  propagatedBuildInputs = [ xz ];

  enableParallelBuilding = true;

  postInstall = ''
    find $out -name \*.la | while read file; do
      sed -i 's,-llzma,${xz.out}/lib/liblzma.la,' $file
    done
  '';

  doCheck = false; # fails

  passthru.tests.pkg-config = testers.hasPkgConfigModules {
    package = finalAttrs.finalPackage;
    versionCheck = true;
  };

  __structuredAttrs = true;

  meta = {
    homepage = "https://www.nongnu.org/libunwind";
    description = "Portable and efficient API to determine the call-chain of a program";
    maintainers = [ ];
    pkgConfigModules = [
      "libunwind"
      "libunwind-coredump"
      "libunwind-generic"
      "libunwind-ptrace"
      "libunwind-setjmp"
    ];
    # https://github.com/libunwind/libunwind#libunwind
    platforms = [
      "aarch64-linux"
      "armv5tel-linux"
      "armv6l-linux"
      "armv7a-linux"
      "armv7l-linux"
      "i686-freebsd"
      "i686-linux"
      "loongarch64-linux"
      "mips64el-linux"
      "mipsel-linux"
      "powerpc-linux"
      "powerpc64-linux"
      "powerpc64le-linux"
      "riscv64-linux"
      "s390x-linux"
      "x86_64-freebsd"
      "x86_64-linux"
      "x86_64-solaris"
    ];
    license = lib.licenses.mit;
  };
})