Alien-proj
view release on metacpan or search on metacpan
= $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();
use Env qw( @PATH @PKG_CONFIG_PATH );
use Alien::sqlite;
unshift @PATH, Alien::sqlite->bin_dir;
my @dep_aliens = ('Alien::sqlite');
my %have;
my $lib = 'Alien::curl';
$have{$lib} = eval "require $lib";
if ($have{$lib}) {
unshift @PATH, $lib->dist_dir . '/dynamic';
}
$lib = 'Alien::libtiff';
$have{$lib} = eval "require $lib";
if ($have{$lib}) {
#say 'Adding libtiff dependency';
unshift @PATH, $lib->bin_dir;
push @dep_aliens, $lib if $lib->install_type eq 'share';
my $p;
if ($on_windows && $lib->install_type eq 'system') {
# dirty hack for strawberry perl
$p = path ($^X)->parent->parent->parent . '/c/lib/pkgconfig';
}
elsif ($lib->install_type eq 'share') {
$p = path ($lib->dist_dir, 'lib', 'pkgconfig');
}
if ($p && -e $p) {
push @PKG_CONFIG_PATH, $p;
say join ' ', @PKG_CONFIG_PATH;
}
}
say "Alien::sqlite has sqlite version " . Alien::sqlite->version;
my $min_target_version = '7.1';
plugin 'PkgConfig' => (
pkg_name => 'proj',
minimum_version => $min_target_version,
);
if ($on_windows) {
# possible GIS Internals distribution
if (my $path = `where geos_c.dll`) {
Alien::Build->log ('Found possible GIS Internals build');
$path = Path::Tiny::path ($path)->parent;
# could be several variants
my @proj_dlls
= map {$_->[0]}
sort { versioncmp($a->[-1], $b->[-1]) }
map { $_ =~ /(\d+)_(\d+)/; [$_, "$1.$2"] }
glob ("$path/proj*.dll");
$proj_dlls[-1] =~ /(\d+)_(\d+)/;
my $version = "$1.$2";
if (versioncmp ($version, $min_target_version) > 0) {
$path = Path::Tiny::path($proj_dlls[-1])->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 -lproj",
);
}
}
}
share {
# see if this helps with cirrus bsd builds
#$ENV{SQLITE3_CFLAGS} = Alien::sqlite->cflags;
#$ENV{SQLITE3_LIBS} = Alien::sqlite->libs;
#say "sqlite cflags: " . Alien::sqlite->cflags;
#say "sqlite libs: " . Alien::sqlite->libs;
#if ($have{'Alien::libtiff'}) {
# my $p = path ('Alien::libtiff'->dist_dir, 'lib');
# $ENV{TIFF_LIBS}
# ||= (-e $p
# ? "-L$p "
# : ''
# )
# . 'Alien::libtiff'->libs;
# say "libtiff libs: $ENV{TIFF_LIBS}";
#}
plugin 'Build::SearchDep' => (
aliens => [ grep {$_->install_type eq 'share'} @dep_aliens ],
public_I => 1,
public_l => 1,
);
if ($on_windows) {
# there are issues with strawberry perl's gcc
plugin 'Prefer::BadVersion' => '7.1.0';
}
start_url 'https://download.osgeo.org/proj/';
#start_url "file://$base_dir"; # debug
plugin Download => (
filter => qr/^proj-([0-9\.]+)\.tar\.gz$/,
version => qr/^proj-([0-9\.]+)\.tar\.gz$/,
);
my $proj_version = get_proj_version() // 'not yet defined';
say "Downloaded proj version is $proj_version";
die "Downloaded proj version $proj_version is too low "
. "(should be >= $min_target_version).\n"
. "Please update your Alien::Build::Fetch::Cache if using one."
if defined $proj_version
&& versioncmp ($proj_version, $min_target_version) < 0;
( run in 0.514 second using v1.01-cache-2.11-cpan-6b5c3043376 )