Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Feb 4, 2009
2 parents c8d8b2d + a5e405e commit 83a3599
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 19 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Expand Up @@ -4,4 +4,10 @@ t/spec
.*.swp
Test.pir
perl6.pbc
*.dll
src/ops/*.manifest
src/ops/*.exp
src/ops/*.ilk
src/ops/*.lib
src/ops/*.pdb
t/localtest.data

126 changes: 123 additions & 3 deletions Configure.pl
@@ -1,8 +1,128 @@
#! perl
# Copyright (C) 2008 The Perl Foundation
# Copyright (C) 2009 The Perl Foundation

use strict;
use warnings;

chdir '../..';
`$^X -Ilib tools/dev/reconfigure.pl --step=gen::languages --languages=rakudo`;

my %valid_options = (
'help' => 'Display configuration help',
'parrot-config' => 'Use configuration given by parrot_config binary',
);


# Get any options from the command line
my %options = get_command_options();

# Print help if it's requested
if ($options{'help'}) {
print_help();
exit(0);
}

# If we're in a Parrot build tree and --parrot-config isn't
# specified, use the build tree's reconfigure.pl and exit.
if (!$options{'parrot-config'} && -e "../../tools/dev/reconfigure.pl") {
print "Building Makefile with ../../tools/dev/reconfigure.pl\n";
chdir '../..';
`$^X -Ilib tools/dev/reconfigure.pl --step=gen::languages --languages=rakudo`;
done();
}


# Get a list of parrot-configs to invoke.
my @parrot_config_exe = qw(parrot/parrot_config parrot_config);
if ($options{'parrot-config'} && $options{'parrot-config'} ne '1') {
@parrot_config_exe = ($options{'parrot-config'});
}

# Get configuration information from parrot_config
my %config = read_parrot_config(@parrot_config_exe);
unless (%config) {
die "Unable to obtain configuration from "
. join(', ', @parrot_config_exe) . "\n";
}

# Create the Makefile using the information we just got
create_makefile(%config);

# Done.
done();


# Process command line arguments into a hash.
sub get_command_options {
my %options = ();
for my $arg (@ARGV) {
if ($arg =~ /^--(\w[-\w]*)(?:=(.*))?/ && $valid_options{$1}) {
my ($key, $value) = ($1, $2);
$value = 1 unless defined $value;
$options{$key} = $value;
next;
}
die qq/Invalid option "$arg". See "perl Configure.pl --help" for valid options.\n/;
}
%options;
}


sub read_parrot_config {
my @parrot_config_exe = @_;
my %config = ();
for my $exe (@parrot_config_exe) {
no warnings;
if (open(PARROT_CONFIG, "$exe --dump |")) {
print "Reading configuration information from $exe\n";
while (<PARROT_CONFIG>) {
if (/(\w+) => '(.*)'/) { $config{$1} = $2 }
}
close(PARROT_CONFIG);
last;
}
}
%config;
}


# Generate a Makefile from a configuration
sub create_makefile {
my %config = @_;
open(ROOTIN, "<config/makefiles/root.in") ||
die "Unable to read config/makefiles/root.in \n";
my $maketext = join('', <ROOTIN>);
close(ROOTIN);
$maketext =~ s/@(\w+)@/$config{$1}/g;

print "Creating Makefile\n";
open(MAKEFILE, ">Makefile") ||
die "Unable to read config/makefiles/root.in \n";
print MAKEFILE $maketext;
close(MAKEFILE);
}


sub done {
print <<END;
You can now use 'make' to build Rakudo Perl.
After that, you can use 'make test' to run some local tests,
or 'make spectest' to check out (via svn) a copy of the Perl 6
official test suite and run its tests.
END
exit 0;
}


# Print some help text.
sub print_help {
print <<END;
Configure.pl - Rakudo Configure
General Options:
--help Show this text
--parrot-config=(config)
Use configuration information from config
END
}
4 changes: 3 additions & 1 deletion build/gen_objectref_pmc.pl
Expand Up @@ -23,6 +23,8 @@ =head1 FUNCTIONS

use strict;

use Parrot::Config;

# Get and check parameters.
my ($template, $output) = @ARGV;
unless ($template && $output) {
Expand All @@ -36,7 +38,7 @@ =head1 FUNCTIONS
my $template_contents = slurp($template);

# Read v-tables list and get list of functions from it.
my $vtable_list = slurp('../../src/vtable.tbl');
my $vtable_list = slurp($PConfig{build_dir}.'/src/vtable.tbl');
my @all_vtables = extract_matches($vtable_list, '(\w+)\\(');

# Find v-table methods defined in the ObjectRef template and exclude
Expand Down
26 changes: 12 additions & 14 deletions config/makefiles/root.in
Expand Up @@ -4,11 +4,18 @@
# arguments we want to run parrot with
PARROT_ARGS =

# places to look for things
# values from parrot_config
BUILD_DIR = @build_dir@
LOAD_EXT = @load_ext@
O = @o@
EXE = @exe@
MAKE = @make_c@
PERL = @perl@
RM_F = @rm_f@

# Various paths
PARROT_DYNEXT = $(BUILD_DIR)/runtime/parrot/dynext
PGE_LIBRARY = $(BUILD_DIR)/runtime/parrot/library/PGE
PERL6GRAMMAR = $(PGE_LIBRARY)/Perl6Grammar.pbc
PERL6GRAMMAR = $(BUILD_DIR)/runtime/parrot/library/PGE/Perl6Grammar.pbc
NQP = $(BUILD_DIR)/compilers/nqp/nqp.pbc
PCT = $(BUILD_DIR)/runtime/parrot/library/PCT.pbc
PMC_DIR = src/pmc
Expand All @@ -17,23 +24,14 @@ OPSLIB = perl6
OPS_FILE = src/ops/perl6.ops

# Set up extensions
LOAD_EXT = @load_ext@
O = @o@
EXE = @exe@

# Setup some commands
MAKE = @make_c@
PERL = @perl@
RM_F = @rm_f@
PARROT = ../../parrot$(EXE)
PARROT = $(BUILD_DIR)/parrot$(EXE)
CAT = $(PERL) -MExtUtils::Command -e cat
BUILD_DYNPMC = $(PERL) $(BUILD_DIR)/tools/build/dynpmc.pl
BUILD_DYNOPS = $(PERL) $(BUILD_DIR)/tools/build/dynoplibs.pl
RECONFIGURE = $(PERL) $(BUILD_DIR)/tools/dev/reconfigure.pl
PBC_TO_EXE = $(BUILD_DIR)/pbc_to_exe$(EXE)
#CONDITIONED_LINE(darwin):
#CONDITIONED_LINE(darwin):# MACOSX_DEPLOYMENT_TARGET must be defined for OS X compilation/linking
#CONDITIONED_LINE(darwin):export MACOSX_DEPLOYMENT_TARGET := @osx_version@

SOURCES = perl6.pir \
src/gen_grammar.pir \
Expand Down Expand Up @@ -179,7 +177,7 @@ Test.pir: Test.pm perl6.pbc
$(PARROT) $(PARROT_ARGS) perl6.pbc --target=pir --output=Test.pir Test.pm

$(PMC_DIR)/objectref.pmc : $(PMC_DIR)/objectref_pmc.template build/gen_objectref_pmc.pl
$(PERL) build/gen_objectref_pmc.pl $(PMC_DIR)/objectref_pmc.template \
$(PERL) -I$(BUILD_DIR)/lib build/gen_objectref_pmc.pl $(PMC_DIR)/objectref_pmc.template \
$(PMC_DIR)/objectref.pmc

src/gen_grammar.pir: $(PERL6GRAMMAR) src/parser/grammar.pg src/parser/grammar-oper.pg
Expand Down

0 comments on commit 83a3599

Please sign in to comment.