about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libexecinfo/default.nix
blob: 9c649c223c122f67c6f1ba37682d9c296ef422d4 (plain) (blame)
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
{ stdenv, fetchurl, fetchpatch, enableStatic ? true, enableShared ? true }:

stdenv.mkDerivation rec {
  pname = "libexecinfo";
  version = "1.1";

  src = fetchurl {
    url = "http://distcache.freebsd.org/local-distfiles/itetcu/${pname}-${version}.tar.bz2";
    sha256 = "07wvlpc1jk1sj4k5w53ml6wagh0zm9kv2l1jngv8xb7xww9ik8n9";
  };

  patches = [
    (fetchpatch {
      name = "10-execinfo.patch";
      url = "https://git.alpinelinux.org/aports/plain/main/libexecinfo/10-execinfo.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1";
      sha256 = "0lnphrad4vspyljnvmm62dyxj98vgp3wabj4w3vfzfph7j8piw7g";
    })
    (fetchpatch {
      name = "20-define-gnu-source.patch";
      url = "https://git.alpinelinux.org/aports/plain/main/libexecinfo/20-define-gnu-source.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1";
      sha256 = "1mp8mc639b0h2s69m5z6s2h3q3n1zl298j9j0plzj7f979j76302";
    })
    (fetchpatch {
      name = "30-linux-makefile.patch";
      url = "https://git.alpinelinux.org/aports/plain/main/libexecinfo/30-linux-makefile.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1";
      sha256 = "1jwjz22z5cjy5h2bfghn62yl9ar8jiqhdvbwrcfavv17ihbhwcaf";
    })
  ];

  makeFlags = [ "CC:=$(CC)" "AR:=$(AR)" ];

  buildFlags =
      stdenv.lib.optional enableStatic "static"
   ++ stdenv.lib.optional enableShared "dynamic";

  patchFlags = [ "-p0" ];

  installPhase = ''
    install -Dm644 execinfo.h stacktraverse.h -t $out/include
  '' + stdenv.lib.optionalString enableShared ''
    install -Dm755 libexecinfo.so.1 -t $out/lib
    ln -s $out/lib/libexecinfo.so{.1,}
  '' + stdenv.lib.optionalString enableStatic ''
    install -Dm755 libexecinfo.a -t $out/lib
  '';

  meta = with stdenv.lib; {
    description = "Quick-n-dirty BSD licensed clone of the GNU libc backtrace facility";
    license = licenses.bsd2;
    homepage = "https://www.freshports.org/devel/libexecinfo";
    maintainers = with maintainers; [ dtzWill ];
  };
}