Skip to content

Commit

Permalink
Merge branch 'ins2'
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Aug 12, 2009
2 parents a5dfe96 + 6c933f9 commit a50e07d
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 75 deletions.
8 changes: 5 additions & 3 deletions Configure.pl
Expand Up @@ -5,11 +5,12 @@
use strict;
use warnings;
use Getopt::Long;
use Cwd;

MAIN: {
my %options;
GetOptions(\%options, 'help!', 'parrot-config=s',
'gen-parrot!', 'gen-parrot-option=s@');
'gen-parrot!', 'gen-parrot-prefix=s', 'gen-parrot-option=s@');

# Print help if it's requested
if ($options{'help'}) {
Expand All @@ -27,7 +28,8 @@
# Update/generate parrot build if needed
if ($options{'gen-parrot'}) {
my @opts = @{ $options{'gen-parrot-option'} || [] };
my @command = ($^X, "build/gen_parrot.pl", @opts);
my $prefix = $options{'gen-parrot-prefix'} || cwd()."/parrot_install";
my @command = ($^X, "build/gen_parrot.pl", "--prefix=$prefix", @opts);

print "Generating Parrot ...\n";
print "@command\n\n";
Expand All @@ -36,7 +38,7 @@

# Get a list of parrot-configs to invoke.
my @parrot_config_exe = qw(
parrot/parrot_config
parrot_install/bin/parrot_config
../../parrot_config
parrot_config
);
Expand Down
2 changes: 1 addition & 1 deletion README
Expand Up @@ -9,7 +9,7 @@ For more details, see the full text of the license in the file LICENSE.
=head2 Build requirements

For building Rakudo you need a C compiler, a C<make> utility, a Perl 5
compiler, version 5.8 or newere, the C<icu> library
compiler, version 5.8 or newer, the C<icu> library
(L<http://site.icu-project.org/>) and the C<svn>
command from Subversion.

Expand Down
195 changes: 127 additions & 68 deletions build/Makefile.in
@@ -1,35 +1,61 @@
# Copyright (C) 2006-2009, The Perl Foundation.
# $Id$

# arguments we want to run parrot with
PARROT_ARGS =
PARROT_ARGS =

# values from parrot_config
BUILD_DIR = @build_dir@
LOAD_EXT = @load_ext@
O = @o@
PARROT_BIN_DIR = @bindir@
PARROT_VERSION = @versiondir@
PARROT_INCLUDE_DIR = @includedir@$(PARROT_VERSION)
PARROT_LIB_DIR = @libdir@$(PARROT_VERSION)
PARROT_SRC_DIR = @srcdir@$(PARROT_VERSION)

CC = @cc@
CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
EXE = @exe@
LD = @ld@
LDFLAGS = @ldflags@ @ld_debug@
LD_LOAD_FLAGS = @ld_load_flags@
LIBPARROT = @inst_libparrot_ldflags@
O = @o@
LOAD_EXT = @load_ext@
PERL = @perl@
CP = @cp@
MV = @mv@
RM_F = @rm_f@
HAS_ICU = @has_icu@

# Various paths
PARROT_DYNEXT = $(BUILD_DIR)/runtime/parrot/dynext
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
OPSDIR = src/ops
OPSLIB = perl6
OPS_FILE = src/ops/perl6.ops

# Setup some commands
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)
MKPATH = $(PERL) -MExtUtils::Command -e mkpath
CHMOD = $(PERL) -MExtUtils::Command -e chmod

# locations of parrot resources
PARROT = $(PARROT_BIN_DIR)/parrot$(EXE)
PBC_TO_EXE = $(PARROT_BIN_DIR)/pbc_to_exe$(EXE)
PARROT_TOOLS_DIR = $(PARROT_LIB_DIR)/tools
PARROT_PERL_LIB = $(PARROT_TOOLS_DIR)/lib
PERL6GRAMMAR_PBC = $(PARROT_LIB_DIR)/library/PGE/Perl6Grammar.pbc
NQP_PBC = $(PARROT_LIB_DIR)/languages/nqp/nqp.pbc
OPS2C = $(PERL) $(PARROT_TOOLS_DIR)/build/ops2c.pl
PMC2C = $(PERL) $(PARROT_TOOLS_DIR)/build/pmc2c.pl
PMC2C_INCLUDES = --include src/pmc --include $(PARROT_SRC_DIR) --include $(PARROT_SRC_DIR)/pmc
CINCLUDES = -I$(PARROT_INCLUDE_DIR) -I$(PARROT_INCLUDE_DIR)/pmc
LINKARGS = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)

# rakudo directories
DYNEXT_DIR = dynext
PMC_DIR = src/pmc
OPS_DIR = src/ops
PERL6_LANG_DIR = $(PARROT_LIB_DIR)/languages/perl6

# files we create
PERL6EXE = perl6$(EXE)
GROUP = perl6_group
OPS = perl6_ops
DYNEXT_TARGET = $(DYNEXT_DIR)/$(GROUP)$(LOAD_EXT)
DYNPMC = $(PMC_DIR)/$(GROUP)$(LOAD_EXT)
DYNOPS = \
$(OPS_DIR)/$(OPS)$(LOAD_EXT) \
$(OPS_DIR)/$(OPS)_switch$(LOAD_EXT) \
$(OPS_DIR)/$(OPS)_cg$(LOAD_EXT) \
$(OPS_DIR)/$(OPS)_cgp$(LOAD_EXT) \

SOURCES = perl6.pir \
src/gen_grammar.pir \
Expand All @@ -47,8 +73,7 @@ SOURCES = perl6.pir \
src/parrot/misc.pir \
src/parrot/state.pir \
src/gen_uprop.pir \
$(PERL6_GROUP) \
src/ops/perl6_ops$(LOAD_EXT)
$(DYNEXT_TARGET)

BUILTINS_PIR = \
src/classes/Object.pir \
Expand Down Expand Up @@ -138,23 +163,24 @@ SETTING = \
src/setting/Temporal.pm \
src/setting/Whatever.pm \

PMCS = perl6str objectref perl6scalar mutablevar perl6multisub p6invocation p6opaque p6role

PMC_SOURCES = $(PMC_DIR)/perl6str.pmc $(PMC_DIR)/objectref.pmc $(PMC_DIR)/perl6scalar.pmc \
$(PMC_DIR)/mutablevar.pmc $(PMC_DIR)/perl6multisub.pmc $(PMC_DIR)/p6invocation.pmc \
$(PMC_DIR)/p6opaque.pmc $(PMC_DIR)/p6role.pmc
PMC_SOURCES = \
$(PMC_DIR)/perl6str.pmc $(PMC_DIR)/objectref.pmc \
$(PMC_DIR)/perl6scalar.pmc $(PMC_DIR)/mutablevar.pmc \
$(PMC_DIR)/perl6multisub.pmc $(PMC_DIR)/p6invocation.pmc \
$(PMC_DIR)/p6opaque.pmc $(PMC_DIR)/p6role.pmc

PERL6_GROUP = $(PMC_DIR)/perl6_group$(LOAD_EXT)
OPS_SOURCE = perl6.ops

CLEANUPS = \
perl6.pbc \
perl6.c \
*.manifest \
*.pdb \
perl6$(O) \
perl6$(EXE) \
$(PERL6EXE) \
perl6_s1.pbc \
Test.pir \
$(DYNEXT_DIR)/*$(LOAD_EXT) \
src/gen_*.pir \
src/gen_*.pm \
$(PMC_DIR)/*.h \
Expand All @@ -168,19 +194,30 @@ CLEANUPS = \
$(PMC_DIR)/*.pdb \
$(PMC_DIR)/*.lib \
$(PMC_DIR)/objectref.pmc \
$(OPSDIR)/*.h \
$(OPSDIR)/*.c \
$(OPSDIR)/*$(O) \
$(OPSDIR)/*$(LOAD_EXT) \
$(OPS_DIR)/*.h \
$(OPS_DIR)/*.c \
$(OPS_DIR)/*$(O) \
$(OPS_DIR)/*$(LOAD_EXT) \

# NOTE: eventually, we should remove --keep-exit-code and --fudge
# as the goal is that all tests must pass without fudge
HARNESS_WITH_FUDGE = $(PERL) t/harness --fudge --keep-exit-code --icu=$(HAS_ICU)
HARNESS_WITH_FUDGE_JOBS = $(HARNESS_WITH_FUDGE) --jobs


# the default target
all: perl6$(EXE)
all: $(PERL6EXE)

# the install target
install: all
$(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(CP) perl6.pbc $(DESTDIR)$(PERL6_LANG_DIR)
$(CP) Test.pm $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(CP) lib/*.pm $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(MKPATH) $(DESTDIR)$(PARROT_LIB_DIR)/dynext
$(CP) $(DYNPMC) $(DYNOPS) $(DESTDIR)$(PARROT_LIB_DIR)/dynext
$(MKPATH) $(DESTDIR)$(PARROT_BIN_DIR)
$(CP) $(PERL6EXE) $(DESTDIR)$(PARROT_BIN_DIR)
$(CHMOD) 755 $(DESTDIR)$(PARROT_BIN_DIR)/$(PERL6EXE)

xmas: perl6$(EXE)

Expand All @@ -199,13 +236,13 @@ perl6_s1.pbc: $(PARROT) $(SOURCES) $(BUILTINS_PIR)
$(PERL) -e "" > src/gen_setting.pir
$(PARROT) $(PARROT_ARGS) -o perl6_s1.pbc perl6.pir

src/gen_grammar.pir: $(PARROT) $(PERL6GRAMMAR) src/parser/grammar.pg src/parser/grammar-oper.pg
$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR) \
src/gen_grammar.pir: $(PARROT) $(PERL6GRAMMAR_PBC) src/parser/grammar.pg src/parser/grammar-oper.pg
$(PARROT) $(PARROT_ARGS) $(PERL6GRAMMAR_PBC) \
--output=src/gen_grammar.pir --encoding=utf8 \
src/parser/grammar.pg src/parser/grammar-oper.pg

src/gen_actions.pir: $(PARROT) $(NQP) $(PCT) src/parser/actions.pm
$(PARROT) $(PARROT_ARGS) $(NQP) --output=src/gen_actions.pir \
src/gen_actions.pir: $(PARROT) $(NQP_PBC) src/parser/actions.pm
$(PARROT) $(PARROT_ARGS) $(NQP_PBC) --output=src/gen_actions.pir \
--encoding=fixed_8 --target=pir src/parser/actions.pm

src/gen_builtins.pir: build/gen_builtins_pir.pl
Expand All @@ -226,20 +263,8 @@ src/gen_uprop.pir: build/gen_uprop_pir.pl
src/gen_setting.pm: build/gen_setting_pm.pl $(SETTING)
$(PERL) build/gen_setting_pm.pl $(SETTING) > src/gen_setting.pm

$(PERL6_GROUP): $(PARROT) $(PMC_SOURCES)
cd $(PMC_DIR) && $(BUILD_DYNPMC) generate $(PMCS)
cd $(PMC_DIR) && $(BUILD_DYNPMC) compile $(PMCS)
cd $(PMC_DIR) && $(BUILD_DYNPMC) linklibs $(PMCS)
cd $(PMC_DIR) && $(BUILD_DYNPMC) copy --destination=$(PARROT_DYNEXT) $(PMCS)

src/ops/perl6_ops$(LOAD_EXT) : $(PARROT) $(OPS_FILE)
@cd $(OPSDIR) && $(BUILD_DYNOPS) generate $(OPSLIB)
@cd $(OPSDIR) && $(BUILD_DYNOPS) compile $(OPSLIB)
@cd $(OPSDIR) && $(BUILD_DYNOPS) linklibs $(OPSLIB)
@cd $(OPSDIR) && $(BUILD_DYNOPS) copy "--destination=$(PARROT_DYNEXT)" $(OPSLIB)

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


Expand Down Expand Up @@ -338,20 +363,15 @@ help:
@echo " help: Print this help message."
@echo ""

Makefile: build/Makefile.in build/PARROT_REVISION $(PARROT) Configure.pl
@echo ""
@echo "warning: Makefile is out of date... re-run Configure.pl"
@echo ""

# Makefile: build/Makefile.in build/PARROT_REVISION $(PARROT) Configure.pl
# @echo ""
# @echo "warning: Makefile is out of date... re-run Configure.pl"
# @echo ""
#
config:
$(PERL) Configure.pl


## Parrot targets
parrot: build/PARROT_REVISION build/gen_parrot.pl
$(PERL) Configure.pl --gen-parrot
$(PARROT):

$(PARROT):

CRITIC_FILES=Configure.pl t/harness build/ tools/

Expand All @@ -367,8 +387,47 @@ manifest:
sort -u -o MANIFEST MANIFEST

release: manifest
[ -n "$(VERSION)" ] || ( echo "\nTry 'make release VERSION=YYYY-MM'\n\n"; exit 1 )
[ -n "$(VERSION)" ] || ( echo "\nTry 'make release VERSION=yyyymm'\n\n"; exit 1 )
[ -d rakudo-$(VERSION) ] || ln -s . rakudo-$(VERSION)
$(PERL) -ne 'print "rakudo-$(VERSION)/$$_"' MANIFEST | \
tar -zcv -T - -f rakudo-$(VERSION).tar.gz
rm rakudo-$(VERSION)

$(DYNEXT_TARGET): $(DYNPMC) $(DYNOPS)
$(CP) $(DYNPMC) $(DYNOPS) $(DYNEXT_DIR)

# (at)cc_o_out(at) and (at)ld_out(at) below cannot be assigned to
# makefile macros, because some make utilities drop the trailing
# spaces and some compilers/linkers forbid a (forced) space.
# See RT #66558 and TT #700.

$(DYNPMC): $(PMC_SOURCES)
$(PMC2C) --no-lines --dump $(PMC2C_INCLUDES) src/pmc/objectref.pmc
$(PMC2C) --no-lines --dump $(PMC2C_INCLUDES) $(PMC_SOURCES)
$(PMC2C) --no-lines --c $(PMC2C_INCLUDES) $(PMC_SOURCES)
$(PMC2C) --no-lines --library $(GROUP) --c $(PMC_SOURCES)
$(CC) -c @cc_o_out@$(GROUP)$(O) -I$(PMC_DIR) $(CINCLUDES) $(CFLAGS) $(GROUP).c
cd $(PMC_DIR) && $(CC) -c $(CINCLUDES) $(CFLAGS) *.c
$(LD) @ld_out@$(DYNPMC) $(GROUP)$(O) src/pmc/*$(O) $(LINKARGS)

$(OPS_DIR)/$(OPS)$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE)
cd $(OPS_DIR) && $(OPS2C) C --dynamic $(OPS_SOURCE)
cd $(OPS_DIR) && $(CC) -c @cc_o_out@$(OPS)$(O) $(CINCLUDES) $(CFLAGS) $(OPS).c
cd $(OPS_DIR) && $(LD) @ld_out@$(OPS)$(LOAD_EXT) $(OPS)$(O) $(LINKARGS)

$(OPS_DIR)/$(OPS)_switch$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE)
cd $(OPS_DIR) && $(OPS2C) CSwitch --dynamic $(OPS_SOURCE)
cd $(OPS_DIR) && $(CC) -c @cc_o_out@$(OPS)_switch$(O) $(CINCLUDES) $(CFLAGS) $(OPS)_switch.c
cd $(OPS_DIR) && $(LD) @ld_out@$(OPS)_switch$(LOAD_EXT) $(OPS)_switch$(O) $(LINKARGS)

$(OPS_DIR)/$(OPS)_cg$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE)
cd $(OPS_DIR) && $(OPS2C) CGoto --dynamic $(OPS_SOURCE)
cd $(OPS_DIR) && $(CC) -c @cc_o_out@$(OPS)_cg$(O) $(CINCLUDES) $(CFLAGS) $(OPS)_cg.c
cd $(OPS_DIR) && $(LD) @ld_out@$(OPS)_cg$(LOAD_EXT) $(OPS)_cg$(O) $(LINKARGS)

$(OPS_DIR)/$(OPS)_cgp$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE)
cd $(OPS_DIR) && $(OPS2C) CGP --dynamic $(OPS_SOURCE)
cd $(OPS_DIR) && $(CC) -c @cc_o_out@$(OPS)_cgp$(O) $(CINCLUDES) $(CFLAGS) $(OPS)_cgp.c
cd $(OPS_DIR) && $(LD) @ld_out@$(OPS)_cgp$(LOAD_EXT) $(OPS)_cgp$(O) $(LINKARGS)


2 changes: 1 addition & 1 deletion build/gen_objectref_pmc.pl
Expand Up @@ -38,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($PConfig{build_dir}.'/src/vtable.tbl');
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
Expand Down
4 changes: 2 additions & 2 deletions build/gen_parrot.pl
Expand Up @@ -33,7 +33,7 @@ =head2 DESCRIPTION

{
no warnings;
if (open my $REV, '-|', "parrot${slash}parrot_config revision") {
if (open my $REV, '-|', "parrot_install${slash}bin${slash}parrot_config revision") {
my $revision = 0+<$REV>;
close $REV;
if ($revision >= $reqsvn) {
Expand Down Expand Up @@ -67,7 +67,7 @@ =head2 DESCRIPTION
print "\nBuilding Parrot ...\n";
my %config = read_parrot_config();
my $make = $config{'make'} or exit(1);
system($make);
system($make, 'install-dev');

sub read_parrot_config {
my %config = ();
Expand Down

0 comments on commit a50e07d

Please sign in to comment.