App-perlall
view release on metacpan or search on metacpan
script/perlall view on Meta::CPAN
sstack => 'safestack',
# cps => 'cps',
# cpi => 'cpi'
);
my $san = $sanmap{$1};
push @{$c->options->{A}}, "ccflags='-fsanitize=$san -fPIE'",
"ldflags='-fsanitize=$san -fpie'",
"lddlflags='-shared -fsanitize=$san -fpie'";
}
}
$ithreads = undef if $multi;
my $bindir = $c->config->{PERLALL_BINDIR};
# XXX assert $p = $ps . $suffix;
if ($c->options->{install}) {
$c->stash->{logprefix} =~ s/^log.build-/log.build-install-/;
}
$c->stash->{log} = "$root/" . $c->stash->{logprefix} . $p;
if ($c->stash->{log_fh}) {
close $c->stash->{log_fh};
undef $c->stash->{log_fh};
}
$c->_log(0,"perlall",_opts($c->options),"build",$p,$from);
my $builddir = "build-".$p;
if ($c->options->{install}) {
$c->_system1( "chdir", $root.'/'.$builddir );
$c->_check_lock();
goto INSTALL;
}
# XXX maybe it already exists and is not empty
if (-f $from or $from =~ /^https?:|ftp:|rsync:/) {
warn "XXX build from file very very unstable.\n"
. "No idea how to know the resulting srcdir yet";
if (!-f $from) {
# try CPAN instead?
$c->_system1( "wget","-O","perl-$ps.tgz",$from)
and $c->_fail("downloading $from failed");
$from = "perl-$ps.tgz";
}
my @tarx = (($^O eq 'solaris' ? 'gtar' : 'tar'),
($from =~ m/\.bz2$/ ? 'xjf' : 'xzf' ));
$c->_system1( @tarx, $from) and _fail("extracting the tarball $from failed");
$srcdir = $root."/perl-$ps";
if (! -d $builddir) {
# OOPS LOOKS LIKE AN ERROR
$c->_system("mkdir", $builddir)
and $c->_fail("Cannot create $builddir."
." Check your PERLALL_BUILDROOT in ~/.perlall");
}
$c->_system1( "chdir", $root.'/'.$builddir );
$c->_check_lock();
}
else { # git, much better
$c->_fail("perl-git $srcdir missing") if !-d $srcdir and !$dryrun;
my @cmd = ("mkdir", $builddir);
unshift @cmd, $sudo if $sudo and !-w $root;
$c->_log(1,"mkdir $root/$builddir # PERLALL_BUILDROOT") unless -d $builddir;
$c->_system1( @cmd) unless -d $builddir;
$c->_fail( "invalid builddir $builddir") if !-d $builddir and !$dryrun;
$c->_system($sudo, "chown", $<, $builddir) if $sudo eq $cmd[0];
if ( $from eq 'blead' and $c->options->{link} ) { # mksymlink for blead only
$c->debug("working symlinked to perl-git tree \@$gitsuffix")
if $c->options->{link};
$c->_system1( "chdir", $root.'/'.$builddir);
$c->_fail( "not existing builddir $builddir")
if basename(Cwd::getcwd()) ne $builddir and !$dryrun;
$c->_check_lock();
$c->_system1( "rm -rf * .config")
if -f 'Configure' and !-l "Configure";
} else { # cp anew
$c->debug("copy git tree for $from");
@cmd = ($cp, "-rf", "$srcdir/.git", "$builddir/");
# unshift @cmd, $sudo if $sudo; # cannot trust !-w "$builddir/.git";
if ($^O eq 'MSWin32') {
$c->_system1( "rm -rf \"$builddir\\.git\"") if -d "$builddir/.git";
@cmd = ("xcopy", "/S/I/H/Y".($c->options->{verbose}?"":"/Q"),
"\"$srcdir/.git\"", "\"$builddir\\.git\"");
}
$c->_system1( @cmd);
$srcdir = "."; # clean copy
$c->_system1( "chdir", $builddir);
$c->_fail( "not existing builddir $builddir")
if basename(Cwd::getcwd()) ne $builddir and !$dryrun;
$c->_check_lock();
$c->_system1( "git","checkout","-f",$from); # git returns strange values, ignore
$c->_fail( "git checkout -f $from") if !-f "Configure" and !$dryrun;
$c->_system1( "git","reset","--hard");
$c->_system1( "git","clean","-dxf");
}
}
# Backport various Configure and hints patches from blead
# via Devel::PatchPerl
if ( $srcdir eq "." or $srcdir eq $root."/perl-$ps" ) {
$c->_log('',"Devel::PatchPerl::patch_source($ps)");
# TODO: monkeypatch Devel::PatchPerl to allow multiple plugins
if ($asan or $c->options->{allpatches} or grep /^Asan$/, @{$c->options->{patches}}) {
#require Devel::PatchPerl;
#require Devel::PatchPerl::Plugin::General;
#Devel::PatchPerl::General->patch_source($ps) unless $dryrun;
$c->_log('',"Devel::PatchPerl::patch_source($ps) Asan");
local $ENV{PERL5_PATCHPERL_PLUGIN} = 'Devel::PatchPerl::Plugin::Asan';
Devel::PatchPerl::patch_source($ps) unless $dryrun;
#require Devel::PatchPerl::Plugin::Asan;
#Devel::PatchPerl::Plugin::Asan->patch_source($ps) unless $dryrun;
}
elsif ($c->options->{allpatches} or grep /^Compiler$/, @{$c->options->{patches}}) {
#require Devel::PatchPerl;
#require Devel::PatchPerl::Plugin::General;
#Devel::PatchPerl::Plugin::General->patch_source($ps) unless $dryrun;
local $ENV{PERL5_PATCHPERL_PLUGIN} = 'Devel::PatchPerl::Plugin::Compiler';
$c->_log('',"Devel::PatchPerl::patch_source($ps) Compiler");
Devel::PatchPerl::patch_source($ps) unless $dryrun;
#require Devel::PatchPerl::Plugin::Compiler;
#Devel::PatchPerl::Plugin::Compiler->patch_source($ps) unless $dryrun;
}
else {
Devel::PatchPerl::patch_source($ps) unless $dryrun;
( run in 0.785 second using v1.01-cache-2.11-cpan-71847e10f99 )