Alien-geos-af
view release on metacpan or search on metacpan
use 5.010;
use alienfile;
use Sort::Versions;
use Path::Tiny;
my $on_windows = ($^O =~ /mswin/i);
my $on_automated_rig
= $ENV{PERL_CPAN_REPORTER_DIR}
|| $ENV{PERL_CPAN_REPORTER_CONFIG}
|| $ENV{AUTOMATED_TESTING}
|| $ENV{TRAVIS}
|| $ENV{APPVEYOR}
|| $ENV{CI};
use Cwd;
my $base_dir = getcwd();
configure {
requires
'File::Copy' => 0,
'File::Find::Rule' => 0,
'Capture::Tiny' => 0;
};
my $min_target_version = '3.6.0';
plugin 'Build::MSYS';
plugin 'PkgConfig' => (
pkg_name => 'geos',
atleast_version => $min_target_version,
);
plugin 'Probe::CommandLine' => (
command => 'geos-config',
args => [ '--version' ],
version => qr/([0-9\.]+)/,
atleast_version => $min_target_version,
);
if ($on_windows) {
if (my $path = `where geos_c.dll`) {
$path = Path::Tiny::path ($path)->parent->parent->stringify;
$path =~ s|\\|/|g; # path separators
Alien::Build->log ("Probe::CBuilder checking $path");
plugin 'Probe::CBuilder' => (
cflags => "-I$path/include",
libs => "-L$path/lib -lgeos -lgeos_c",
);
}
}
share {
my $with_local = '';
my $with_cpp11 = '';
start_url 'https://download.osgeo.org/geos';
#start_url "file://$base_dir"; # debug
plugin Download => (
filter => qr/^geos-([0-9\.]+)\.tar\.bz2$/,
version => qr/^geos-([0-9\.]+)\.tar\.bz2$/,
);
my $geos_version = get_geos_version() // 'not yet defined';
say "Downloaded version is $geos_version";
plugin Extract => (format => 'tar.bz2');
#plugin 'Build::Autoconf' => ();
plugin 'Build::CMake';
my $build_static = ($on_windows) ? '' : '--disable-shared';
$build_static = '';
$build_static = '--enable-static=no'; # override - HUGE files if static
#$build_static = '' if $ENV{FORCE_DYNAMIC};
if ($^O =~ /bsd/) {
plugin 'Build::Make' => 'gmake';
if (-d '/usr/local') {
$with_local = ' --with-local=/usr/local ';
}
}
elsif ($^O =~ /dragonfly/) {
# might need to be combined with bsd check above
# but not sure if /usr/local is needed yet
plugin 'Build::Make' => 'gmake';
}
elsif ($^O eq 'MSWin32') {
plugin 'Build::Make' => 'gmake';
}
my $make_cmd = '%{make}';
my $make_inst_cmd = '%{make} install';
my $run_tests = $ENV{ALIEN_GEOS_ENABLE_TESTS};
my $run_tests_bool_text = $run_tests ? 'ON' : 'OFF';
# try not to exceed the cpan-testers log limits
if ($on_automated_rig) {
say "Running under CI or automated testing";
$make_cmd .= q/ | perl -ne "BEGIN {$|=1; open our $log, q|>|, q|build.log|}; print qq|\n| if 0 == ($. %% 100); print q|.|; print {$log} $_;" || type build.log/;
$make_inst_cmd .= q/ | perl -ne "BEGIN {$|=1; open our $log, q|>|, q|install.log|}; print qq|\n| if 0 == ($. %% 100); print q|.|; print {$log} $_;" || type install.log/;
if (!$on_windows) {
$make_cmd =~ s/%%/%/;
$make_cmd =~ s/type/cat/;
$make_cmd =~ s/"/'/g;
$make_inst_cmd =~ s/%%/%/;
$make_inst_cmd =~ s/type/cat/;
$make_inst_cmd =~ s/"/'/g;
}
# clean up the build dir on cpan testers etc
#plugin 'Cleanse::BuildDir';
}
meta->around_hook(
build => sub {
my ($orig, $build, @args) = @_;
( run in 0.383 second using v1.01-cache-2.11-cpan-d6968d3fc7c )