libexecinfo: fix building statically

This commit is contained in:
Matthew Bauer 2020-06-08 17:16:42 -05:00
parent c86af902f4
commit a9924d7ab8
2 changed files with 11 additions and 2 deletions

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchpatch }:
{ stdenv, fetchurl, fetchpatch, enableStatic ? true, enableShared ? true }:
stdenv.mkDerivation rec {
pname = "libexecinfo";
@ -29,12 +29,19 @@ stdenv.mkDerivation rec {
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
install -Dm755 libexecinfo.{a,so.1} -t $out/lib
'' + 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; {

View file

@ -274,4 +274,6 @@ in {
libev = super.libev.override { static = true; };
libexecinfo = super.libexecinfo.override { enableShared = false; };
}