Alien-spatialite

 view release on metacpan or  search on metacpan

alienfile  view on Meta::CPAN

    if (-d '/usr/local') {
        $with_local = ' --with-local=/usr/local ';
    }
    if (!-e '/usr/local/include/sqlite3.h' && Alien::sqlite->install_type eq 'system') {
      warn '/usr/local/include/sqlite3.h does not exist, '
         . 'you might need to install the sqlite package for your system, '
         . 'or install a share version of Alien::sqlite';
    }
  }
  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';
  }

  my $make_cmd = '%{make}';
  my $make_inst_cmd = '%{make} install';
  my @make_clean;
  #  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 => \&set_compiler_flags );
  meta->around_hook(
    build => sub {
      my ($orig, $build, @args) = @_;
      $build->log("Setting CCACHE_BASEDIR to " . getcwd());
      local $ENV{CCACHE_BASEDIR} = getcwd();
      $orig->($build, @args);
    }
  );

  meta->before_hook( build => \&update_configure_freebsd );

  build [
    "%{configure} $with_local $with_cpp11 $build_static $extra_build_args",
    \&pause,
    $make_cmd,
    \&patch_rpaths,
    \&rename_la_files,
    $make_inst_cmd,
    #@make_clean
  ];

};


sub update_configure_freebsd {
  my ($build) = @_;

  return if not $^O =~ /bsd/;

  $build->log ('Updating configure for FreeBSD');

  use File::Find::Rule;
  my @configures
    = File::Find::Rule->file()
                        ->name( 'configure' )
                        ->in( '.' );
  
  foreach my $fname (@configures) {
    $build->log ($fname);
    my $permissions = (stat ($fname))[2];
    open my $fh, $fname or die $!;
    my $text = do {local $/ = undef; <$fh>};
    $fh->close;
    $text =~ s/(freebsd[12])\*/$1.*/gms;
    $text =~ s/(freebsd\[123?\])\*/$1.*/gms;
    rename $fname, "$fname.bak";
    open my $ofh, '>', $fname or die $!;
    print {$ofh} $text;
    $ofh->close;
    chmod $permissions, $fname;
  }
  
  return;
}

sub rename_la_files {
    #  need to return if not share
    return if !$on_windows;
    
    use File::Find::Rule;
    my @la_files
      = File::Find::Rule->file()
                        ->name( '*.la' )
                        ->in( '.' );
    foreach my $file (@la_files) {
        Alien::Build->log("Renaming $file so it will not interfere with gdal compilation");
        rename $file, $file . '.bak';
    }

}

#  should be a gather hook working on the stage dir
sub patch_rpaths {
  my ($build) = @_;
  
  #  only run on unices - incomplete check but
  #  I don't think aliens work on VMS or zOS
  return if ($on_windows or $^O =~ /darwin/i);

  my $h = get_alien_state_hash();
  my $install_path = $h->{install}{prefix};
  return if !defined $install_path;

  my @alien_rpaths;
  for my $alien (@alien_deps) {



( run in 0.445 second using v1.01-cache-2.11-cpan-796a6f069b2 )