Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Building perl!

by Tanktalus (Canon)
on Jun 15, 2012 at 16:21 UTC ( #976457=CUFP: print w/ replies, xml ) Need Help??

As it is sometimes advantageous to have more than one perl around, and I didn't know about perlbrew when I started doing this, I simply downloaded each new version of perl to ~/perl, extracted it (which would create a perl-$^V sub directory, e.g., perl-5.16.0), and went in and configured it. Eventually I wrote this script to help. And when my hard disk started failing and I replaced it with both a spinning disk and an SSD, I simply modified this script to install to /opt instead of /home (/home being on the spinning disk), and now perl even loads faster :-) I've named this "myconfigure" and put it in ~/perl. So I still download the new version and put it in my ~/perl directory, cd in, and run "../myconfigure". When it's done, the new version is installed to /opt/myperl/$^V. (Ok , not $^V, but substr($^V,1))

#!/usr/bin/perl use File::Basename qw(dirname); use File::Spec; use Cwd; my $dir = Cwd::cwd; my ($version) = $dir =~ /-(5\.\d+\.\d+.*)$/; unlink qw/config.sh Policy.sh/; my @opts = qw( -desr ); my @defs = qw( use64bitall usethreads ); push @defs, "prefix=/opt/myperl/" . $version; system '/bin/sh', 'Configure', @opts, (map { "-D$_" } @defs); die "Failed to configure: $?" if $?; system make => '-j7'; system 'make' if $?; # sometimes make fails with -j7, so this will fin +ish it. die "Failed to make: $?" if $?; $ENV{TEST_JOBS} = 5; system make => 'test_harness'; die "Failed to test: $?" if $?; system make => 'install'; die "Failed to install: $?" if $?;
Note: if you're also going to use this for dev releases (e.g., 5.17.1), you'll have to add usedevel to @defs.

This is using the system perl to build private perls. Much like perlbrew, really, though this has much less "policy" attached. I'm hoping to start shipping perl with my product which means putting perl into our source control, which means automated building. And this will be the start of it. (Well, that and a previous CUFP which then installs arbitrary modules to it as well, so I can also install all my favourite/required CPAN modules also from source control and not from CPAN directly making upgrading a manual step with lawyers being kept at bay.)

Comment on Building perl!
Select or Download Code
Re: Building perl!
by Tux (Monsignor) on Jun 16, 2012 at 07:11 UTC

    If you are using use64bitall, you might consider adding uselongdoubles.

    If you are using ccache, it might be a good idea to clear the cache before you build when installing a production-like perl after having build a lot of RC's or development versions.

    If you plan to travel the time machine and install older perls that are hard to build now, have a look at Devel::PatchPerl.


    Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://976457]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-12-20 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls