Alien-sqlite

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

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

use Env qw { @PATH };


my $min_target_version = '3.26.0';

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

plugin 'Probe::CommandLine' => (
  command  => 'sqlite3',
  #args    => [ '--version' ],
  #match   => qr/\d+\.\d+\.\d+ \d{4}-\d{2}-\d{2}/,
  #version => qr/gzip ([0-9\.]+)/,
  secondary => 1,  #  secondary to pkgconf probe
);

#  need to check if we have sqlite headers
#  as dependent aliens like proj need them
#probe sub {
#  my($build) = @_;  # $build is the Alien::Build instance.
#  system 'pkg-config --exists libfoo';
#  $? == 0 ? 'system' : 'share';
#};


share {

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

  #  need to work out how to get latest without updating next lines
  start_url 'https://www.sqlite.org/2022/sqlite-autoconf-3390300.tar.gz';
  plugin Download => (
    version => '3.39.3',
  );

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


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

  my $build_static = ($^O =~ /mswin/i) ? '' : '--disable-shared';
  $build_static = '';
  $build_static = '--enable-static=no';  #  override - needed?  leftover from gdal
  $build_static = '' if $ENV{FORCE_DYNAMIC};
  
  
  if ($^O =~ /bsd/) {
    plugin 'Build::Make' => 'gmake';
    if (-d '/usr/local') {
        $with_local = ' --with-local=/usr/local ';
    }
  }



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