Last active
August 29, 2015 14:01
-
-
Save hkoba/1df6ae2a3028fc1bb3b5 to your computer and use it in GitHub Desktop.
Custom perl-build for given directory (usually blead-perl git checkout)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use FindBin; | |
use lib "$FindBin::Bin/../lib/" | |
, "$FindBin::Bin/../lib/perl5"; # To make happy with plenv directory structure. | |
use Perl::Build; | |
use Getopt::Long; | |
use Pod::Usage; | |
use File::Spec; | |
my $test = undef; | |
my $patches; | |
my $build_dir; | |
my (@D, @A, @U); | |
Getopt::Long::Configure( | |
'pass_through', | |
'no_ignore_case', | |
'bundling', | |
); | |
GetOptions( | |
'test' => \$test, | |
'D=s@' => \@D, | |
'A=s@' => \@A, | |
'U=s@' => \@U, | |
'patches=s' => \$patches, | |
'build-dir=s' => \$build_dir, | |
); | |
for (@D, @A, @U) { | |
s/^=//; | |
} | |
shift @ARGV if @ARGV >= 1 && $ARGV[0] eq '--'; | |
my $stuff = shift @ARGV or pod2usage(); | |
my $dest = shift @ARGV or pod2usage(); | |
$dest = File::Spec->rel2abs($dest); | |
my @configure_options = @ARGV ? @ARGV : ('-de'); | |
push @configure_options, map { "-D$_" } @D; | |
push @configure_options, map { "-A$_" } @A; | |
push @configure_options, map { "-U$_" } @U; | |
$ENV{PERL5_PATCHPERL_PLUGIN} = $patches if defined $patches; | |
Perl::Build->install( | |
src_path => $stuff, | |
dst_path => $dest, | |
configure_options => \@configure_options, | |
test => $test, | |
); | |
__END__ | |
=head1 NAME | |
perl-build-thisdir - perl binary builder | |
=head1 SYNOPSIS | |
% perl-build-thisdir path/to/perl-git /usr/local/perl-5.16.2 | |
=head1 DESCRIPTION | |
This script install perl5 from git checkout | |
=head1 OPTIONS | |
=over 4 | |
=item -D, -A, -U | |
-Dxxx, -Axxx, -Uxxx options are pass through to ./Configure script. | |
=item --test | |
This option enables C<< make test >> after building. | |
(Default: disabled) | |
=item --patches=Asan | |
You can set I<PERL5_PATCHPERL_PLUGIN> environment variable by this option. | |
=back | |
=head1 FAQ | |
=over 4 | |
=item How can I apply security fixes like CVE-2013-1667? | |
RURBAN provides L<Devel::PatchPerl::Plugin::Asan>. Install it and run C<< perl-build --patches=Asan 5.16.1 /opt/perl/5.16/ >>. | |
=back | |
=head1 SEE ALSO | |
L<perlbrew>, L<plenv> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment