Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, fetchpatch 2, enableStatic ? true 3, enableShared ? !stdenv.hostPlatform.isStatic 4}: 5 6stdenv.mkDerivation rec { 7 pname = "libexecinfo"; 8 version = "1.1"; 9 10 src = fetchurl { 11 url = "http://distcache.freebsd.org/local-distfiles/itetcu/${pname}-${version}.tar.bz2"; 12 sha256 = "07wvlpc1jk1sj4k5w53ml6wagh0zm9kv2l1jngv8xb7xww9ik8n9"; 13 }; 14 15 patches = [ 16 (fetchpatch { 17 name = "10-execinfo.patch"; 18 url = "https://git.alpinelinux.org/aports/plain/main/libexecinfo/10-execinfo.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1"; 19 sha256 = "0lnphrad4vspyljnvmm62dyxj98vgp3wabj4w3vfzfph7j8piw7g"; 20 }) 21 (fetchpatch { 22 name = "20-define-gnu-source.patch"; 23 url = "https://git.alpinelinux.org/aports/plain/main/libexecinfo/20-define-gnu-source.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1"; 24 sha256 = "1mp8mc639b0h2s69m5z6s2h3q3n1zl298j9j0plzj7f979j76302"; 25 }) 26 ./30-linux-makefile.patch 27 ]; 28 29 makeFlags = [ "CC:=$(CC)" "AR:=$(AR)" ]; 30 hardeningEnable = [ "stackprotector" ]; 31 32 buildFlags = 33 lib.optional enableStatic "static" 34 ++ lib.optional enableShared "dynamic"; 35 36 patchFlags = [ "-p0" ]; 37 38 installPhase = '' 39 install -Dm644 execinfo.h stacktraverse.h -t $out/include 40 '' + lib.optionalString enableShared '' 41 install -Dm755 libexecinfo.so.1 -t $out/lib 42 ln -s $out/lib/libexecinfo.so{.1,} 43 '' + lib.optionalString enableStatic '' 44 install -Dm755 libexecinfo.a -t $out/lib 45 ''; 46 47 meta = with lib; { 48 description = "Quick-n-dirty BSD licensed clone of the GNU libc backtrace facility"; 49 license = licenses.bsd2; 50 homepage = "https://www.freshports.org/devel/libexecinfo"; 51 maintainers = with maintainers; [ dtzWill ]; 52 }; 53}