Alien-spatialite

 view release on metacpan or  search on metacpan

alienfile  view on Meta::CPAN

use 5.010;
use alienfile;
use Sort::Versions;
use Path::Tiny qw /path/;

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();

use Alien::proj;
use Alien::sqlite;
use Alien::freexl;
use Alien::geos::af;

my @alien_deps = qw( Alien::sqlite Alien::proj Alien::freexl Alien::geos::af );

my $sep_char = $on_windows ? ';' : ':';
$ENV{PATH} .= $sep_char
           . join ($sep_char,
                   Alien::sqlite->bin_dir,
                   Alien::proj->bin_dir,
                   Alien::freexl->bin_dir,
                   Alien::geos::af->bin_dir,
            );

plugin 'Build::SearchDep' => (
  aliens   => [@alien_deps],
  public_I => 1,
  public_l => 1,
);

#  make libtool noisy for debug purposes
#$ENV{LTFLAGS} = "--debug --verbose" if $on_windows;



my $min_target_version = '5.0.0';

plugin 'PkgConfig' => (
    pkg_name => 'spatialite',
    minimum_version => $min_target_version,
);


share {

  my $with_local = '';
  my $with_cpp11 = '';

  start_url 'https://www.gaia-gis.it/gaia-sins/libspatialite-sources/';
  #start_url "file://$base_dir";  #  debug
  plugin Download => (
    filter  => qr/^libspatialite-([0-9\.]+[a-z]?)\.tar\.gz$/,
    version => qr/^libspatialite-([0-9\.]+[a-z]?)\.tar\.gz$/,
  );

  my $lib_version = get_lib_version() // 'not yet defined';
  say "Downloaded spatialite version is $lib_version";
  
  plugin Extract => (format => 'tar.gz');


  plugin 'Build::Autoconf' => ();
  plugin 'PkgConfig::PPWrapper';

  my $build_static = ($^O =~ /mswin/i) ? '' : '--disable-shared';
  #$build_static = '';
  #$build_static = '--enable-static=no';  #  override - needed?  leftover from gdal
  $build_static = '--enable-shared=yes';
  #$build_static = '' if $ENV{FORCE_DYNAMIC};

  # most of these are crude  
  # we can enable librttopo when we have an alien for it
  my $extra_build_args
    = ($on_windows ? '--target=mingw32 ' : '')
      . join ' ', (qw /
      --enable-libxml2=no
      --enable-examples=no
      --enable-minizip=no
      --disable-rttopo
      --disable-gcp
    /);

  #  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 ($^O =~ /bsd/) {
    plugin 'Build::Make' => 'gmake';
    if (-d '/usr/local') {
        $with_local = ' --with-local=/usr/local ';



( run in 0.648 second using v1.01-cache-2.11-cpan-39bf76dae61 )