On Mon, Aug 11, 2014 at 04:33:09PM -0400, Dave Rolsky via RT wrote:
Show quoted text> First of all, I don't think the "-lmagic" bit is necessary. After all, that's what I'm trying to check with Config::AutoConf.
If I don't set
CONFIGURE_ARGS += "LIBS=-L/usr/local/lib -lmagic"
make test fails. I need both of them, -L and -l.
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
/usr/bin/perl:/usr/ports/pobj/p5-File-LibMagic-1.02/File-LibMagic-1.02/blib/arch/auto/File/LibMagic/LibMagic.so: undefined symbol 'magic_close'
They seem to store the required libraries and paths in
/usr/local/libdata/perl5/site_perl/amd64-openbsd/auto/File/LibMagic/LibMagic.so
so the dynamic loader finds the dependent library automatically.
Show quoted text> As to the rest, it's possible to pass extra args such as "extra_include_dirs" and "extra_link_flags" to Config::AutoConf->new and have it use that. I could change the Makefile.PL to accept some CLI args.
With this hardcoded patch, I can build the module.
--- Makefile.PL.orig Sat Jul 26 18:53:32 2014
+++ Makefile.PL Mon Aug 11 22:59:45 2014
@@ -10,8 +10,12 @@ use ExtUtils::MakeMaker 6.30;
use lib qw( inc );
use Config::AutoConf;
-unless ( Config::AutoConf->check_header('magic.h')
- && Config::AutoConf->check_lib( 'magic', 'magic_open' ) ) {
+my $ac = Config::AutoConf->new(
+ extra_link_flags => [ "-L/usr/local/lib" ],
+);
+
+unless ( $ac->check_header('magic.h')
+ && $ac->check_lib( 'magic', 'magic_open' ) ) {
warn <<'EOF';
This module requires the libmagic.so library and magic.h header. See
Show quoted text> Also, I don't suppose that libmagic uses pkg-config. C::AC can use that to find the necessary flags.
I have never used pkg-config.