#!/usr/bin/env perl # install_perl 5.x.y # install_perl 5.x.yd Build with debug symbols (-g) # install_perl 5.x.yt Build with thread support # install_perl 5.x.ydt Build with debug symbols (-g) and thread support use strict; use warnings; ( my ($build) = @ARGV ) == 1 or die; my $ccache = $ENV{CCACHE} || ( `which ccache` ? 'ccache' : '' ); my $perlbrew_root = $ENV{PERLBREW_ROOT} || "$ENV{HOME}/perl5/perlbrew"; unlink("$perlbrew_root/build.log"); my $version = $build; my $threaded = $version =~ s/t\z//; my $debug = $version =~ s/d\z//; my @args; push @args, "-v"; push @args, $version; push @args, "--as=$build"; push @args, "-DPERL_SUB_DEPTH_WARN=1000"; push @args, "-Dcc=$ccache cc" if $ccache; push @args, "-Doptimize=-g" if $debug; push @args, "-Dusethreads" if $threaded; exec("perlbrew", "install", @args) or die $!;