From ac512208e336e4242e8af71554cbd64e88718dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Thu, 24 Feb 2022 16:34:17 +0100 Subject: [PATCH] Add a libs_dynamic() method When Gather::IsolateDynamic plugin together with configure option -enable-shared, the alien client might want to know how to link with the shared version of the library. --- lib/Alien/Base.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Alien/Base.pm b/lib/Alien/Base.pm index 19e1178e..a2fa720a 100644 --- a/lib/Alien/Base.pm +++ b/lib/Alien/Base.pm @@ -349,6 +349,20 @@ sub libs { return $class->runtime_prop ? $class->_flags('libs') : $class->_pkgconfig_keyword('Libs'); } +sub libs_dynamic { + my $class = shift; + + my $libs = $class->libs; + return $libs if !$class->install_type("share"); + my $dyndir = $class->dynamic_dir; + return $libs if !$dyndir; + my $d_basename = Path::Tiny->new($dyndir)->basename; + my $l_dirname = $class->dist_dir; + my $l_basename = 'lib'; + $libs =~ s<-L${l_dirname}/\K$l_basename><$d_basename>; + return $libs; +} + =head2 libs_static my $libs = Alien::MyLibrary->libs_static;