Commit f18368da authored by Alessandro Ghedini's avatar Alessandro Ghedini

Imported Upstream version 0.1~2012.01

parent f4a695bd
......@@ -24,7 +28,6 @@ perl6.rc
......@@ -37,12 +40,15 @@ dynext/perl6_*.dll
......@@ -274,6 +274,11 @@ N: Matt Diephouse
U: mdiep
N: Michael Schroeder
U: mls
D: Exception handling
N: Moritz Lenz
U: moritz
This diff is collapsed.
Build requirements (Installing from source)
For building Rakudo you need at least a C compiler, a "make" utility,
and Perl 5.8 or newer. To automatically obtain and build Parrot you
may also need a a git client, which is also needed for fetching the
test suite.
In order to fully support Unicode, you'll also want to have the ICU
library installed (<>). Rakudo can run
without ICU, but some Unicode-related features do not work properly.
As an example, on Debian GNU/Linux or Ubuntu Linux, the necessary
components for building Rakudo can be installed via the command
aptitude install build-essential libicu-dev git-core
(Perl is installed by default already). To enable parallel testing you
also need the CPAN module Test::Harness in version 3.16 or newer; you
can control the number of parallel jobs with the "TEST_JOBS" environment
Building and invoking Rakudo
Because Rakudo is under rapid development, we generally recommend
downloading Rakudo directly from github and building from there:
$ git clone git://
If you don't have git installed, you can get a tarball or zip of Rakudo
from <>. Then unpack the
tarball or zip.
If you already have cloned Rakudo from github, you can get (pull) the
most recent version from github like this:
$ cd rakudo
$ git pull
Once you have an up-to-date copy of Rakudo, build it as follows:
$ cd rakudo
$ perl --gen-parrot
$ make
This will create a "perl6" or "perl6.exe" executable in the current
(rakudo) directory. Note that if you have multiple (Perl 5) "perl"s in
your path, you may need to use a fully qualified path to the appropriate
executable (or update your PATH environment variable).
Programs can then be run from the build directory using a command like:
$ ./perl6
Important: To run Rakudo from outside the build directory, you must run
$ make install
This will install the "perl6" (or "perl6.exe" binary on windows) into
the "install/bin" directory locally, no additional root
privileges necessary.
The "--gen-parrot" above option tells to automatically
download and build the most appropriate version of NQP and Parrot
into local "nqp/" and "parrot/" subdirectories, install NQP and Parrot
into the "install/" subdirectory, and use them for building Rakudo.
It's okay to use the "--gen-parrot" option on later invocations of; the configure system will re-build NQP and/or Parrot
only if a newer version is needed for whatever version of Rakudo
you're working with.
If you already have Parrot installed, you can use
"--with-parrot=/path/to/bin/parrot" to use it instead of
building a new one. This installed Parrot must include its
development environment. Similarly, if you already have NQP
installed, you can specify "--with-nqp=/path/to/bin/nqp"
to use it. (Note that this must be NQP, not the NQP-rx that
comes with Parrot.)
The versions of any already installed NQP or Parrot binaries must
satify a minimum specified by the Rakudo being built --
and "make" will verify this for you. Released versions of Rakudo
always build against the latest release of Parrot; checkouts of
the HEAD revision from github often require a version of Parrot
that is newer than the most recent Parrot monthly release.
Once built, Rakudo's "make install" target will install Rakudo and its
libraries into the directories specified by the Parrot installation
used to create it. Until this step is performed, the "perl6"
executable created by "make" above can only be reliably run from
the root of Rakudo's build directory. After "make install" is
performed, the installed executable can be run from any directory
(as long as the Parrot installation that was used to create it
remains intact).
If the Rakudo compiler is invoked without an explicit script to run, it
enters a small interactive mode that allows Perl 6 statements to be
executed from the command line.
See the manual page ("docs/running.pod") for more about command-line
Build/install problems
Occasionally, there may be problems when building/installing Rakudo.
Make sure you have a backup of any custom changes you have done to the
source tree before performing the following steps:
Try to remove the "install/" subdirectory:
$ cd rakudo
$ rm -r install
$ git pull
$ perl --gen-parrot
$ make
Or, in case you are really stuck, start with a fresh source tree:
$ rm -r rakudo
$ git clone git://
Running the test suite
Entering "make test" will run a small test suite that comes bundled with
Rakudo. This is a simple suite of tests, designed to make sure that the
Rakudo compiler is basically working and that it's capable of running a
simple test harness.
Running "make spectest" will import the official Perl 6 test suite from
the "roast" repository <> and run all
of these tests that are currently known to pass.
If you want to automatically submit the results of your spectest run to
a central server, use "make spectest_smolder" instead. You need the
Perl 5 module TAP::Harness::Archive and an active internet connection
for that. The smoke results are collected at
At present we do not have any plans to directly store the official test
suite as part of the Rakudo repository, but will continue to fetch it
from the roast repository. Releases of Rakudo get a snapshot of
the roast repository as of the time of the release.
You can also use "make" to run an individual test from the command line:
$ make t/spec/S29-str/ucfirst.t
t/spec/S29-str/ucfirst.rakudo ..
ok 1 - simple
ok 2 - empty string
ok 3 - # SKIP unicode
ok 4 - # SKIP unicode
All tests successful.
Files=1, Tests=4, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.57 cusr 0.06 csys = 0.65 CPU)
Result: PASS
If you want to run the tests in parallel, you need to install a fairly
recent version of the Perl 5 module Test::Harness (3.16 works for sure).
# Rakudo "nom" Branch Low Hanging Fruit
Want to help? Want something that (hopefully) doesn't require deep
guts skillz? Take a task from this list. Delete it from here when
you commit; maybe announce on #perl6 that you're working on it too.
Note - do not just copy stuff from the master setting! Often things
need to be done differently in the "nom" branch, to take advantage of
new possible performance.
## More Smart-matching
See S03-smartmatch tests, especially array-array.t, hash-hash.t and
so forth. The regex ones are probably also good candidates now.
## Nil assignment
my Int $b = 3; $b = Nil;
# Roadmap for "nom" Branch
Last Updated 14 jan 2011
## Punch list for nom distribution
This is the "punch list" of items that need addressing before
switching nom to be the new 'master' branch, and before releasing
a nom-based distribution. Each item below contains an importance
(1 == must have, 2 == ought to have, 3 == nice to have) for
branch and distribution, an estimate of the difficulty
(\* == easy, \*\*\*\* = hard), and any identified
responsible parties.
* Enums to level of master (2, 1, ???, ???)
## Other NOMMAP notes
Note that this isn't strictly in order, though things nearer to the top
are likely to get focus sooner.
Current fails that people are likely to encounter (no particular order):
* Order enumeration
Things that aren't blockers but might be worth knowing about:
* attribute `:=` doesn't work in CORE.setting (works outside of setting, though)
(initial digging suggets it's a BOOTSTRAPATTR issue, thus why we only see it
in the setting)
* no rw-accessors for natively typed attributes (yet? spec isn't clear)
## when statements
when needs to properly find use correct outer scope
## Fix up binding some more
Get `::=` correcter, and a bit more stuff on `:=` also.
## Enumerations
* Enums as roles
* Non-numeric enums
* Anonymous enums
## Fix array/hash initialization
`my @a;` needs to initialize @a to be the Array type object (not an Array instance).
Same for my %h and hashes.
## Phasers
* END in pre-compiled mainline case
## Switch Real to be a role
It's a class; work in real-trouble branch.
This diff is collapsed.
Bumping parrot revision: either in the parrot repo type 'git describe --tags',
or if you have a compiled parrot, run 'parrot_config git_describe` to get the
identifier string that you then copy into build/PARROT_REVISION
\ No newline at end of file
# Copyright (C) 2008, The Perl Foundation.
# $Id$
use strict;
use warnings;
my @files = @ARGV;
print <<"END_PRELUDE";
# This file automatically generated by $0.
foreach my $file (@files) {
print ".include '$file'\n";
# Copyright (C) 2008, The Perl Foundation.
# $Id$
use strict;
use warnings;
my @files = @ARGV;
print <<"END_PRELUDE";
# This file automatically generated by $0.
foreach my $file (@files) {
print ".include '$file'\n";
# Copyright (C) 2008, The Perl Foundation.
# $Id$
=head1 NAME - Generates the ObjectRef PMC
% perl pmc_template output_file
Takes a template for the ObjectRef PMC, and fills in the missing v-table
methods with methods that simply delegate them to the held value.
=over 4
use strict;
use Parrot::Config;
# Get and check parameters.
my ($template, $output) = @ARGV;
unless ($template && $output) {
die "Usage: perl pmc_template output_file";
unless (-e $template) {
die "ObjectRef PMC template file '$template' does not exist";
# Read template.
my $template_contents = slurp($template);
# Read v-tables list and get list of functions from it.
my $vtable_list = slurp($PConfig{srcdir}.$PConfig{versiondir}.'/vtable.tbl');
my @all_vtables = extract_matches($vtable_list, '(\w+)\\(');
# Find v-table methods defined in the ObjectRef template and exclude
# them from the list.
my @nogen = extract_matches($template_contents, 'VTABLE\s*\w+\s*\*?\s*(\w+)\\(');
my %nogen;
$nogen{$_}++ for @nogen;
my @generate = grep { !$nogen{$_} } @all_vtables;
# Generate methods and insert into file.
my $gen_code = join("\n", map { generate_meth($_, $vtable_list) } @generate);
$template_contents =~ s/(pmclass[^{]+\{.+?)(VTABLE)/$1\n$gen_code$2/s;
# Write it.
spew($output, $template_contents);
=item generate_meth
Generates a forwarder method for the PMC.
sub generate_meth {
my ($name, $vtable_file) = @_;
# Extract signature, parameter names and MMD info.
unless ($vtable_file =~ /^(\w+\s*\*?)\s*$name\((.*)\)(\s+MMD)?/m) {
die "Can't get type info for vtable method $name";
if ($3) {
# Don't generate forwarders for MMD methods.
return "";
my $ret_type = $1;
my $param_list = $2;
$ret_type =~ s/\s+//g;
# Get list of parameters to pass on in forwarding (basically,
# strip types).
my @params = split(/\s*,\s*/, $param_list);
my $pass_list = join(', ', map { /(?:^|\s)(\w+)$/; $1 } @params);
$pass_list = ", $pass_list" if $pass_list;
# Any return?
my $return = $ret_type eq 'void' ? '' : 'return ';
# Generate method.
my $meth = <<METH;
VTABLE $ret_type $name($param_list) {
${return}VTABLE_$name(INTERP, _VALUE$pass_list);
return $meth;
=item slurp
Reads in an entire file.
sub slurp {
my $filename = shift;
open my $fh, "< $filename" or die "Could not open $filename: $!";
my $content = join('', <$fh>);
close $fh;
return $content;
=item spew
Writes a string to a file, replacing or creating it as needed.
sub spew {
my ($filename, $content) = @_;
open my $fh, "> $filename" or die "Could not open $filename: $!";
print $fh $content;
close $fh
=item extract_matches
Extracts all items matching the given pattern and puts $1 into an
sub extract_matches {
my ($text, $pattern) = @_;
my @found = ();
while ($text =~ /$pattern/g) {
push @found, $1;
return @found;
#! perl
# Copyright (C) 2009 The Perl Foundation
=head1 TITLE - script to obtain and build Parrot for Rakudo
perl [--parrot --configure=options]
Maintains an appropriate copy of Parrot in the parrot/ subdirectory.
The revision of Parrot to be used in the build is given by the
use strict;
use warnings;
use 5.008;
use lib "build/lib";
use Parrot::CompareRevisions qw(compare_revs parse_revision_file);
# Work out slash character to use.
my $slash = $^O eq 'MSWin32' ? '\\' : '/';
# Determine the revision of Parrot we require
my $req = parse_revision_file;
no warnings;
eval {
my $parrot_bin_folder = "parrot_install${slash}bin";
if (-e $parrot_bin_folder && open my $REV, '-|', "$parrot_bin_folder${slash}parrot_config git_describe") {
my $revision = <$REV>;
close $REV;
$revision =~ s/\s.*//s;
if (compare_revs($revision, $req) >= 0) {
print "Parrot $revision already available ($req required). that's new enough.\n";
print "Checking out Parrot $req via git...\n";
my $fetched = 0;
if (-d 'parrot') {
if (-d 'parrot/.svn') {
die "===SORRY===\n"
."Your 'parrot' directory is still an SVN repository.\n"
."Parrot switched to git recently; in order to replace your\n"
."repository by a git repository, please manually delete\n"
."the 'parrot' directory, and then re-run the command that caused\n"
."this error message\n";
} else {
system_or_die(qw(git clone git:// parrot));
$fetched = 1;
chdir('parrot') || die "Can't chdir to 'parrot': $!";
system_or_die(qw(git fetch)) unless $fetched;
system_or_die(qw(git checkout), $req);
## If we have a Makefile from a previous build, do a 'make realclean'
if (-f 'Makefile') {
my %config = read_parrot_config();
my $make = $config{'make'};
if ($make) {
print "\nPerforming '$make realclean' ...\n";
system_or_die($make, "realclean");
print "\nConfiguring Parrot ...\n";
my @config_command = ($^X, '', @ARGV);
print "@config_command\n";
system_or_die( @config_command );
print "\nBuilding Parrot ...\n";
my %config = read_parrot_config();
my $make = $config{'make'} or exit(1);
system_or_die($make, 'install-dev');
sub read_parrot_config {
my %config = ();
if (open my $CFG, "config_lib.pir") {
while (<$CFG>) {
if (/P0\["(.*?)"], "(.*?)"/) { $config{$1} = $2 }
close $CFG;
sub system_or_die {
my @cmd = @_;
system( @cmd ) == 0
or die "Command failed (status $?): @cmd\n";
# Copyright (C) 2008-2009, The Perl Foundation.
# $Id$
use strict;
use warnings;
my @prop = qw(