Skip to content

Instantly share code, notes, and snippets.

@dagolden
Created March 11, 2009 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagolden/77221 to your computer and use it in GitHub Desktop.
Save dagolden/77221 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use Cwd qw/cwd/;
use File::Temp qw/tempdir/;
my ($tag, @args) = @ARGV;
die "usage: $0 <tag-name> [configure args]\n(Include '-Dusethreads' for threaded build)\n"
if not defined $tag;
my $cwd = cwd; END { chdir $cwd if $cwd };
chdir '/home/david/git/perl/' or die "Couldn't get to perl git directory\n";
`git show-ref --tags $tag`;
if ( $? ) {
die "Tag $tag doesn't exist\n";
}
my $target = $tag;
$target =~ s{^perl-}{};
$target = "/opt/perl/$target";
$target .= "-threads" if @args && grep { /-Dusethreads/ } @args;
die "Target directory '$target' already exists. Stopping.\n"
if -d $target;
my $tempdir = tempdir( CLEANUP => 1 );
system("git archive --format=tar $tag | (cd $tempdir && tar xf -)");
chdir $tempdir;
print "Now in directory '" . cwd . "'\n";
print "Building for installation in '$target'\n";
my $config_args="-de -Dusedevel -Dprefix=$target -Dusemorebits -Uversiononly -Dmydomain=.hyperbolic.net -Dcf_email=xdaveg\@gmail.com -Dperladmin=xdaveg\@gmail.com -Dcc=gcc";
$config_args .= " @args" if @args;
system("make realclean");
system("rm -f config.sh Policy.sh");
system("sh ./Configure $config_args") and die "Problem with Configuration. Stopping.\n";
system("make depend") and die "Problem with make depend. Stopping.\n";
system("make -j3") and die "Problem with make. Stopping\n";
system("make install") and die "Problem with install. Stopping\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment