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