initial import of star builder
Matt S Trout [Tue, 4 Sep 2012 19:37:00 +0000 (19:37 +0000)]
Makefile.PL [new file with mode: 0644]
lib/Rakudo/Star.pm [new file with mode: 0644]
lib/Rakudo/Star/Paths.pm [new file with mode: 0644]
maint/fetch-star [new file with mode: 0755]
t/rakudo.t [new file with mode: 0644]

diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644 (file)
index 0000000..598cc57
--- /dev/null
@@ -0,0 +1,35 @@
+use strict;
+use warnings FATAL => 'all';
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+  NAME => 'Rakudo-Star',
+  VERSION => '2012.08_000',
+);
+
+sub MY::postamble { <<'END' }
+
+INSTALLRAKUDO=$(INSTALLARCHLIB)/Rakudo/Star/Install
+
+all :: rakudo
+       touch blib/arch/auto/Rakudo-Star/force-arch
+
+rakudo-star/Makefile :
+       cd rakudo-star; $(PERL) Configure.pl --gen-parrot --prefix=$(INSTALLRAKUDO)
+
+rakudo : rakudo-star/Makefile
+       cd rakudo-star; make all
+
+install :: rakudoinstall
+
+rakudoinstall :
+       cd rakudo-star; make install
+
+manifest :
+       rm MANIFEST
+       $(PERL) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
+       echo "rakudo-star/parrot/.gitignore" >>MANIFEST
+       echo "rakudo-star/parrot/examples/compilers/Makefile" >>MANIFEST
+       echo "rakudo-star/parrot/examples/embed/Makefile" >>MANIFEST
+       echo "rakudo-star/parrot/examples/tools/Makefile" >>MANIFEST
+END
diff --git a/lib/Rakudo/Star.pm b/lib/Rakudo/Star.pm
new file mode 100644 (file)
index 0000000..602027c
--- /dev/null
@@ -0,0 +1,52 @@
+package Rakudo::Star;
+
+our $VERSION = '2012.08_000';
+
+$VERSION = eval $VERSION;
+
+1;
+
+=head1 NAME
+
+Rakudo::Star - install Rakudo Star from CPAN
+
+=head1 SYNOPSIS
+
+This module is here as a version container - see L<Rakudo::Star::Paths>
+for documentation of how to find the install.
+
+=head1 DESCRIPTION
+
+Basically, this module convinces MakeMaker to build a bundled version of
+<http://rakudo.org>'s "Star" release, then provides a way to find it on
+disk.
+
+Note that since parrot is not relocatable, the rakudo install is not
+relocatable - so putting it in a L<local::lib> dir and then C<mv>-ing that
+directory is not going to work yet. Sorry.
+
+=head1 AUTHORS OF RAKUDO
+
+See L<http://rakudo.org> for the Rakudo project. The following author,
+copyright and license information applies only to the L<Rakudo::Star>
+installation code.
+
+=head1 AUTHOR
+
+mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk>
+
+=head1 CONTRIBUTORS
+
+None yet, because nobody's broken it yet. I'm sure they will shortly.
+
+=head1 COPYRIGHT
+
+Copyright (c) 2012 the L<Rakudo::Star> L</AUTHOR> and L</CONTRIBUTORS>
+as listed above.
+
+=head1 LICENSE
+
+This library is free software and may be distributed under the same terms
+as perl itself; for the licensing of rakudo, please see L<http://rakudo.org>
+
+=cut
diff --git a/lib/Rakudo/Star/Paths.pm b/lib/Rakudo/Star/Paths.pm
new file mode 100644 (file)
index 0000000..c5a083a
--- /dev/null
@@ -0,0 +1,54 @@
+package Rakudo::Star::Paths;
+
+use strict;
+use warnings FATAL => 'all';
+use File::Basename qw(dirname);
+use File::Spec::Functions qw(catdir);
+
+sub base_path {
+  catdir(dirname(__FILE__), 'Install')
+}
+
+sub bin_path {
+  my $class = shift;
+  catdir($class->base_path, 'bin');
+}
+
+sub env_PATH {
+  my $class = shift;
+  'export PATH='.join(':', $class->bin_path, $ENV{PATH}?$ENV{PATH}:())."\n";
+}
+
+sub import {
+  if ($0 eq '-') {
+    print shift->env_PATH;
+    exit 0;
+  }
+}
+
+=head1 NAME
+
+Rakudo::Star::Paths - find your rakudo install
+
+=head1 SYNOPSIS
+
+  bash$ perl -MRakudo::Star::Paths
+  export PATH=/path/to/rakudo/star/bin:...
+
+  bash$ eval $(perl -MRakudo::Star::Paths)
+  # PATH env var is now set
+
+  bash$ perl -MRakudo::Star::Paths -e 'print Rakudo::Star::Paths->bin_path'
+  /path/to/rakudo/star/bin
+
+=head1 COPYRIGHT
+
+See L<Rakudo::Star/COPYRIGHT>
+
+=head1 LICENSE
+
+See L<Rakudo::Star/LICENSE>
+
+=cut
+
+1;
diff --git a/maint/fetch-star b/maint/fetch-star
new file mode 100755 (executable)
index 0000000..dd4cf01
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+STAR=2012.08
+
+STARTAR=rakudo-star-$STAR
+
+wget https://github.com/downloads/rakudo/star/$STARTAR.tar.gz -O - | tar xzf -
+
+rm -rf rakudo-star
+
+mv $STARTAR rakudo-star
diff --git a/t/rakudo.t b/t/rakudo.t
new file mode 100644 (file)
index 0000000..d859399
--- /dev/null
@@ -0,0 +1,14 @@
+use strict;
+use warnings FATAL => 'all';
+use Test::More qw(no_plan);
+
+chdir('rakudo-star/rakudo');
+
+sub run_test {
+  my ($file) = @_;
+  cmp_ok(system($^X, 't/harness', $file), '==', 0, "${file} passed");
+}
+
+run_test($_) for <t/00-parrot/*.t>;
+
+run_test($_) for <t/01-rakudo/*.t>;