Alien-gdal
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
$build ->log ("Calling: $otool, '-l', $so_file");
#eval {
($otool_text, $stderr, @errors)
= capture {system $otool, '-l', $so_file};
#};
#$build->log ($@) if $@;
#$build->log (@errors) if @errors;
$build->log ($stderr) if $stderr;
#$build->log($otool_text); # debug
# now we need to extract the rpaths
my @lines = split "\n", $otool_text;
my @existing_paths;
while (defined (my $line = shift @lines)) {
if ($line =~ /RPATH/) {
shift @lines;
$line = shift @lines;
$line =~ s/^\s+path\s//;
$line =~ s/\s\(offset.+$//;
push @existing_paths, $line;
}
}
# remove existing
if (@existing_paths) {
$build->log ("removing existing rpaths " . join ' ', @existing_paths);
my @delete_args = map {; '-delete_rpath' => $_} @existing_paths;
($result, $stderr, @errors)
= capture {system $install_name_tool, @delete_args, $so_file};
#$build->log($result);
$build->log($stderr) if $stderr;
}
# now append the existing ones
push @inst_tool_rpath_args, map {; '-add_rpath' => $_} @existing_paths;
# prepend our paths
($result, $stderr, @errors)
= capture {system $install_name_tool, @inst_tool_rpath_args, $so_file};
#$build->log($result);
$build->log($stderr) if $stderr;
}
return;
}
# we can get dangling -L values
# bandaid until we find the source
sub cleanup_ldflags {
my ($build, @args) = @_;
if ($ENV{LDFLAGS} && $ENV{LDFLAGS} =~ /\s*-L\s*$/) {
$build->log("Trimming trailing -L from $ENV{LDFLAGS}");
$ENV{LDFLAGS} =~ s/\s*-L\s*$//;
}
#$orig->($build, @args);
return;
}
sub update_pkg_conf_path {
return if !$on_windows;
use Env qw /@PKG_CONFIG_PATH/;
say 'Modifying drive paths in PKG_CONFIG_PATH';
say $ENV{PKG_CONFIG_PATH};
# msys-ificate drive paths
@PKG_CONFIG_PATH = map {my $x = $_; $x =~ s{^([a-z]):}{/$1}i; $x} @PKG_CONFIG_PATH;
say $ENV{PKG_CONFIG_PATH};
return;
}
# git for windows clashes with MSYS
# if its /usr/bin dir is in the path
sub remove_gitfw_from_path {
my ($orig, $build, @args) = @_;
return $orig->($build, @args)
if !$on_windows;
local $ENV{PATH} = $ENV{PATH};
my $msys_path = eval {
path('Alien::MSYS'->msys_path())
};
return if !defined $msys_path;
my $count = @PATH;
@PATH
= grep {path($_)->stringify =~ m|/usr/bin$| && path($_) ne $msys_path ? () : $_}
@PATH;
my $removed = $count - @PATH;
if ($removed) {
$build->log ("$removed additional .../usr/bin dirs were removed from the path for compilation");
}
$orig->($build, @args);
}
sub pause {
return; # re-enable in case of debug
# return if $on_automated_rig;
# return if !$on_windows;
say "CONTINUE?";
my $response = <>;
while (not $response =~ /yes/) {
$response = <>;
}
}
sub patch_pkgconfig {
#my $gdal_config_file = 'bin/gdal-config';
#my $pkg_config_file = 'lib/pkgconfig/gdal.pc';
use File::Find::Rule;
my @gdal_configs
= File::Find::Rule->file()
->name( 'gdal-config' )
->in( '.' );
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.071 second using v1.00-cache-2.02-grep-82fe00e-cpan-b63e86051f13 )