From ea236fbfa840d0fe92bfd9d5d7c391279fa038a9 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Fri, 23 Jul 2010 17:13:03 +0200 Subject: add buildall script, which so far can install Rakudo and ufo --- build/buildall.pl | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ build/download-stuff.pl | 14 ++++++++++--- 2 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 build/buildall.pl (limited to 'build') diff --git a/build/buildall.pl b/build/buildall.pl new file mode 100644 index 0000000..da06add --- /dev/null +++ b/build/buildall.pl @@ -0,0 +1,56 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use File::Spec; + +my $inst_path = File::Spec->rel2abs(shift(@ARGV) || 'build'); +print "Installing to '$inst_path'\n"; +if ($inst_path =~ /\s/) { + warn "Path names with whitspace are known to cause trouble\n" + . "You would be on the safer side without them - set with $^X $0 'inst_path'\n"; +} + +chdir('rakudo') or die "Can't chdir to rakudo: $!"; +print "Building parrot and Rakudo...\n"; +system($^X, 'Configure.pl', '--gen-parrot', "--gen-parrot-refix=$inst_path") == 0 + or die "Can't run $^x Configure.pl ($?): $!"; + +my %config = read_parrot_config(); +my $make = $config{make}; + +system($make, 'install') == 0 + or die "Can't run 'make install' for Rakudo: ($?): $!"; + +chdir('..') or die "Can't chdir back to .., something's seriously wrong!\n"; + +print "Rakudo build was successful. \\o/\n"; + +my $path_var_sep = $^O =~ /mswin32/i ? ';' : ':'; +$ENV{PATH} = join '', "$inst_path/bin", $path_var_sep, $ENV{PATH}; + +my $res = qx/perl6 -e 'say "sanity";'/; +chomp $res; +if ($res ne 'sanity') { + die "Sanity check for running Rakudo Perl 6 failed. Got '$res', Expected: 'sanity'\n" + . "Aborting.\n"; +} + +print "Things look good so far, executing a very simple Perl 6 program worked!\n"; + +copy('ufo/ufo', "$inst_path/bin/") or die "Can't copy ufo/ufo to $inst_path/bin: $!"; +print "We now have alien technology that lets us install more modules...\n"; + + +sub read_parrot_config { + my %config = (); + if (open my $CFG, "parrot/config_lib.pir") { + while (<$CFG>) { + if (/P0\["(.*?)"], "(.*?)"/) { $config{$1} = $2 } + } + close $CFG; + } + %config; +} + + diff --git a/build/download-stuff.pl b/build/download-stuff.pl index 3ed2ba9..c6af886 100644 --- a/build/download-stuff.pl +++ b/build/download-stuff.pl @@ -1,6 +1,9 @@ #!/usr/bin/perl use strict; use warnings; +use 5.010; +use File::Copy; +use autodie qw(mkdir chdir open close copy); my @modules = qw( http://github.com/rakudo/rakudo @@ -19,6 +22,8 @@ my @modules = qw( http://gitorious.org/http-daemon/mainline ); +mkdir 'dist' unless -e 'dist'; + chdir 'dist' or die "Can't chdir to build dir: $!"; for my $m (@modules) { @@ -42,14 +47,17 @@ for my $m (@modules) { # so a branch name, tag name, sha1 sum, HEAD~3 ( not quite sane, # but possible ) # -# XXX we want rakudo 2010.07 of course, but that will give an error now my %tags = ( rakudo => '2010.07' ); while (my ($project, $version) = each %tags) { - chdir $project or die "Can't chdir to '$project': $!"; + chdir $project; system('git', 'checkout', $version) == 0 or die "Can't git checkout $version: $?"; - chdir '..' or die "Can't chdir back to dist/ folder: $!"; + chdir '..'; } +chdir('..'); + +copy('build/buildall.pl', 'dist/'); # TODO: copy docs, build scripts, whatever +# -- cgit v1.1