Alien-SWIProlog
view release on metacpan or search on metacpan
local $Data::Dumper::Terse = 1;
local $Data::Dumper::Sortkeys = 1;
find_PL($build);
# when not found
return 'share' unless keys %$PLVARS;
$build->log( Dumper($PLVARS) );
my %threads_support = (
swipl_threads => $PLVARS->{PLTHREADS} eq 'yes',
perl_usethreads => defined($Config::Config{usethreads}),
perl_useithreads => defined($Config::Config{useithreads}),
);
my $all_threads = List::Util::all(
sub { $threads_support{$_} },
keys %threads_support );
my $all_nonthreads = List::Util::all(
sub { ! $threads_support{$_} },
keys %threads_support );
unless( $all_threads || $all_nonthreads ) {
$build->log(
"Threading models of SWI-Prolog and Perl do not match: "
. Dumper(\%threads_support)
);
return 'share';
}
my $prop = Alien::SWIProlog::Util::plvars_to_props($PL_path, $PLVARS);
eval {
require ExtUtils::CBuilder;
my $b = ExtUtils::CBuilder->new();
my $src = Path::Tiny->tempfile( SUFFIX => '.c' );
plugin Extract => 'tar.gz';
plugin 'Build::CMake';
patch sub {
my @files = qw( src/SWI-Prolog.h src/os/pl-prologflag.c src/pl-fli.c );
system( $^X, qw(-pi -e), q{ s/\bPL_version\b/Swi$&/ }, @files );
};
my $threads = $Config{useithreads} ? '-DMULTI_THREADED=ON' : '-DMULTI_THREADED=OFF';
my @other_cmake_args = ();
my $is_msys2_mingw = $^O eq 'MSWin32' && exists $ENV{MSYSTEM} && $ENV{MSYSTEM} =~ /^mingw(32|64)$/i;
if( $is_msys2_mingw && File::Which::which('cygpath') ) {
# Running under MSYS2
chomp( my $MINGW_ROOT = `cygpath -m /$ENV{MSYSTEM}` );
push @other_cmake_args, "-DMINGW_ROOT=$MINGW_ROOT";
# current build not set up to link with libarchive correctly
push @other_cmake_args, '-DSWIPL_PACKAGES_ARCHIVE=OFF';
# not able to generate certs for tests due to missing
# openssl.cnf
push @other_cmake_args, '-DSKIP_SSL_TESTS=ON';
}
}
build [
[ '%{cmake}',
@{ meta->prop->{plugin_build_cmake}->{args} },
@other_cmake_args,
$threads,
# no X11 library
qw(-DSWIPL_PACKAGES_X=OFF),
# do not build docs
qw(-DINSTALL_DOCUMENTATION=OFF),
# install shared library under lib, not lib/$arch
qw(-DSWIPL_INSTALL_IN_LIB=ON),
'.',
],
sub {
if( $is_msys2_mingw ) {
( run in 0.330 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )