Alien-geos-af

 view release on metacpan or  search on metacpan

alienfile  view on Meta::CPAN

  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};

alienfile  view on Meta::CPAN

    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;
    }

alienfile  view on Meta::CPAN

    #"-DGEOS_ENABLE_TESTS=$run_tests_bool_text", #  seems not be in the source tree?
    "-DBUILD_TESTING:BOOL=$run_tests_bool_text",
    #'-DCMAKE_BUILD_TYPE=Release',
    '-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true',
    '-DCMAKE_INSTALL_PREFIX:PATH=%{.install.prefix}',
    @rpath,
    '-DBUILD_GEOSOP=OFF',
    '..'
  ];
  
  #say join ' ', @$cmake_cmd;

  build [
    #\&set_rectangle_intersection,  #  disable
    #"%{configure} $with_local $with_cpp11 $build_static",
    #'echo %{make}',
    #\&pause,
    \&update_hilbert_encoder_h,
    'mkdir _build',
    'cd _build',
    $cmake_cmd,

alienfile  view on Meta::CPAN

sub set_rectangle_intersection {
    my ($build) = @_;
    
    #  disable as we get test failures in Biodiverse,
    #  which is probably for the same reasons this is
    #  disabled in GEOS in the first place
    return;  
    
    return if $build->install_type ne 'share';

    say 'set_rectangle_intersection: Currently in ' . getcwd();
    
    use File::Find::Rule;
    use Path::Tiny qw /path/;
    my (@files)
      = File::Find::Rule
                ->file()
                ->name( 'Geometry.cpp' )
                ->in( $base_dir );
    #  loop is brute force
    foreach my $file (@files) {
        say "Modifying file $file";
        path($file)->edit (
            sub {
              s{^//(#define USE_RECTANGLE_INTERSECTION 1)}{$1}ms;
            }
        );
    }
}

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

alienfile  view on Meta::CPAN

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) {
        say "Renaming $file so it will not interfere with gdal compilation";
        rename $file, $file . '.bak';
    }

}

sub pause {
    #return;  #  disable
    #return if !$on_windows || $on_automated_rig;

    say "CONTINUE?";
    my $response = <>;
    while (not $response =~ /yes/) {
        $response = <>;
    }
}

sub get_geos_version {
    my $h = get_alien_state_hash();
    return $h->{runtime}{version};
}



( run in 0.519 second using v1.01-cache-2.11-cpan-483215c6ad5 )