#!/home/perl5262/bin/perl -w use strict; use warnings; use File::Spec; use Perl::Configure; my $perlv = $ARGV[0]; die 'Usage: new_build ', $/ unless $perlv; my $ver; my $opt; if ($perlv =~ m!^(\d+\.\d+\.\d+)([mst])?!) { ($ver, $opt) = ($1, $2); $opt = '' unless $opt; $opt = '' if $opt eq 's'; } die 'Usage: new_build ', $/ unless $ver; my $HOME = $ENV{'HOME'} // '/home/stro'; my $SRC = File::Spec->catfile($HOME, 'perl', 'src', 'perl-' . $ver . '-' . ($opt ? $opt : 's')); my $PATH = File::Spec->catfile($HOME, 'perl', $ver . $opt); chdir $SRC or die $!. ': ' . $SRC; print 'Installing Perl v', $ver, ' opt: ', $opt, ', from ', $SRC, ' to ', $PATH, $/; -e $PATH || mkdir $PATH or die $!, ': ', $PATH; -e $PATH . '/bin' || mkdir $PATH . '/bin' or die $!, ':', $PATH . 'bin'; my $questions = Perl::Configure::Questions->new(); # Perl 5.24 $questions->add('unique-shared-library' => 'Make shared library basenames unique?' => 'n'); $questions->add('api-version-archname' => 'Add the Perl API version to your archname?' => 'n'); $questions->add('character-length-bits' => 'What is the length of a character (in bits)?' => '8'); $questions->add('gethostbyaddr-arg1-type' => 'What is the type for the 1st argument to gethostbyaddr?' => 'char *'); $questions->add('gethostbyaddr-arg2-type' => 'What is the type for the 2nd argument to gethostbyaddr?' => 'size_t'); # Perl 5.26 $questions->add('binaries-version' => 'Do you want to use a version number suffix for installed binaries?' => 'n'); # OpenIndiana $questions->add('libc-path' => 'Where is your C library?' => '/lib/libc.so'); $questions->add('socket-addr-size' => 'What is the type for socket address structure sizes?' => 'int'); $questions->add('config-over' => 'I see a config.over file. Do you wish to load it?' => 'y'); my $configurator = Perl::Configure->new('questions' => $questions); $configurator->define( $opt eq 't' ? ('threads' => 'y') : (), $opt eq 'm' ? ('multiplicity' => 'y') : (), 'prefix' => $PATH, 'usrbinperl' => 'n', 'dir-check' => 'y', 'path-man-lib-site' => 'none', 'devel-release' => 'y', ); $configurator->run(); system('make install && ' . $HOME . '/cpan/new_setup ' . $perlv . ' ');