text
stringlengths
0
834k
}
# See caveats above for Strawberry and PAR::Packer
require Config;
if(not $ENV{PAR_0} and $Config::Config{myuname} =~ /strawberry-perl/)
{
my($vol, $dir, $file) = File::Spec->splitpath($^X);
my @dirs = File::Spec->splitdir($dir);
splice @dirs, -3;
my $path = (File::Spec->catdir($vol, @dirs, qw( c )));
$path =~ s{\\}{/}g;
push @DEFAULT_EXCLUDE_LFLAGS, (
""-L$path/lib"",
""-L$path/lib/pkgconfig/../../lib"",
""-R$path/lib"",
""-R$path/lib/pkgconfig/../../lib"",
);
push @DEFAULT_EXCLUDE_CFLAGS, (
""-I$path/include"",
""-I$path/lib/pkgconfig/../../include"",
);
}
} elsif($^O eq 'darwin') {
if(-x '/usr/local/Homebrew/bin/brew') {
# Mac OS X with homebrew installed
push @DEFAULT_SEARCH_PATH,
bsd_glob '/usr/local/opt/*/lib/pkgconfig'
;
}
}
my @ENV_SEARCH_PATH = split($Config{path_sep}, $ENV{PKG_CONFIG_PATH} || """");
unshift @DEFAULT_SEARCH_PATH, @ENV_SEARCH_PATH;
if($^O eq 'MSWin32') {
@DEFAULT_SEARCH_PATH = map { s{\\}{/}g; $_ } map { /\s/ ? Win32::GetShortPathName($_) : $_ } @DEFAULT_SEARCH_PATH;
}
if($ENV{PKG_CONFIG_ALLOW_SYSTEM_CFLAGS}) {
@DEFAULT_EXCLUDE_CFLAGS = ();
}
if($ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS}) {
@DEFAULT_EXCLUDE_LFLAGS = ();
}
my $LD_OUTPUT_RE = qr/
SEARCH_DIR\(""
([^""]+)
""\)
/x;
sub GuessPaths {
my $pkg = shift;
local $ENV{LD_LIBRARY_PATH} = """";
local $ENV{C_INCLUDE_PATH} = """";
local $ENV{LD_RUN_PATH} = """";
my $ld = $ENV{LD} || 'ld';
my $ld_output = qx(ld -verbose);
my @defl_search_dirs = ($ld_output =~ m/$LD_OUTPUT_RE/g);
@DEFAULT_EXCLUDE_LFLAGS = ();
foreach my $path (@defl_search_dirs) {
push @DEFAULT_EXCLUDE_LFLAGS, (map { ""$_"".$path }
(qw(-R -L -rpath= -rpath-link= -rpath -rpath-link)));
}
log_debug(""Determined exclude LDFLAGS"", @DEFAULT_EXCLUDE_LFLAGS);
#now get the include paths:
my @cpp_output = qx(cpp --verbose 2>&1 < /dev/null);
@cpp_output = map { chomp $_; $_ } @cpp_output;
#log_info(join(""!"", @cpp_output));
while (my $cpp_line = shift @cpp_output) {
chomp($cpp_line);
if($cpp_line =~ /\s*#include\s*<.+search starts here/) {
last;
}
}
#log_info(@cpp_output);
my @include_paths;
while (my $path = shift @cpp_output) {
if($path =~ /\s*End of search list/) {
last;
}
push @include_paths, $path;
}
@DEFAULT_EXCLUDE_CFLAGS = map { ""-I$_"" } @include_paths;
log_debug(""Determine exclude CFLAGS"", @DEFAULT_EXCLUDE_CFLAGS);
}
################################################################################
### Define our fields ###
################################################################################
struct(
__PACKAGE__,