Alien-gdal

 view release on metacpan or  search on metacpan

lib/Alien/gdal.pm  view on Meta::CPAN

        if ($self->install_type('system') and defined $ENV{HOMEBREW_PREFIX}) {
            my @dylibs = $self->dynamic_libs;
            if (path ($ENV{HOMEBREW_PREFIX})->subsumes($dylibs[0])) {
                $options{search_path} = [ "$ENV{HOMEBREW_PREFIX}/lib/pkgconfig" ];
            }
        }

        my $o = PkgConfig->find('gdal', %options);
        if ($o->errmsg) {
            warn $o->errmsg;
        }
        else {
            $path = $o->get_var('datadir');
            if ($path =~ m|/data$|) {
                my $alt_path = $path;
                $alt_path =~ s|/data$||;
                if (!-d $path && -d $alt_path) {
                    #  GDAL 2.3.x and earlier erroneously appended /data
                    $path = $alt_path;
                }
            }
        }
    }

    warn "Cannot find gdal data dir"
      if not (defined $path and -d $path);

    return $path;
}

1;

__END__

=head1 NAME

Alien::gdal - Compile GDAL, the Geographic Data Abstraction Library

=head1 BUILD STATUS
 
=begin HTML
 
<p>
    <img src="https://img.shields.io/badge/perl-5.10+-blue.svg" alt="Requires Perl 5.10+" />
    <a href="https://travis-ci.org/shawnlaffan/perl-alien-gdal"><img src="https://travis-ci.org/shawnlaffan/perl-alien-gdal.svg?branch=master" /></a>
    <a href="https://ci.appveyor.com/project/shawnlaffan/perl-alien-gdal"><img src="https://ci.appveyor.com/api/projects/status/1tqk5rd40cv2ve8q?svg=true" /></a>
</p>

=end HTML

=head1 SYNOPSIS

    use Alien::gdal;

    use Env qw(@PATH);
    unshift @PATH, Alien::gdal->bin_dir;

    print Alien::gdal->dist_dir;

    #  assuming you have populated @args already
    my ($stdout, $stderr, $exit_code)
      = Alien::gdal->run_utility ('gdalwarp', @args);
    #  Note that this is currently experimental.
    #  Please report issues and solutions.  
    
    #  Access the GDAL data directory
    #  (note that not all system installs include it)
    my $path = Alien::gdal->data_dir;
    
=head1 DESCRIPTION

GDAL is the Geographic Data Abstraction Library.  See L<http://www.gdal.org>.

=head1 Environment Variables

User defined CMake arguments can be passed using the C<< ALIEN_GDAL_CMAKE_ARGS >>
environment variable. e.g. to disable the search for PDF and KML libs, set it to
C<< "-DGDAL_ENABLE_DRIVER_PDF:BOOL=OFF -DGDAL_USE_LIBKML=OFF" >>.



=head1 REPORTING BUGS

Please send any bugs, suggestions, or feature requests to 
L<https://github.com/shawnlaffan/perl-alien-gdal/issues>.

=head1 SEE ALSO

L<Geo::GDAL>

L<Geo::GDAL::FFI>

L<Alien::geos::af>

=head1 AUTHORS

Shawn Laffan, E<lt>shawnlaffan@gmail.comE<gt>

Jason Mumbulla (did all the initial work - see git log for details)

Ari Jolma

=head1 COPYRIGHT AND LICENSE


Copyright 2017- by Shawn Laffan and Jason Mumbulla


This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. 

=cut



( run in 1.465 second using v1.01-cache-2.11-cpan-2398b32b56e )