1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 enableStatic ? stdenv.hostPlatform.isStatic,
6 enableShared ? !stdenv.hostPlatform.isStatic,
7 unstableGitUpdater,
8 autoreconfHook,
9}:
10
11stdenv.mkDerivation {
12 pname = "libbacktrace";
13 version = "0-unstable-2024-03-02";
14
15 src = fetchFromGitHub {
16 owner = "ianlancetaylor";
17 repo = "libbacktrace";
18 rev = "28824f2cc9069e3fdc39d3702acdf753e35c41b4";
19 sha256 = "1k1O1GT22hZAWPF8NYP0y4qe+e3pGfzT9Mz2TH+H/v4=";
20 };
21
22 patches = [
23 # Fix tests with shared library.
24 # https://github.com/ianlancetaylor/libbacktrace/pull/99
25 ./0001-libbacktrace-avoid-libtool-wrapping-tests.patch
26
27 # Support multiple debug dirs.
28 # https://github.com/ianlancetaylor/libbacktrace/pull/100
29 ./0002-libbacktrace-Allow-configuring-debug-dir.patch
30 ./0003-libbacktrace-Support-multiple-build-id-directories.patch
31
32 # Support NIX_DEBUG_INFO_DIRS environment variable.
33 ./0004-libbacktrace-Support-NIX_DEBUG_INFO_DIRS-environment.patch
34 ];
35
36 nativeBuildInputs = [
37 autoreconfHook
38 ];
39
40 configureFlags = [
41 (lib.enableFeature enableStatic "static")
42 (lib.enableFeature enableShared "shared")
43 ];
44
45 doCheck = stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isMusl;
46
47 passthru = {
48 updateScript = unstableGitUpdater { };
49 };
50
51 meta = with lib; {
52 description = "C library that may be linked into a C/C++ program to produce symbolic backtraces";
53 homepage = "https://github.com/ianlancetaylor/libbacktrace";
54 maintainers = with maintainers; [ twey ];
55 license = with licenses; [ bsd3 ];
56 };
57}