Alt-Acme-Math-XS-ModuleInstall
view release on metacpan or search on metacpan
inc/Inline/C.pm view on Meta::CPAN
s/(--jobserver-fds=[\d,]+)//;
}
$o->system_call("$make pure_install", 'out.make_install');
}
sub cleanup {
my ($o) = @_;
my ($modpname, $modfname, $install_lib) =
@{$o->{API}}{qw(modpname modfname install_lib)};
if ($o->{API}{cleanup}) {
$o->rmpath(
File::Spec->catdir($o->{API}{directory},'build'),
$modpname
);
my $autodir = File::Spec->catdir($install_lib,'auto',$modpname);
unlink (
File::Spec->catfile($autodir,'.packlist'),
File::Spec->catfile($autodir,'$modfname.bs'),
File::Spec->catfile($autodir,'$modfname.exp'), #MSWin32
File::Spec->catfile($autodir,'$modfname.lib'), #MSWin32
);
}
}
sub system_call {
my ($o, $cmd, $output_file) = @_;
my $build_noisy = defined $ENV{PERL_INLINE_BUILD_NOISY}
? $ENV{PERL_INLINE_BUILD_NOISY}
: $o->{CONFIG}{BUILD_NOISY};
# test this functionality with:
#perl -MInline=C,Config,BUILD_NOISY,1,FORCE_BUILD,1 -e "use Inline C => q[void inline_warner() { int *x = 2; }]"
if (not $build_noisy) {
$cmd = "$cmd > $output_file 2>&1";
}
($cmd) = $cmd =~ /(.*)/ if $o->UNTAINT;
system($cmd) == 0
or croak($o->build_error_message($cmd, $output_file, $build_noisy));
}
sub build_error_message {
my ($o, $cmd, $output_file, $build_noisy) = @_;
my $build_dir = $o->{API}{build_dir};
my $output = '';
if (not $build_noisy and
open(OUTPUT, $output_file)
) {
local $/;
$output = <OUTPUT>;
close OUTPUT;
}
my $errcode = $? >> 8;
$output .= <<END;
A problem was encountered while attempting to compile and install your Inline
$o->{API}{language} code. The command that failed was:
\"$cmd\" with error code $errcode
The build directory was:
$build_dir
To debug the problem, cd to the build directory, and inspect the output files.
END
if ($cmd =~ /^make >/) {
for (sort keys %ENV) {
$output .= "Environment $_ = '$ENV{$_}'\n" if /^(?:MAKE|PATH)/;
}
}
return $output;
}
#==============================================================================
# This routine fixes problems with the MakeMaker Makefile.
#==============================================================================
my %fixes = (
INSTALLSITEARCH => 'install_lib',
INSTALLDIRS => 'installdirs',
XSUBPPARGS => 'xsubppargs',
INSTALLSITELIB => 'install_lib',
);
sub fix_make {
use strict;
my (@lines, $fix);
my $o = shift;
$o->{ILSM}{install_lib} = $o->{API}{install_lib};
$o->{ILSM}{installdirs} = 'site';
open(MAKEFILE, '< Makefile')
or croak "Can't open Makefile for input: $!\n";
@lines = <MAKEFILE>;
close MAKEFILE;
open(MAKEFILE, '> Makefile')
or croak "Can't open Makefile for output: $!\n";
for (@lines) {
if (/^(\w+)\s*=\s*\S+.*$/ and
$fix = $fixes{$1}
) {
my $fixed = $o->{ILSM}{$fix};
print MAKEFILE "$1 = $fixed\n";
}
else {
print MAKEFILE;
}
}
close MAKEFILE;
}
sub quote_space {
# Do nothing if $ENV{NO_INSANE_DIRNAMES} is set
return $_[0] if $ENV{NO_INSANE_DIRNAMES};
# If $_[0] contains one or more doublequote characters, assume
# that whitespace has already been quoted as required. Hence,
# do nothing other than immediately return $_[0] as is.
# We currently don't properly handle tabs either, so we'll
# do the same if $_[0] =~ /\t/.
return $_[0] if ($_[0] =~ /"/ || $_[0] =~ /\t/);
( run in 0.366 second using v1.01-cache-2.11-cpan-119454b85a5 )