Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update configure script and makefiles for installed Parrot #711

Closed
p6rt opened this issue Feb 20, 2009 · 19 comments
Closed

Update configure script and makefiles for installed Parrot #711

p6rt opened this issue Feb 20, 2009 · 19 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 20, 2009

Migrated from rt.perl.org#63360 (status was 'resolved')

Searchable as RT63360$

@p6rt
Copy link
Author

p6rt commented Feb 20, 2009

From @allison

The attached git patch updates Rakudo's Configure.pl and Makefile.in to
configure and build on an installed Parrot. It also adds two makefile
templates for building Rakudo's dynops and dynpmcs. Notes​:

- This patch will only work for Parrot r36904 or later. (Parrot needed
changes to the install process and tools libraries to allow running a
language build from an installed Parrot. Also added a script for full
makefile template processing, including conditional lines #IF, #ELSIF,
#ELSE, #UNLESS.)

- It requires a 'dynext/' directory in the Rakudo build directory.
('dynext/', 'library/', and 'includes/' are the standard Parrot search
paths, and will work in the language build directory or installed in
'languages/langname/' or '/install/path/languages/langname/')

- The change *only* uses an installed Parrot (no longer uses Parrot
build directory paths), but it can be installed anywhere (even within
the Rakudo build directory, if desired).

- There's still a problem with the installed test libraries. I'll look
into it and provide an additional patch.

Allison

@p6rt
Copy link
Author

p6rt commented Feb 20, 2009

From @allison

build-from-installed-parrot.patch
From 1d65fcb4f184ca7d8c1feaeb16fef70c919f9e88 Mon Sep 17 00:00:00 2001
From: Allison Randal <allison@parrot.org>
Date: Thu, 19 Feb 2009 23:45:12 -0800
Subject: [PATCH] Update Configure.pl and Makefile.in to configure and build from an installed Parrot. Add two new makefiles for building dynops and dynpmcs.

---
 Configure.pl          |   41 +++++++++++++++-------------
 build/Makefile.in     |   48 +++++++++++++-------------------
 build/ops_makefile.in |   56 +++++++++++++++++++++++++++++++++++++
 build/pmc_makefile.in |   73 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 171 insertions(+), 47 deletions(-)
 create mode 100644 build/ops_makefile.in
 create mode 100644 build/pmc_makefile.in

diff --git a/Configure.pl b/Configure.pl
index 2b19fda..1fc5521 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -50,7 +50,7 @@ END
 }
 
 #  Create the Makefile using the information we just got
-create_makefile(%config);
+create_makefiles(%config);
 
 #  Done.
 done();
@@ -90,28 +90,31 @@ sub read_parrot_config {
 }
 
 
-#  Generate a Makefile from a configuration
-sub create_makefile {
+#  Generate Makefiles from a configuration
+sub create_makefiles {
     my %config = @_;
-    open my $ROOTIN, "<build/Makefile.in" or
-        die "Unable to read build/Makefile.in \n";
-    my $maketext = join('', <$ROOTIN>);
-    close $ROOTIN;
-
-    $config{'win32_libparrot_copy'} = $^O eq 'MSWin32' ? 'copy $(BUILD_DIR)\libparrot.dll .' : '';
-    $maketext =~ s/@(\w+)@/$config{$1}/g;
-    if ($^O eq 'MSWin32') {
-        $maketext =~ s{/}{\\}g;
+    my %makefiles = (
+        "build/Makefile.in" => "Makefile",
+        "build/pmc_makefile.in" => "src/pmc/Makefile",
+        "build/ops_makefile.in" => "src/ops/Makefile",
+    );
+    my $build_tool = $config{perl} . " " 
+        . $config{libdir}
+        . $config{versiondir}
+        . $config{slash}
+        . "tools"
+        . $config{slash}
+        . "dev"
+        . $config{slash}
+        . "gen_makefile.pl";
+
+    foreach my $template (keys %makefiles) {
+        my $makefile = $makefiles{$template};
+	print "Creating $makefile\n";
+        system("$build_tool $template $makefile");
     }
-
-    print "Creating Makefile\n";
-    open(MAKEFILE, ">Makefile") ||
-        die "Unable to write Makefile\n";
-    print MAKEFILE $maketext;
-    close(MAKEFILE);
 }
 
-
 sub done {
     my $make = $config{'make'};
     print <<"END";
diff --git a/build/Makefile.in b/build/Makefile.in
index 5a00f3e..b486b23 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -5,7 +5,10 @@
 PARROT_ARGS =
 
 # values from parrot_config
-BUILD_DIR     = @build_dir@
+VERSION_DIR   = @versiondir@
+LIB_DIR       = @libdir@$(VERSION_DIR)
+BIN_DIR       = @bindir@
+TOOLS_DIR     = @libdir@$(VERSION_DIR)@slash@tools@slash@lib
 LOAD_EXT      = @load_ext@
 O             = @o@
 EXE           = @exe@
@@ -14,24 +17,21 @@ PERL          = @perl@
 RM_F          = @rm_f@
 
 # 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
+PARROT_DYNEXT = $(LIB_DIR)/dynext
+PERL6GRAMMAR  = $(LIB_DIR)/library/PGE/Perl6Grammar.pbc
+NQP           = $(LIB_DIR)/languages/nqp/nqp.pbc
+PCT           = $(LIB_DIR)/library/PCT.pbc
 PMC_DIR       = src/pmc
-OPSDIR        = src/ops
+OPS_DIR       = src/ops
 OPSLIB        = perl6
-OPS_FILE      = src/ops/perl6.ops
+OPS_FILE      = $(OPS_DIR)/perl6.ops
 
 # Set up extensions
 
 # Setup some commands
-PARROT        = $(BUILD_DIR)/parrot$(EXE)
+PARROT        = $(BIN_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)
+PBC_TO_EXE    = $(BIN_DIR)/pbc_to_exe$(EXE)
 
 SOURCES = perl6.pir \
   src/gen_grammar.pir \
@@ -43,7 +43,7 @@ SOURCES = perl6.pir \
   src/parser/methods.pir \
   src/parser/quote_expression.pir \
   $(PERL6_GROUP) \
-  src/ops/perl6_ops$(LOAD_EXT)
+  $(OPS_DIR)/perl6_ops$(LOAD_EXT)
 
 BUILTINS_PIR = \
   src/classes/ClassHOW.pir \
@@ -110,8 +110,6 @@ SETTING = \
   src/setting/Pair.pm \
   src/setting/Whatever.pm \
 
-PMCS        = perl6str objectref perl6scalar mutablevar perl6multisub
-
 PMC_SOURCES = $(PMC_DIR)/perl6str.pmc $(PMC_DIR)/objectref.pmc $(PMC_DIR)/perl6scalar.pmc \
               $(PMC_DIR)/mutablevar.pmc $(PMC_DIR)/perl6multisub.pmc
 
@@ -157,7 +155,7 @@ all: perl6$(EXE)
 # (We're not quite ready to make this a default target.)
 perl6$(EXE): perl6.pbc
 	$(PBC_TO_EXE) perl6.pbc
-	@win32_libparrot_copy@
+#IF(win32):	copy $(LIB_DIR)\libparrot.dll .
 
 spectest_checkout : t/spec
 
@@ -190,7 +188,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) -I$(BUILD_DIR)/lib build/gen_objectref_pmc.pl $(PMC_DIR)/objectref_pmc.template \
+	$(PERL) -I$(TOOLS_DIR) 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
@@ -214,17 +212,11 @@ src/gen_junction.pir: build/gen_junction_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) : $(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)
+$(PERL6_GROUP): $(PARROT) $(PMC_SOURCES) $(PMC_DIR)/Makefile
+	$(MAKE) $(PMC_DIR)
+
+$(OPS_DIR)/perl6_ops$(LOAD_EXT) : $(OPS_FILE) $(OPS_DIR)/Makefile
+	$(MAKE) $(OPS_DIR)
 
 
 ##  local copy of Parrot
diff --git a/build/ops_makefile.in b/build/ops_makefile.in
new file mode 100644
index 0000000..94e9298
--- /dev/null
+++ b/build/ops_makefile.in
@@ -0,0 +1,56 @@
+# Copyright (C) 2009, The Perl Foundation.
+# $Id: $
+
+PERL          = @perl@
+RM_F          = @rm_f@
+CHMOD         = @chmod@
+CP            = @cp@
+VERSION_DIR   = @versiondir@
+INCLUDE_DIR   = @includedir@$(VERSION_DIR)
+LIB_DIR       = @libdir@$(VERSION_DIR)
+INSTALL_DIR   = ..@slash@..@slash@dynext
+O             = @o@
+LOAD_EXT      = @load_ext@
+CC            = @cc@ -c
+LD            = @ld@
+LDFLAGS       = @ldflags@ @ld_debug@ @rpath_blib@ @linkflags@
+LD_LOAD_FLAGS = @ld_load_flags@
+CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
+CC_OUT        = @cc_o_out@
+LD_OUT        = @ld_out@
+#IF(parrot_is_shared):LIBPARROT = @libparrot_ldflags@
+#ELSE:LIBPARROT =
+
+BUILD_TOOLS_DIR = $(LIB_DIR)@slash@tools@slash@build
+OPS2C           = $(PERL) $(BUILD_TOOLS_DIR)@slash@ops2c.pl
+
+INCLUDES        = -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)@slash@pmc
+LINKARGS        = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)
+
+OPS_FILE = perl6.ops
+
+
+all : install
+
+generate : $(OPS_FILE)
+	$(OPS2C) C --dynamic $(OPS_FILE)
+	$(OPS2C) CSwitch --dynamic $(OPS_FILE)
+#IF(cg_flag):	$(OPS2C) CGoto --dynamic $(OPS_FILE)
+#IF(cg_flag):	$(OPS2C) CGP --dynamic $(OPS_FILE)
+
+compile : generate
+	$(CC) $(CC_OUT) perl6_ops$(O) $(INCLUDES) $(CFLAGS) perl6_ops.c
+	$(CC) $(CC_OUT) perl6_ops_switch$(O) $(INCLUDES) $(CFLAGS) perl6_ops_switch.c
+#IF(cg_flag):	$(CC) $(CC_OUT) perl6_ops_cg$(O) $(INCLUDES) $(CFLAGS) perl6_ops_cg.c
+#IF(cg_flag):	$(CC) $(CC_OUT) perl6_ops_cgp$(O) $(INCLUDES) $(CFLAGS) perl6_ops_cgp.c
+
+linklibs : compile
+	$(LD) $(LD_OUT) perl6_ops$(LOAD_EXT) perl6_ops$(O) $(LINKARGS)
+	$(LD) $(LD_OUT) perl6_ops_switch$(LOAD_EXT) perl6_ops_switch$(O) $(LINKARGS)
+#IF(cg_flag):	$(LD) $(LD_OUT) perl6_ops_cg$(LOAD_EXT) perl6_ops_cg$(O) $(LINKARGS)
+#IF(cg_flag):	$(LD) $(LD_OUT) perl6_ops_cgp$(LOAD_EXT) perl6_ops_cgp$(O) $(LINKARGS)
+
+install : linklibs
+#IF(cygwin or hpux):	CHMOD 0775 "*$(LOAD_EXT)"
+	$(CP) "*$(LOAD_EXT)" $(INSTALL_DIR)
+
diff --git a/build/pmc_makefile.in b/build/pmc_makefile.in
new file mode 100644
index 0000000..40d71e2
--- /dev/null
+++ b/build/pmc_makefile.in
@@ -0,0 +1,73 @@
+# Copyright (C) 2009, The Perl Foundation.
+# $Id: $
+
+PERL          = @perl@
+RM_F          = @rm_f@
+CHMOD         = @chmod@
+CP            = @cp@
+VERSION_DIR   = @versiondir@
+INCLUDE_DIR   = @includedir@$(VERSION_DIR)
+LIB_DIR       = @libdir@$(VERSION_DIR)
+SRC_DIR       = @srcdir@$(VERSION_DIR)
+INSTALL_DIR   = ../../dynext
+O             = @o@
+LOAD_EXT      = @load_ext@
+CC            = @cc@ -c
+LD            = @ld@
+LDFLAGS       = @ldflags@ @ld_debug@
+LD_LOAD_FLAGS = @ld_load_flags@
+CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
+CC_OUT        = @cc_o_out@
+LD_OUT        = @ld_out@
+#IF(parrot_is_shared):LIBPARROT = @libparrot_ldflags@
+#ELSE:LIBPARROT =
+
+BUILD_TOOLS_DIR = $(LIB_DIR)@slash@tools@slash@build
+PMC2C_INCLUDES  = --include $(SRC_DIR) --include $(SRC_DIR)@slash@pmc
+PMC2C           = $(PERL) $(BUILD_TOOLS_DIR)@slash@pmc2c.pl
+PMC2CD = $(PMC2C) --dump $(PMC2C_INCLUDES)
+PMC2CC = $(PMC2C) --c $(PMC2C_INCLUDES)
+
+INCLUDES        = -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)@slash@pmc
+LINKARGS        = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)
+
+PMC_SOURCES = \
+  perl6str.pmc \
+  objectref.pmc \
+  perl6scalar.pmc \
+  mutablevar.pmc \
+  perl6multisub.pmc
+
+PERL6_GROUP = perl6_group
+
+
+all : install
+
+generate : $(PMC_SOURCES)
+	$(PMC2CD) perl6str.pmc
+	$(PMC2CD) objectref.pmc
+	$(PMC2CD) perl6scalar.pmc
+	$(PMC2CD) mutablevar.pmc
+	$(PMC2CD) perl6multisub.pmc
+	$(PMC2CC) perl6str.pmc
+	$(PMC2CC) objectref.pmc
+	$(PMC2CC) perl6scalar.pmc
+	$(PMC2CC) mutablevar.pmc
+	$(PMC2CC) perl6multisub.pmc
+	$(PMC2C) --library $(PERL6_GROUP) --c $(PMC_SOURCES)
+
+compile : generate
+	$(CC) $(CC_OUT) perl6str$(O) $(INCLUDES) $(CFLAGS) perl6str.c
+	$(CC) $(CC_OUT) objectref$(O) $(INCLUDES) $(CFLAGS) objectref.c
+	$(CC) $(CC_OUT) perl6scalar$(O) $(INCLUDES) $(CFLAGS) perl6scalar.c
+	$(CC) $(CC_OUT) mutablevar$(O) $(INCLUDES) $(CFLAGS) mutablevar.c
+	$(CC) $(CC_OUT) perl6multisub$(O) $(INCLUDES) $(CFLAGS) perl6multisub.c
+	$(CC) $(CC_OUT) lib-$(PERL6_GROUP)$(O) $(INCLUDES) $(CFLAGS) $(PERL6_GROUP).c
+
+linklibs : compile
+	$(LD) $(LD_OUT) $(PERL6_GROUP)$(LOAD_EXT) lib-$(PERL6_GROUP)$(O) perl6str$(O) objectref$(O) perl6scalar$(O) mutablevar$(O) perl6multisub$(O) $(LINKARGS)
+
+install : linklibs
+#IF(cygwin or hpux):	CHMOD 0775 "*$(LOAD_EXT)"
+	$(CP) "*$(LOAD_EXT)" $(INSTALL_DIR)
+
-- 
1.5.6.3

@p6rt
Copy link
Author

p6rt commented Feb 24, 2009

From @allison

On Fri Feb 20 00​:36​:36 2009, allison@​perl.org wrote​:

- There's still a problem with the installed test libraries. I'll look
into it and provide an additional patch.

Ah, it wasn't a problem with the test libraries, just with Rakudo's
t/harness (using a hardcoded path to the parrot executable). Attached
git patch to fix the test target.

Allison

@p6rt
Copy link
Author

p6rt commented Feb 24, 2009

From @allison

rakudo_test_from_installed_parrot.patch
From 90672654a8f2600dbc8b67f4f46286d1ed2b7279 Mon Sep 17 00:00:00 2001
From: Allison Randal <allison@parrot.org>
Date: Mon, 23 Feb 2009 18:03:30 -0800
Subject: [PATCH] Also fix t/harness to use installed Parrot executable when requested, instead of looking for the executable in a 'parrot/' subdirectory.

---
 build/Makefile.in |    4 ++--
 t/harness         |   16 ++++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/build/Makefile.in b/build/Makefile.in
index 3244ff0..9c88b2e 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -149,7 +149,7 @@ CLEANUPS = \
 
 # 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
+HARNESS_WITH_FUDGE = $(PERL) -I$(TOOLS_DIR) t/harness --bindir=$(BIN_DIR) --fudge --keep-exit-code
 HARNESS_WITH_FUDGE_JOBS = $(HARNESS_WITH_FUDGE) --jobs
 
 
@@ -243,7 +243,7 @@ codetest:
 
 coretest: perl6.pbc
 #	prove t/pmc
-	$(PERL) t/harness t/00-parrot t/01-sanity
+	$(PERL) -I$(TOOLS_DIR) t/harness --bindir=$(BIN_DIR) t/00-parrot t/01-sanity
 
 fulltest: coretest spectest codetest
 
diff --git a/t/harness b/t/harness
index 48f2aab..26327fe 100644
--- a/t/harness
+++ b/t/harness
@@ -20,21 +20,25 @@ our %harness_args = (
     verbosity => 0,
 );
 
-if (-d 'parrot') {
-    $harness_args{exec}     = ['parrot/parrot', 'perl6.pbc'];
-} else {
-    $harness_args{compiler} = 'perl6.pbc';
-}
-
 GetOptions(
         'tests-from-file=s' => \my $list_file,
         'fudge'             => \my $do_fudge,
         'verbosity=i'       => \$harness_args{verbosity},
+        'bindir=s'          => \$harness_args{bindir},
         # A sensible default is num_cores + 1.
         # Many people have two cores these days.
         'jobs:3'            => \$harness_args{jobs},
     );
 
+if ($harness_args{bindir}) {
+    $harness_args{exec}     = [$harness_args{bindir}.'/parrot', 'perl6.pbc'];
+} elsif (-d 'parrot') {
+    $harness_args{exec}     = ['parrot/parrot', 'perl6.pbc'];
+} else {
+    $harness_args{compiler} = 'perl6.pbc';
+}
+
+
 
 my @pass_through_options = grep m/^--?[^-]/, @ARGV;
 my @files = grep m/^[^-]/, @ARGV;
-- 
1.5.6.3

@p6rt
Copy link
Author

p6rt commented Feb 24, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 30, 2009

From wayland@wayland.id.au

Attached an updated patch. pmichaud has stated that he will not accept
multiple make files, which this contains. He's planning on updating the
makefiles himself. In the meantime, this patch is something which
works, but which I will update when pmichaud has updated the makefile.

@p6rt
Copy link
Author

p6rt commented May 30, 2009

From wayland@wayland.id.au

rakudo_build_rpm_4.patch
diff --git a/Configure.pl b/Configure.pl
index 07bbf0d..9b74269 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -7,8 +7,10 @@ use warnings;
 use Getopt::Long;
 
 MAIN: {
-    my %options;
-    GetOptions(\%options, 'help!', 'parrot-config=s',
+    my %options = (
+        'rakudo-version' => 'build14',
+    );
+    GetOptions(\%options, 'help!', 'parrot-config=s', 'rakudo-version=s',
                'gen-parrot!', 'gen-parrot-option=s@');
 
     # Print help if it's requested
@@ -52,7 +54,14 @@ MAIN: {
         $parrot_errors .= "Unable to locate parrot_config\n"; 
     }
     elsif ($required > $config{'revision'}) {
-        $parrot_errors .= "Parrot revision r$required required (currently r$config{'revision'})\n";
+        # If Parrot was built from a tarball or package, the revision number 
+        # is 0, so we'd need to use the Parrot version instead.  But even 
+        # that is unreliable, as someone may have built their own package 
+        # from SVN.  So just let them do their thing, and worry about it
+        # some other time.  
+        if($config{'revision'} != 0) {
+            $parrot_errors .= "Parrot revision r$required required (currently r$config{'revision'})\n";
+        }
     }
 
     if ($parrot_errors) {
@@ -65,8 +74,16 @@ the location of parrot_config to be used to build Rakudo Perl.
 END
     }
 
+    my($short);
+    my(%rakudo_config) = ();
+    foreach(qw(rakudo-version)) {
+        $short = $_;
+	$short =~ s/-//g;
+        $rakudo_config{$short} = $options{$_};
+    }
+
 #  Create the Makefile using the information we just got
-    create_makefile(%config);
+    create_makefiles(\%config, \%rakudo_config);
     my $make = $config{'make'};
 
     {
@@ -110,26 +127,44 @@ sub read_parrot_config {
 
 
 #  Generate a Makefile from a configuration
-sub create_makefile {
-    my %config = @_;
-
-    my $maketext = slurp( 'build/Makefile.in' );
+sub create_makefiles {
+    my($config, $rakudo_config) = @_;
+    my %makefiles = (
+        "build/Makefile.in" => "Makefile",
+        "build/pmc_makefile.in" => "src/pmc/Makefile",
+        "build/ops_makefile.in" => "src/ops/Makefile",
+    );
+    my $build_tool = $config->{perl} . " " 
+        . $config->{libdir}
+        . $config->{versiondir}
+        . $config->{slash}
+        . "tools"
+        . $config->{slash}
+        . "dev"
+        . $config->{slash}
+        . "gen_makefile.pl";
+
+    my($text);
+    foreach my $template (keys %makefiles) {
+        my $makefile = $makefiles{$template};
+        print "Creating $makefile\n";
+        $text = slurp($template);
+        $config->{'win32_libparrot_copy'} = $^O eq 'MSWin32' ? 'copy $(BUILD_DIR)\libparrot.dll .' : '';
+        $text =~ s{\@(\w+)\@}{
+              defined($rakudo_config->{$1}) ? $rakudo_config->{$1} : $&
+        }eg;
+        if ($^O eq 'MSWin32') {
+            $text =~ s{/}{\\}g;
+            $text =~ s{\\\*}{\\\\*}g;
+            $text =~ s{http:\S+}{ do {my $t = $&; $t =~ s'\\'/'g; $t} }eg;
+        }
 
-    $config{'win32_libparrot_copy'} = $^O eq 'MSWin32' ? 'copy $(BUILD_DIR)\libparrot.dll .' : '';
-    $maketext =~ s/@(\w+)@/$config{$1}/g;
-    if ($^O eq 'MSWin32') {
-        $maketext =~ s{/}{\\}g;
-        $maketext =~ s{\\\*}{\\\\*}g;
-        $maketext =~ s{http:\S+}{ do {my $t = $&; $t =~ s'\\'/'g; $t} }eg;
+        open(FILE, ">$template.tmp") or die "Error opening file '$template.tmp' for writing: $!";
+        print FILE $text;
+        close(FILE);
+        system("$build_tool $template.tmp $makefile");
     }
 
-    my $outfile = 'Makefile';
-    print "\nCreating $outfile ...\n";
-    open(my $MAKEOUT, '>', $outfile) ||
-        die "Unable to write $outfile\n";
-    print {$MAKEOUT} $maketext;
-    close $MAKEOUT or die $!;
-
     return;
 }
 
@@ -157,6 +192,8 @@ General Options:
                        Set parrot config option when using --gen-parrot
     --parrot-config=(config)
                        Use configuration information from config
+    --rakudo-version=(version)
+                       Version of Rakudo to call this build
 END
 
     return;
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..8ef4a34
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,28 @@
+# Copied in a monkey-see-monkey-do fashion from Parrot.  I (Tim Nelson)
+# don't have a real grip on what's going on here; I just want it to work :)
+perl6                                                     [main]bin
+src/pmc/perl6_group.so                                    [main]runtime
+src/ops/perl6_ops.so                                      [main]runtime
+src/ops/perl6_ops_cg.so                                   [main]runtime
+src/ops/perl6_ops_cgp.so                                  [main]runtime
+src/ops/perl6_ops_switch.so                               [main]runtime
+Test.pm							[library]lib
+#src/utils/perl6doc/actions.pm				[library]lib
+#src/parser/actions.pm					[library]lib
+src/setting/IO.pm					[library]lib
+src/setting/Any-list.pm					[library]lib
+src/setting/Hash.pm					[library]lib
+src/setting/Array.pm					[library]lib
+src/setting/IO/Socket.pm				[library]lib
+src/setting/IO/Socket/INET.pm				[library]lib
+src/setting/Range.pm					[library]lib
+src/setting/Num.pm					[library]lib
+src/setting/List.pm					[library]lib
+src/setting/Match.pm					[library]lib
+src/setting/Bool.pm					[library]lib
+src/setting/Object.pm					[library]lib
+src/setting/Pair.pm					[library]lib
+src/setting/Any-num.pm					[library]lib
+src/setting/Any-str.pm					[library]lib
+src/setting/Whatever.pm					[library]lib
+
diff --git a/build/Makefile.in b/build/Makefile.in
index 954e204..fd81522 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -1,11 +1,14 @@
 # Copyright (C) 2006-2009, The Perl Foundation.
 # $Id$
 
-# arguments we want to run parrot with
-PARROT_ARGS =
+# Overridden from outside
+DESTDIR         :=
 
 # values from parrot_config
-BUILD_DIR     = @build_dir@
+VERSION_DIR   = @versiondir@
+LIB_DIR       = @libdir@$(VERSION_DIR)
+BIN_DIR       = @bindir@
+TOOLS_DIR     = @libdir@$(VERSION_DIR)@slash@tools@slash@lib
 LOAD_EXT      = @load_ext@
 O             = @o@
 EXE           = @exe@
@@ -14,22 +17,24 @@ 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
+PARROT_DYNEXT = $(LIB_DIR)/dynext
+RAKUDO_DYNEXT = $(DESTDIR)@slash@usr@slash@lib@slash@rakudo@slash@@rakudoversion@@slash@dynext
+PERL6GRAMMAR  = $(LIB_DIR)/library/PGE/Perl6Grammar.pbc
+PERL6LIBDIR   = @libdir@/perl6
+NQP           = $(LIB_DIR)/languages/nqp/nqp.pbc
+PCT           = $(LIB_DIR)/library/PCT.pbc
 PMC_DIR       = src/pmc
-OPSDIR        = src/ops
+OPS_DIR       = src/ops
 OPSLIB        = perl6
-OPS_FILE      = src/ops/perl6.ops
+OPS_FILE      = $(OPS_DIR)/perl6.ops
+
+# arguments we want to run parrot with
+PARROT_ARGS   = -X$(RAKUDO_DYNEXT)
 
 # Setup some commands
-PARROT        = $(BUILD_DIR)/parrot$(EXE)
+PARROT        = $(BIN_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)
+PBC_TO_EXE    = $(BIN_DIR)/pbc_to_exe$(EXE)
 
 SOURCES = perl6.pir \
   src/gen_grammar.pir \
@@ -48,7 +53,7 @@ SOURCES = perl6.pir \
   src/parrot/state.pir \
   src/gen_uprop.pir \
   $(PERL6_GROUP) \
-  src/ops/perl6_ops$(LOAD_EXT)
+  $(OPS_DIR)/perl6_ops$(LOAD_EXT)
 
 BUILTINS_PIR = \
   src/classes/Object.pir \
@@ -124,8 +129,6 @@ SETTING = \
   src/setting/Range.pm \
   src/setting/Whatever.pm \
 
-PMCS        = perl6str objectref perl6scalar mutablevar perl6multisub p6invocation
-
 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
 
@@ -153,14 +156,14 @@ 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 = $(PERL) -I$(TOOLS_DIR) t/harness --bindir=$(BIN_DIR) --fudge --keep-exit-code --icu=$(HAS_ICU)
 HARNESS_WITH_FUDGE_JOBS = $(HARNESS_WITH_FUDGE) --jobs
 
 
@@ -172,7 +175,7 @@ xmas: perl6$(EXE)
 ##  targets for building a standalone perl6.
 perl6$(EXE): perl6.pbc
 	$(PBC_TO_EXE) perl6.pbc
-	@win32_libparrot_copy@
+#IF(win32):	copy $(LIB_DIR)\libparrot.dll .
 
 # the Perl 6 compiler
 perl6.pbc: perl6_s1.pbc src/gen_setting.pm
@@ -211,20 +214,15 @@ 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)
+$(PERL6_GROUP): $(PARROT) $(PMC_SOURCES) $(PMC_DIR)/Makefile
+	$(MAKE) -C $(PMC_DIR)
+
+$(OPS_DIR)/perl6_ops$(LOAD_EXT) : $(OPS_FILE) $(OPS_DIR)/Makefile
+	$(MAKE) -C $(OPS_DIR)
 
-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$(TOOLS_DIR) build/gen_objectref_pmc.pl $(PMC_DIR)/objectref_pmc.template \
 		$(PMC_DIR)/objectref.pmc
 
 
@@ -237,7 +235,7 @@ test    : coretest
 fulltest: coretest spectest
 
 coretest: perl6$(EXE)
-	$(PERL) t/harness t/00-parrot t/01-sanity
+	$(PERL) -I$(TOOLS_DIR) t/harness --bindir=$(BIN_DIR) t/00-parrot t/01-sanity
 
 # Run the spectests that we know work.
 spectest_regression: spectest
@@ -338,7 +336,8 @@ parrot: build/PARROT_REVISION build/gen_parrot.pl
 $(PARROT): 
 
 
-CRITIC_FILES=Configure.pl t/harness build/ tools/
+# Next line must not end with a slash; I added a space
+CRITIC_FILES=Configure.pl t/harness build/ tools/ 
 
 perlcritic:
 	perlcritic -1 --profile tools/util/perlcritic.conf $(CRITIC_FILES)
@@ -357,3 +356,21 @@ release: manifest
 	$(PERL) -ne 'print "rakudo-$(VERSION)/$$_"' MANIFEST | \
 	    tar -zcv -T - -f rakudo-$(VERSION).tar.gz
 	rm rakudo-$(VERSION)
+
+install:
+	$(PERL) -I/usr/lib/parrot/1.2.0-devel/tools/lib/ tools/build/install_files.pl \
+    --buildprefix=$(BUILDPREFIX) \
+    --prefix=$(PREFIX) \
+    --exec-prefix=$(EXEC_PREFIX) \
+    --bindir=$(BIN_DIR) \
+    --libdir=$(LIB_DIR) \
+    --includedir=$(INCLUDE_DIR) \
+    --destdir=$(DESTDIR) \
+    --docdir=$(DOC_DIR) \
+    --datadir=$(DATA_DIR) \
+    --srcdir=@srcdir@ \
+    --versiondir=$(VERSION_DIR) \
+    --perl6libdir=$(PERL6LIBDIR) \
+    MANIFEST
+
+#
diff --git a/build/ops_makefile.in b/build/ops_makefile.in
new file mode 100644
index 0000000..ff48df7
--- /dev/null
+++ b/build/ops_makefile.in
@@ -0,0 +1,64 @@
+# Copyright (C) 2009, The Perl Foundation.
+# $Id: $
+
+# Common values from parrot_config
+VERSION_DIR   = @versiondir@
+LIB_DIR       = @libdir@$(VERSION_DIR)
+LOAD_EXT      = @load_ext@
+O             = @o@
+PERL          = @perl@
+RM_F          = @rm_f@
+
+# Other values from parrot_config
+CHMOD         = @chmod@
+CP            = @cp@
+INCLUDE_DIR   = @includedir@$(VERSION_DIR)
+INSTALL_DIR   = @buildroot@@slash@usr@slash@lib@slash@rakudo@slash@@rakudoversion@@slash@dynext
+CC            = @cc@ -c
+LD            = @ld@
+LDFLAGS       = @ldflags@ @ld_debug@ @rpath_blib@ @linkflags@
+LD_LOAD_FLAGS = @ld_load_flags@
+CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
+CC_OUT        = @cc_o_out@
+LD_OUT        = @ld_out@
+#IF(parrot_is_shared):LIBPARROT = @libparrot_ldflags@
+#ELSE:LIBPARROT =
+
+MKPATH         = @mkpath@
+
+BUILD_TOOLS_DIR = $(LIB_DIR)@slash@tools@slash@build
+OPS2C           = $(PERL) $(BUILD_TOOLS_DIR)@slash@ops2c.pl
+
+INCLUDES        = -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)@slash@pmc
+LINKARGS        = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)
+
+OPS_FILE = perl6.ops
+
+
+all : install
+
+generate : $(OPS_FILE)
+	$(OPS2C) C --dynamic $(OPS_FILE)
+	$(OPS2C) CSwitch --dynamic $(OPS_FILE)
+#IF(cg_flag):	$(OPS2C) CGoto --dynamic $(OPS_FILE)
+#IF(cg_flag):	$(OPS2C) CGP --dynamic $(OPS_FILE)
+
+compile : generate
+	$(CC) $(CC_OUT) perl6_ops$(O) $(INCLUDES) $(CFLAGS) perl6_ops.c
+	$(CC) $(CC_OUT) perl6_ops_switch$(O) $(INCLUDES) $(CFLAGS) perl6_ops_switch.c
+#IF(cg_flag):	$(CC) $(CC_OUT) perl6_ops_cg$(O) $(INCLUDES) $(CFLAGS) perl6_ops_cg.c
+#IF(cg_flag):	$(CC) $(CC_OUT) perl6_ops_cgp$(O) $(INCLUDES) $(CFLAGS) perl6_ops_cgp.c
+
+linklibs : compile
+	$(LD) $(LD_OUT) perl6_ops$(LOAD_EXT) perl6_ops$(O) $(LINKARGS)
+	$(LD) $(LD_OUT) perl6_ops_switch$(LOAD_EXT) perl6_ops_switch$(O) $(LINKARGS)
+#IF(cg_flag):	$(LD) $(LD_OUT) perl6_ops_cg$(LOAD_EXT) perl6_ops_cg$(O) $(LINKARGS)
+#IF(cg_flag):	$(LD) $(LD_OUT) perl6_ops_cgp$(LOAD_EXT) perl6_ops_cgp$(O) $(LINKARGS)
+
+install_dir_exists :
+	$(MKPATH) $(INSTALL_DIR)
+
+install : linklibs install_dir_exists
+#IF(cygwin or hpux):	CHMOD 0775 "*$(LOAD_EXT)"
+	$(CP) "*$(LOAD_EXT)" $(INSTALL_DIR)
+
diff --git a/build/pmc_makefile.in b/build/pmc_makefile.in
new file mode 100644
index 0000000..d4ff40a
--- /dev/null
+++ b/build/pmc_makefile.in
@@ -0,0 +1,81 @@
+# Copyright (C) 2009, The Perl Foundation.
+# $Id: $
+
+# Common values from parrot_config
+VERSION_DIR   = @versiondir@
+LIB_DIR       = @libdir@$(VERSION_DIR)
+LOAD_EXT      = @load_ext@
+O             = @o@
+PERL          = @perl@
+RM_F          = @rm_f@
+
+# Other values from parrot_config
+CHMOD         = @chmod@
+CP            = @cp@
+INCLUDE_DIR   = @includedir@$(VERSION_DIR)
+SRC_DIR       = @srcdir@$(VERSION_DIR)
+INSTALL_DIR   = @buildroot@@slash@usr@slash@lib@slash@rakudo@slash@@rakudoversion@@slash@dynext
+CC            = @cc@ -c
+LD            = @ld@
+LDFLAGS       = @ldflags@ @ld_debug@
+LD_LOAD_FLAGS = @ld_load_flags@
+CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
+CC_OUT        = @cc_o_out@
+LD_OUT        = @ld_out@
+#IF(parrot_is_shared):LIBPARROT = @libparrot_ldflags@
+#ELSE:LIBPARROT =
+
+MKPATH         = @mkpath@
+
+BUILD_TOOLS_DIR = $(LIB_DIR)@slash@tools@slash@build
+PMC2C_INCLUDES  = --include $(SRC_DIR) --include $(SRC_DIR)@slash@pmc
+PMC2C           = $(PERL) $(BUILD_TOOLS_DIR)@slash@pmc2c.pl
+PMC2CD = $(PMC2C) --dump $(PMC2C_INCLUDES)
+PMC2CC = $(PMC2C) --c $(PMC2C_INCLUDES)
+
+INCLUDES        = -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)@slash@pmc
+LINKARGS        = $(LDFLAGS) $(LD_LOAD_FLAGS) $(LIBPARROT)
+
+PMC_SOURCES = \
+  perl6str.pmc \
+  objectref.pmc \
+  perl6scalar.pmc \
+  mutablevar.pmc \
+  perl6multisub.pmc
+
+PERL6_GROUP = perl6_group
+
+
+all : install
+
+generate : $(PMC_SOURCES)
+	$(PMC2CD) perl6str.pmc
+	$(PMC2CD) objectref.pmc
+	$(PMC2CD) perl6scalar.pmc
+	$(PMC2CD) mutablevar.pmc
+	$(PMC2CD) perl6multisub.pmc
+	$(PMC2CC) perl6str.pmc
+	$(PMC2CC) objectref.pmc
+	$(PMC2CC) perl6scalar.pmc
+	$(PMC2CC) mutablevar.pmc
+	$(PMC2CC) perl6multisub.pmc
+	$(PMC2C) --library $(PERL6_GROUP) --c $(PMC_SOURCES)
+
+compile : generate
+	$(CC) $(CC_OUT) perl6str$(O) $(INCLUDES) $(CFLAGS) perl6str.c
+	$(CC) $(CC_OUT) objectref$(O) $(INCLUDES) $(CFLAGS) objectref.c
+	$(CC) $(CC_OUT) perl6scalar$(O) $(INCLUDES) $(CFLAGS) perl6scalar.c
+	$(CC) $(CC_OUT) mutablevar$(O) $(INCLUDES) $(CFLAGS) mutablevar.c
+	$(CC) $(CC_OUT) perl6multisub$(O) $(INCLUDES) $(CFLAGS) perl6multisub.c
+	$(CC) $(CC_OUT) lib-$(PERL6_GROUP)$(O) $(INCLUDES) $(CFLAGS) $(PERL6_GROUP).c
+
+linklibs : compile
+	$(LD) $(LD_OUT) $(PERL6_GROUP)$(LOAD_EXT) lib-$(PERL6_GROUP)$(O) perl6str$(O) objectref$(O) perl6scalar$(O) mutablevar$(O) perl6multisub$(O) $(LINKARGS)
+
+install_dir_exists :
+	$(MKPATH) $(INSTALL_DIR)
+
+install : linklibs install_dir_exists
+#IF(cygwin or hpux):	CHMOD 0775 "*$(LOAD_EXT)"
+	$(CP) "*$(LOAD_EXT)" $(INSTALL_DIR)
+
diff --git a/build/rakudo.spec b/build/rakudo.spec
new file mode 100644
index 0000000..f04da3c
--- /dev/null
+++ b/build/rakudo.spec
@@ -0,0 +1,97 @@
+Name:           rakudo
+Version:        build17
+Release:        1
+Summary:        Rakudo Perl 6
+License:        Artistic 2.0
+Group:          Development/Libraries
+URL:            http://www.rakudo.org/
+Source0:        http://www.pmichaud.com/perl6/rakudo-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires:  parrot           >= 1.2.0
+BuildRequires:  parrot-devel     >= 1.2.0
+
+%define parrot_versiondir 1.2.0-devel
+
+%define parrot_dynext %{_libdir}/parrot/%{parrot_versiondir}/dynext
+
+%define rakudo_libs %{_libdir}/perl6/rakudo
+
+# Versions don't go easily in install_files.pl yet
+#%define dynext %{parrot_dynext}/%{name}/%{version}
+%define rakudo_dynext %{parrot_dynext}/%{name}
+
+%description
+Rakudo Perl 6 is an implementation of the Perl 6 specification which
+runs on the Parrot virtual machine.  Perl 6 is a programming language
+which supersedes earlier versions of Perl.  
+
+%prep
+%setup -q
+
+%build
+echo Building with root $RPM_BUILD_ROOT
+%{__perl} Configure.pl
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make install DESTDIR=$RPM_BUILD_ROOT
+
+pushd $RPM_BUILD_ROOT/%{parrot_dynext}
+for i in %{name}/*.so; do 
+	ln -s $i
+done
+popd
+
+%check
+# make test < /dev/null
+# %{?_with_fulltest:make fulltest < /dev/null}
+# make test || :
+# %{?_with_fulltest:make fulltest || :}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%doc CREDITS README
+%doc docs
+%{parrot_dynext}/perl6_group.so
+%{parrot_dynext}/perl6_ops.so
+%{parrot_dynext}/perl6_ops_cg.so
+%{parrot_dynext}/perl6_ops_cgp.so
+%{parrot_dynext}/perl6_ops_switch.so
+%{rakudo_dynext}/perl6_group.so
+%{rakudo_dynext}/perl6_ops.so
+%{rakudo_dynext}/perl6_ops_cg.so
+%{rakudo_dynext}/perl6_ops_cgp.so
+%{rakudo_dynext}/perl6_ops_switch.so
+%{_bindir}/perl6
+%{rakudo_libs}/Test.pm
+%{rakudo_libs}/IO.pm
+%{rakudo_libs}/Any-list.pm
+%{rakudo_libs}/Hash.pm
+%{rakudo_libs}/Array.pm
+%{rakudo_libs}/IO/Socket.pm
+%{rakudo_libs}/IO/Socket/INET.pm
+%{rakudo_libs}/Range.pm
+%{rakudo_libs}/Num.pm
+%{rakudo_libs}/List.pm
+%{rakudo_libs}/Match.pm
+%{rakudo_libs}/Bool.pm
+%{rakudo_libs}/Object.pm
+%{rakudo_libs}/Pair.pm
+%{rakudo_libs}/Any-num.pm
+%{rakudo_libs}/Any-str.pm
+%{rakudo_libs}/Whatever.pm
+
+%changelog
+* Fri Mar  6 2009 wayland <wayland@wayland.id.au> 0.17
+- created from parrot.spec
+- Didn't redo any of the files stuff
+- Played with things 'til it worked
diff --git a/tools/build/install_files.pl b/tools/build/install_files.pl
new file mode 100644
index 0000000..8f4d1e7
--- /dev/null
+++ b/tools/build/install_files.pl
@@ -0,0 +1,284 @@
+#! perl
+
+# Note this is a direct copy of the parrot file tools/dev/install_files.pl
+# with just a few changes.  As that file in the Parrot distribution continues
+# to evolve into something shorter, hopefully this file will also be replaced
+# with something much shorter.  
+
+################################################################################
+# Copyright (C) 2001-2009, Parrot Foundation.
+# $Id: install_files.pl 39165 2009-05-25 01:15:28Z jkeenan $
+################################################################################
+
+=head1 TITLE
+
+tools/dev/install_files.pl - Copy files to their correct locations
+
+=head1 SYNOPSIS
+
+    % perl tools/dev/install_files.pl [options]
+
+=head1 DESCRIPTION
+
+Use a detailed MANIFEST to install a set of files.
+
+=head2 Options
+
+=over 4
+
+=item C<buildprefix>
+
+The build prefix. Defaults to ''.
+
+=item C<prefix>
+
+The install prefix. Defaults to '/usr'.
+
+=item C<exec_prefix>
+
+The exec prefix. Defaults to '/usr'.
+
+=item C<bindir>
+
+The executables directory. Defaults to '/usr/bin'.
+
+=item C<libdir>
+
+The library directory. Defaults to '/usr/lib'.
+
+=item C<includedir>
+
+The header directory. Defaults to '/usr/include'.
+
+=back
+
+=head2 MANIFEST Format
+
+The format of the MANIFEST (currently MANIFEST and MANIFEST.generated
+are used) is:
+
+    source_path <whitespace> [package]meta1,meta2,...
+
+or you may optionally specify a different destination path:
+
+    source_path <whitespace> [package]meta1,meta2,... <whitespace> destination
+
+Additionally, there may be a * in front of the whole line to designate
+a generated file:
+
+    source_path <whitespace> *[package]meta1,meta2,... <whitespace> destination
+
+The square brackets around C<package> are literal. C<package> gives
+the name of the RPM that the given file will be installed for, and is
+only used by this script to skip files that are not members of any
+package.
+
+The various meta flags recognized are:
+
+=over 4
+
+=item C<doc>
+
+Tag this file with %doc in the RPM, and omit the leading path (because
+rpm will put it into a directory of its choosing)
+
+=item C<include>
+
+Write this file to the location given by the C<--includedir> option
+
+=item C<lib>
+
+Write this file to the location given by the C<--libdir> option
+
+=item C<bin>
+
+Write this file to the location given by the C<--bindir> option
+
+=back
+
+The optional C<destination> field provides a general way to change
+where a file will be written to. It will be applied before any
+metadata tags.
+
+Example: if this line is in the MANIFEST.generated file
+
+  languages/snorkfest/snork-compile        [main]bin
+
+and the --bindir=/usr/parroty/bin, then the generated
+parrot-<VERSION>-1.<arch>.rpm file will contain the file
+/usr/parroty/bin/snork-compile.
+
+=head1 SEE ALSO
+
+F<tools/dev/mk_manifests.pl>
+
+=cut
+
+################################################################################
+
+use strict;
+use warnings;
+use File::Basename qw(basename);
+use lib qw( lib );
+use Parrot::Install qw(
+    install_files
+    create_directories
+    lines_to_files
+);
+
+# When run from the makefile, which is probably the only time this
+# script will ever be used, all of these defaults will get overridden.
+my %options = (
+    buildprefix => '',
+    prefix      => '/usr',
+    destdir     => '',
+    exec_prefix => '/usr',
+    bindir      => '/usr/bin',
+    libdir      => '/usr/lib',       # parrot/ subdir added below
+    includedir  => '/usr/include',   # parrot/ subdir added below
+    docdir      => '/usr/share/doc', # parrot/ subdir added below
+    perl6libdir => '/usr/lib/perl6',
+    versiondir  => '',
+    'dry-run'   => 0,
+    packages    => 'main|library|pge',
+);
+
+my @manifests;
+foreach (@ARGV) {
+    if (/^--([^=]+)=(.*)/) {
+        $options{$1} = $2;
+    }
+    else {
+        push @manifests, $_;
+    }
+}
+
+my $parrotdir = $options{versiondir};
+
+# Set up transforms on filenames
+my(@transformorder) = qw(runtime lib bin include doc pkgconfig ^compilers);
+my(%metatransforms) = (
+    runtime => {
+        ismeta => 1,
+        optiondir => 'lib',
+        transform => sub {
+            my($filehash) = @_;
+            $filehash->{Dest} =~ s#^src/(pmc|ops)##;
+            $filehash->{DestDirs} = [qw(dynext rakudo)];
+            return($filehash);
+        },
+    },
+    lib => {
+        ismeta => 1,
+        optiondir => 'perl6lib',
+        transform => sub {
+            my($filehash) = @_;
+            local($_) = $filehash->{Dest};
+            s#^src/setting/##;
+            $filehash->{Dest} = $_;
+            $filehash->{DestDirs} = [qw(rakudo)];
+            return($filehash);
+        },
+    },
+    bin => {
+        ismeta => 1,
+        optiondir => 'bin',
+        transform => sub {
+            my($filehash) = @_;
+            # parrot with different config
+            $filehash->{Installable} = $filehash->{Dest} =~ s/^installable_//;
+            return($filehash);
+        },
+        isbin => 1,
+    },
+    include => {
+        ismeta => 1,
+        optiondir => 'include',
+        transform => sub {
+            my($filehash) = @_;
+            $filehash->{Dest} =~ s/^include//;
+            $filehash->{DestDirs} = [$parrotdir];
+            return($filehash);
+        },
+    },
+    doc => {
+        ismeta => 1,
+        optiondir => 'doc',
+        transform => sub {
+            my($filehash) = @_;
+            $filehash->{Dest} =~ s#^docs/resources#resources#; # resources go in the top level of docs
+            $filehash->{Dest} =~ s/^docs/pod/; # other docs are actually raw Pod
+            $filehash->{DestDirs} = [$parrotdir];
+            return($filehash);
+        },
+    },
+    pkgconfig => {
+        ismeta => 1,
+        optiondir => 'lib',
+        transform => sub {
+            my($filehash) = @_;
+            # For the time being this is hardcoded as being installed under
+            # libdir as it is typically done with automake installed packages.
+            # If there is a use case to make this configurable we'll add a
+            # seperate --pkgconfigdir option.
+            $filehash->{DestDirs} = ['pkgconfig', $parrotdir];
+            return($filehash);
+        },
+    },
+    '^compilers' => {
+        optiondir => 'lib',
+        transform => sub {
+            my($filehash) = @_;
+            $filehash->{Dest} =~ s/^compilers/languages/;
+            $filehash->{DestDirs} = [$parrotdir];
+            return($filehash);
+        },
+    },
+);
+
+my($filehashes, $directories) = lines_to_files(
+    \%metatransforms, \@transformorder, \@manifests, \%options, $parrotdir
+);
+
+unless ( $options{'dry-run'} ) {
+    create_directories($options{destdir}, $directories);
+}
+
+# TT #347
+# 1. skip build_dir-only binaries for files marked Installable
+my($filehash, @removes, $removes);
+foreach $filehash (grep { $_->{Installable} } @$filehashes) {
+    my( $src, $dest ) = map { $filehash->{$_} } qw(Source Dest);
+    my ($file) = $src =~ /installable_(.+)$/;
+    next unless $file;
+    if((grep { $_->{Source} =~ /^$file$/ } @$filehashes) and -e $file) {
+        print "skipping $file, using installable_$file instead\n";
+        push @removes, $file;
+    }
+}
+$removes = join '|', @removes;
+@$filehashes = grep { $_->{Source} !~ /^($removes)$/ } @$filehashes;
+
+# 2. for every .exe check if there's an installable. Fail if not
+my $i;
+foreach $filehash (grep { ! $_->{Installable} } @$filehashes ) {
+    my( $src, $dest ) = map { $filehash->{$_} } qw(Source Dest);
+    next unless $src =~ /\.exe$/;
+    # This logic will fail on non-win32 if the generated files are really
+    # generated as with rt #40817. We don't have [main]bin here.
+    $i = "installable_$src";
+    unless (map {$_->{Source} =~ /^$i$/} grep { $_->{Installable} } @$filehashes) {
+        die "$i is missing in MANIFEST or MANIFEST.generated\n";
+    }
+}
+
+install_files($options{destdir}, $options{'dry-run'}, $filehashes);
+
+print "Finished install_files.pl\n";
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

@p6rt
Copy link
Author

p6rt commented Jul 20, 2009

From wayland@wayland.id.au

pmichaud has done some work on getting this all to work with a single
makefile. He's done it in this branch​:

http://github.com/rakudo/rakudo/tree/ins

Last thing I heard, he implied that it works for him, but needs some
testing, especially on win32. I don't have a win32 box, so if someone
with a win32 box could help with this, that would be great!

@p6rt
Copy link
Author

p6rt commented Jul 20, 2009

From wayland@wayland.id.au

Ok, I've gotten a diff of pmichaud's changes on the ins branch, and
attached it to this comment. I have no idea why he got rid of the EXE
variable, though; that's probably guaranteed to make it fail on win32.

@p6rt
Copy link
Author

p6rt commented Jul 20, 2009

From wayland@wayland.id.au

pmichaud_makefile_patch.patch
diff --git a/Configure.pl b/Configure.pl
index 07bbf0d..6987a7e 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -5,11 +5,12 @@ use 5.008;
 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'}) {
@@ -26,7 +27,8 @@ MAIN: {
     # 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";
@@ -35,7 +37,7 @@ MAIN: {
 
     # 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
     );
diff --git a/build/Makefile.in b/build/Makefile.in
index 2ec0b9a..16b23c2 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -1,35 +1,54 @@
 # 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@
+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@ -c
+CC_OUT        = @cc_o_out@
+CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
+LD            = @ld@
+LD_OUT        = @ld_out@
+LDFLAGS       = @ldflags@ @ld_debug@
+LD_LOAD_FLAGS = @ld_load_flags@
+LIBPARROT     = @inst_libparrot_ldflags@
 O             = @o@
-EXE           = @exe@
+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)
+
+# locations of parrot resources
+PARROT           = $(PARROT_BIN_DIR)/parrot
+PBC_TO_EXE       = $(PARROT_BIN_DIR)/pbc_to_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)
+
+# our source directories
+DYNEXT       = dynext
+GROUP        = perl6_group
+OPS          = perl6_ops
+PMC_DIR      = src/pmc
+OPS_DIR      = src/ops
+OPS_SOURCE   = perl6.ops
+
+# files we create
+DYNPMC         = $(DYNEXT)/$(GROUP)$(LOAD_EXT)
+DYNOPS         = $(DYNEXT)/$(OPS)$(LOAD_EXT)
 
 SOURCES = perl6.pir \
   src/gen_grammar.pir \
@@ -47,8 +66,8 @@ SOURCES = perl6.pir \
   src/parrot/misc.pir \
   src/parrot/state.pir \
   src/gen_uprop.pir \
-  $(PERL6_GROUP) \
-  src/ops/perl6_ops$(LOAD_EXT)
+  $(DYNPMC) \
+  $(DYNOPS)
 
 BUILTINS_PIR = \
   src/classes/Object.pir \
@@ -127,13 +146,11 @@ 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
-
-PERL6_GROUP = $(PMC_DIR)/perl6_group$(LOAD_EXT)
+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
 
 CLEANUPS = \
   perl6.pbc \
@@ -144,6 +161,7 @@ CLEANUPS = \
   perl6$(EXE) \
   perl6_s1.pbc \
   Test.pir \
+  dynext/*$(LOAD_EXT) \
   src/gen_*.pir \
   src/gen_*.pm \
   $(PMC_DIR)/*.h \
@@ -157,17 +175,16 @@ 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)
 
@@ -188,13 +205,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
@@ -215,20 +232,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
 
 
@@ -327,20 +332,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/
 
@@ -361,3 +361,43 @@ release: manifest
 	$(PERL) -ne 'print "rakudo-$(VERSION)/$$_"' MANIFEST | \
 	    tar -zcv -T - -f rakudo-$(VERSION).tar.gz
 	rm rakudo-$(VERSION)
+
+$(DYNPMC): $(PMC_SOURCES)
+	$(PMC2C) --dump $(PMC2C_INCLUDES) src/pmc/objectref.pmc
+	$(PMC2C) --dump $(PMC2C_INCLUDES) $(PMC_SOURCES)
+	$(PMC2C) --c $(PMC2C_INCLUDES) $(PMC_SOURCES)
+	$(PMC2C) --library $(GROUP) --c $(PMC_SOURCES)
+	$(CC) $(CC_OUT) $(GROUP)$(O) -I$(PMC_DIR) $(CINCLUDES) $(CFLAGS) $(GROUP).c
+	cd $(PMC_DIR) && $(CC) $(CINCLUDES) $(CFLAGS) *.c
+	$(LD) $(LD_OUT)$(DYNPMC) $(GROUP)$(O) src/pmc/*$(O) $(LINKARGS)
+
+DYNOPS_TARGETS = \
+	$(OPS_DIR)/$(OPS)$(LOAD_EXT) \
+	$(OPS_DIR)/$(OPS)_switch$(LOAD_EXT) \
+	$(OPS_DIR)/$(OPS)_cg$(LOAD_EXT) \
+	$(OPS_DIR)/$(OPS)_cgp$(LOAD_EXT) \
+
+$(DYNOPS): $(DYNOPS_TARGETS)
+	$(CP) $(DYNOPS_TARGETS) dynext
+
+$(OPS_DIR)/$(OPS)$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE)
+	cd $(OPS_DIR) && $(OPS2C) C --dynamic $(OPS_SOURCE)
+	cd $(OPS_DIR) && $(CC) $(CC_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) $(CC_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) $(CC_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) $(CC_OUT) $(OPS)_cgp$(O) $(CINCLUDES) $(CFLAGS) $(OPS)_cgp.c
+	cd $(OPS_DIR) && $(LD) $(LD_OUT)$(OPS)_cgp$(LOAD_EXT) $(OPS)_cgp$(O) $(LINKARGS)
+
+
diff --git a/build/PARROT_REVISION b/build/PARROT_REVISION
index 774fa2b..bd67af6 100644
--- a/build/PARROT_REVISION
+++ b/build/PARROT_REVISION
@@ -1 +1 @@
-39308
+39503
diff --git a/build/gen_objectref_pmc.pl b/build/gen_objectref_pmc.pl
index 7c95a58..6a90e5b 100644
--- a/build/gen_objectref_pmc.pl
+++ b/build/gen_objectref_pmc.pl
@@ -38,7 +38,7 @@ unless (-e $template) {
 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
diff --git a/build/gen_parrot.pl b/build/gen_parrot.pl
index 23b548b..0342265 100644
--- a/build/gen_parrot.pl
+++ b/build/gen_parrot.pl
@@ -32,7 +32,7 @@ close $REQ;
 
 {
     no warnings;
-    if (open my $REV, '-|', "parrot${slash}parrot_config revision") {
+    if (open my $REV, '-|', "parrot${slash}install${slash}bin${slash}parrot_config revision") {
         my $revision = 0+<$REV>;
         close $REV;
         if ($revision >= $required) {
@@ -66,7 +66,7 @@ system @config_command;
 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 = ();
diff --git a/dynext/IGNORE b/dynext/IGNORE
new file mode 100644
index 0000000..999fdbe
--- /dev/null
+++ b/dynext/IGNORE
@@ -0,0 +1 @@
+This space intentionally left blank.

@p6rt
Copy link
Author

p6rt commented Jul 23, 2009

From wayland@wayland.id.au

On Sun Jul 19 21​:22​:54 2009, wayland wrote​:

Ok, I've gotten a diff of pmichaud's changes on the ins branch, and
attached it to this comment. I have no idea why he got rid of the EXE
variable, though; that's probably guaranteed to make it fail on win32.

Pmichaud create a new ins2 branch that was to be an improvement on the
ins branch. I applied these diffs to head, and then made some
modifications of my own. The attached patch is all the mods in ins2 +
the mods needed to make Rakudo work as an RPM.

The patch contains a MANIFEST.generated which pmichaud has specifically
said that he does not like. To eliminate this, it would be necessary
only to rewrite "make install" so that it's different. This would also
eliminate the "install_files.pl" script.

The changes to Makefile.in should probably all be applied regardless,
except the "install" target. The rakudo.spec file should need no
changes; it just calls "make install".

I don't have a clear enough picture of what pmichaud wants in his "make
install" section, which is why I've left it to him.

HTH some.

@p6rt
Copy link
Author

p6rt commented Jul 23, 2009

From wayland@wayland.id.au

rakudo_build_rpm_5.patch
diff --git a/Configure.pl b/Configure.pl
index 5dcace2..1ce7300 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -5,11 +5,12 @@ use 5.008;
 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'}) {
@@ -27,7 +28,8 @@ MAIN: {
     # 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";
@@ -36,7 +38,7 @@ MAIN: {
 
     # 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
     );
diff --git a/MANIFEST.generated b/MANIFEST.generated
new file mode 100644
index 0000000..3d5e4cd
--- /dev/null
+++ b/MANIFEST.generated
@@ -0,0 +1,27 @@
+# Copied in a monkey-see-monkey-do fashion from Parrot.  I (Tim Nelson)
+# don't have a real grip on what's going on here; I just want it to work :)
+perl6                                                   [main]bin
+dynext/perl6_group.so                                   [main]runtime
+dynext/perl6_ops.so                                     [main]runtime
+dynext/perl6_ops_cg.so                                  [main]runtime
+dynext/perl6_ops_cgp.so                                 [main]runtime
+dynext/perl6_ops_switch.so                              [main]runtime
+Test.pm							[library]lib
+#src/utils/perl6doc/actions.pm				[library]lib
+#src/parser/actions.pm					[library]lib
+src/setting/IO.pm					[library]lib
+src/setting/Any-list.pm					[library]lib
+src/setting/Hash.pm					[library]lib
+src/setting/Array.pm					[library]lib
+src/setting/IO/Socket.pm				[library]lib
+src/setting/IO/Socket/INET.pm				[library]lib
+src/setting/Range.pm					[library]lib
+src/setting/Num.pm					[library]lib
+src/setting/List.pm					[library]lib
+src/setting/Match.pm					[library]lib
+src/setting/Bool.pm					[library]lib
+src/setting/Object.pm					[library]lib
+src/setting/Pair.pm					[library]lib
+src/setting/Any-num.pm					[library]lib
+src/setting/Any-str.pm					[library]lib
+src/setting/Whatever.pm					[library]lib
diff --git a/build/Makefile.in b/build/Makefile.in
index 523ce42..dd433d1 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -1,35 +1,62 @@
 # Copyright (C) 2006-2009, The Perl Foundation.
 # $Id$
 
-# arguments we want to run parrot with
-PARROT_ARGS =
+PARROT_ARGS      =
+
+# Overridden from outside
+DESTDIR         :=
 
 # values from parrot_config
-BUILD_DIR     = @build_dir@
-LOAD_EXT      = @load_ext@
+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@ -c
+CC_OUT        = @cc_o_out@
+CFLAGS        = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@
+LD            = @ld@
+LD_OUT        = @ld_out@
+LDFLAGS       = @ldflags@ @ld_debug@
+LD_LOAD_FLAGS = @ld_load_flags@
+LIBPARROT     = @inst_libparrot_ldflags@
 O             = @o@
 EXE           = @exe@
+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)
+# 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)
+
+# our source directories
+DYNEXT       = dynext
+GROUP        = perl6_group
+OPS          = perl6_ops
+PMC_DIR      = src/pmc
+OPS_DIR      = src/ops
+OPS_SOURCE   = perl6.ops
+
+# ???
+PERL6_LIB_DIR      = @libdir@/perl6
+
+# files we create
+DYNPMC         = $(DYNEXT)/$(GROUP)$(LOAD_EXT)
+DYNOPS         = $(DYNEXT)/$(OPS)$(LOAD_EXT)
 
 SOURCES = perl6.pir \
   src/gen_grammar.pir \
@@ -47,8 +74,8 @@ SOURCES = perl6.pir \
   src/parrot/misc.pir \
   src/parrot/state.pir \
   src/gen_uprop.pir \
-  $(PERL6_GROUP) \
-  src/ops/perl6_ops$(LOAD_EXT)
+  $(DYNPMC) \
+  $(DYNOPS)
 
 BUILTINS_PIR = \
   src/classes/Object.pir \
@@ -133,13 +160,11 @@ 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
-
-PERL6_GROUP = $(PMC_DIR)/perl6_group$(LOAD_EXT)
+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
 
 CLEANUPS = \
   perl6.pbc \
@@ -150,6 +175,7 @@ CLEANUPS = \
   perl6$(EXE) \
   perl6_s1.pbc \
   Test.pir \
+  dynext/*$(LOAD_EXT) \
   src/gen_*.pir \
   src/gen_*.pm \
   $(PMC_DIR)/*.h \
@@ -163,17 +189,16 @@ 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 = $(PERL) -I$(PARROT_PERL_LIB) t/harness --fudge --keep-exit-code --icu=$(HAS_ICU)
 HARNESS_WITH_FUDGE_JOBS = $(HARNESS_WITH_FUDGE) --jobs
 
-
 # the default target
 all: perl6$(EXE)
 
@@ -194,13 +219,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
@@ -221,20 +246,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
 
 
@@ -247,7 +260,7 @@ test    : coretest
 fulltest: coretest spectest
 
 coretest: perl6$(EXE)
-	$(PERL) t/harness t/00-parrot t/01-sanity
+	$(PERL) -I$(PARROT_PERL_LIB) t/harness --bindir=$(PARROT_BIN_DIR) t/00-parrot t/01-sanity
 
 # Run the spectests that we know work.
 spectest_regression: spectest
@@ -333,20 +346,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/
 
@@ -362,8 +370,66 @@ 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)
+
+install:
+	$(PERL) -I$(PARROT_PERL_LIB) tools/build/install_files.pl \
+    --buildprefix=$(BUILDPREFIX) \
+    --prefix=$(PREFIX) \
+    --exec-prefix=$(EXEC_PREFIX) \
+    --bindir=$(PARROT_BIN_DIR) \
+    --libdir=$(PARROT_LIB_DIR) \
+    --includedir=$(PARROT_INCLUDE_DIR) \
+    --destdir=$(DESTDIR) \
+    --docdir=$(DOC_DIR) \
+    --datadir=$(DATA_DIR) \
+    --srcdir=@srcdir@ \
+    --versiondir=$(PARROT_VERSION) \
+    --perl6libdir=$(PERL6_LIB_DIR) \
+    MANIFEST.generated
+
+#
+
+$(DYNPMC): $(PMC_SOURCES)
+	$(PMC2C) --dump $(PMC2C_INCLUDES) src/pmc/objectref.pmc
+	$(PMC2C) --dump $(PMC2C_INCLUDES) $(PMC_SOURCES)
+	$(PMC2C) --c $(PMC2C_INCLUDES) $(PMC_SOURCES)
+	$(PMC2C) --library $(GROUP) --c $(PMC_SOURCES)
+	$(CC) $(CC_OUT) $(GROUP)$(O) -I$(PMC_DIR) $(CINCLUDES) $(CFLAGS) $(GROUP).c
+	cd $(PMC_DIR) && $(CC) $(CINCLUDES) $(CFLAGS) *.c
+	$(LD) $(LD_OUT)$(DYNPMC) $(GROUP)$(O) src/pmc/*$(O) $(LINKARGS)
+
+DYNOPS_TARGETS = \
+	$(OPS_DIR)/$(OPS)$(LOAD_EXT) \
+	$(OPS_DIR)/$(OPS)_switch$(LOAD_EXT) \
+	$(OPS_DIR)/$(OPS)_cg$(LOAD_EXT) \
+	$(OPS_DIR)/$(OPS)_cgp$(LOAD_EXT) \
+
+$(DYNOPS): $(DYNOPS_TARGETS)
+	$(CP) $(DYNOPS_TARGETS) dynext
+
+$(OPS_DIR)/$(OPS)$(LOAD_EXT): $(OPS_DIR)/$(OPS_SOURCE)
+	cd $(OPS_DIR) && $(OPS2C) C --dynamic $(OPS_SOURCE)
+	cd $(OPS_DIR) && $(CC) $(CC_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) $(CC_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) $(CC_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) $(CC_OUT) $(OPS)_cgp$(O) $(CINCLUDES) $(CFLAGS) $(OPS)_cgp.c
+	cd $(OPS_DIR) && $(LD) $(LD_OUT)$(OPS)_cgp$(LOAD_EXT) $(OPS)_cgp$(O) $(LINKARGS)
+
+
diff --git a/build/gen_objectref_pmc.pl b/build/gen_objectref_pmc.pl
index 7c95a58..6a90e5b 100644
--- a/build/gen_objectref_pmc.pl
+++ b/build/gen_objectref_pmc.pl
@@ -38,7 +38,7 @@ unless (-e $template) {
 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
diff --git a/build/gen_parrot.pl b/build/gen_parrot.pl
index 40b3dee..9912481 100644
--- a/build/gen_parrot.pl
+++ b/build/gen_parrot.pl
@@ -33,7 +33,7 @@ close $REQ;
 
 {
     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) {
@@ -67,7 +67,7 @@ system @config_command;
 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 = ();
diff --git a/build/rakudo.spec b/build/rakudo.spec
new file mode 100644
index 0000000..b934801
--- /dev/null
+++ b/build/rakudo.spec
@@ -0,0 +1,108 @@
+%define parrot_version 1.4.0
+
+Name:           rakudo
+Version:        build20
+Release:        1
+Summary:        Rakudo Perl 6
+License:        Artistic 2.0
+Group:          Development/Libraries
+URL:            http://www.rakudo.org/
+Source0:        http://www.pmichaud.com/perl6/rakudo-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires:  parrot           >= %parrot_version
+BuildRequires:  parrot-devel     >= %parrot_version
+
+%define parrot_versiondir %{parrot_version}-devel
+
+%define parrot_dynext %{_libdir}/parrot/%{parrot_versiondir}/dynext
+
+%define rakudo_libs %{_libdir}/perl6/rakudo
+
+# Versions don't go easily in install_files.pl yet
+#%define relative_rakudo_dynext %{name}/%{version}
+%define relative_rakudo_dynext %{name}/dynext
+%define rakudo_dynext %{parrot_dynext}/%{relative_rakudo_dynext}
+
+%description
+Rakudo Perl 6 is an implementation of the Perl 6 specification which
+runs on the Parrot virtual machine.  Perl 6 is a programming language
+which supersedes earlier versions of Perl.  
+
+%prep
+%setup -q
+
+%build
+echo Building with root $RPM_BUILD_ROOT
+%{__perl} Configure.pl
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make install DESTDIR=$RPM_BUILD_ROOT
+echo first find
+find $RPM_BUILD_ROOT
+
+pushd $RPM_BUILD_ROOT/%{parrot_dynext}
+for i in %{relative_rakudo_dynext}/*.so; do 
+	ln -s $i
+done
+popd
+
+echo second find
+find $RPM_BUILD_ROOT
+
+%check
+# make test < /dev/null
+# %{?_with_fulltest:make fulltest < /dev/null}
+# make test || :
+# %{?_with_fulltest:make fulltest || :}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%doc CREDITS README
+%doc docs
+%{parrot_dynext}/perl6_group.so
+%{parrot_dynext}/perl6_ops.so
+%{parrot_dynext}/perl6_ops_cg.so
+%{parrot_dynext}/perl6_ops_cgp.so
+%{parrot_dynext}/perl6_ops_switch.so
+%{rakudo_dynext}/perl6_group.so
+%{rakudo_dynext}/perl6_ops.so
+%{rakudo_dynext}/perl6_ops_cg.so
+%{rakudo_dynext}/perl6_ops_cgp.so
+%{rakudo_dynext}/perl6_ops_switch.so
+%{_bindir}/perl6
+%{rakudo_libs}/Test.pm
+%{rakudo_libs}/IO.pm
+%{rakudo_libs}/Any-list.pm
+%{rakudo_libs}/Hash.pm
+%{rakudo_libs}/Array.pm
+%{rakudo_libs}/IO/Socket.pm
+%{rakudo_libs}/IO/Socket/INET.pm
+%{rakudo_libs}/Range.pm
+%{rakudo_libs}/Num.pm
+%{rakudo_libs}/List.pm
+%{rakudo_libs}/Match.pm
+%{rakudo_libs}/Bool.pm
+%{rakudo_libs}/Object.pm
+%{rakudo_libs}/Pair.pm
+%{rakudo_libs}/Any-num.pm
+%{rakudo_libs}/Any-str.pm
+%{rakudo_libs}/Whatever.pm
+
+%changelog
+* Wed Jul 22 2009 wayland <wayland@wayland.id.au> 0.20
+- Updated to latest version
+
+* Fri Mar  6 2009 wayland <wayland@wayland.id.au> 0.17
+- created from parrot.spec
+- Didn't redo any of the files stuff
+- Played with things 'til it worked
diff --git a/tools/build/install_files.pl b/tools/build/install_files.pl
new file mode 100644
index 0000000..8f4d1e7
--- /dev/null
+++ b/tools/build/install_files.pl
@@ -0,0 +1,284 @@
+#! perl
+
+# Note this is a direct copy of the parrot file tools/dev/install_files.pl
+# with just a few changes.  As that file in the Parrot distribution continues
+# to evolve into something shorter, hopefully this file will also be replaced
+# with something much shorter.  
+
+################################################################################
+# Copyright (C) 2001-2009, Parrot Foundation.
+# $Id: install_files.pl 39165 2009-05-25 01:15:28Z jkeenan $
+################################################################################
+
+=head1 TITLE
+
+tools/dev/install_files.pl - Copy files to their correct locations
+
+=head1 SYNOPSIS
+
+    % perl tools/dev/install_files.pl [options]
+
+=head1 DESCRIPTION
+
+Use a detailed MANIFEST to install a set of files.
+
+=head2 Options
+
+=over 4
+
+=item C<buildprefix>
+
+The build prefix. Defaults to ''.
+
+=item C<prefix>
+
+The install prefix. Defaults to '/usr'.
+
+=item C<exec_prefix>
+
+The exec prefix. Defaults to '/usr'.
+
+=item C<bindir>
+
+The executables directory. Defaults to '/usr/bin'.
+
+=item C<libdir>
+
+The library directory. Defaults to '/usr/lib'.
+
+=item C<includedir>
+
+The header directory. Defaults to '/usr/include'.
+
+=back
+
+=head2 MANIFEST Format
+
+The format of the MANIFEST (currently MANIFEST and MANIFEST.generated
+are used) is:
+
+    source_path <whitespace> [package]meta1,meta2,...
+
+or you may optionally specify a different destination path:
+
+    source_path <whitespace> [package]meta1,meta2,... <whitespace> destination
+
+Additionally, there may be a * in front of the whole line to designate
+a generated file:
+
+    source_path <whitespace> *[package]meta1,meta2,... <whitespace> destination
+
+The square brackets around C<package> are literal. C<package> gives
+the name of the RPM that the given file will be installed for, and is
+only used by this script to skip files that are not members of any
+package.
+
+The various meta flags recognized are:
+
+=over 4
+
+=item C<doc>
+
+Tag this file with %doc in the RPM, and omit the leading path (because
+rpm will put it into a directory of its choosing)
+
+=item C<include>
+
+Write this file to the location given by the C<--includedir> option
+
+=item C<lib>
+
+Write this file to the location given by the C<--libdir> option
+
+=item C<bin>
+
+Write this file to the location given by the C<--bindir> option
+
+=back
+
+The optional C<destination> field provides a general way to change
+where a file will be written to. It will be applied before any
+metadata tags.
+
+Example: if this line is in the MANIFEST.generated file
+
+  languages/snorkfest/snork-compile        [main]bin
+
+and the --bindir=/usr/parroty/bin, then the generated
+parrot-<VERSION>-1.<arch>.rpm file will contain the file
+/usr/parroty/bin/snork-compile.
+
+=head1 SEE ALSO
+
+F<tools/dev/mk_manifests.pl>
+
+=cut
+
+################################################################################
+
+use strict;
+use warnings;
+use File::Basename qw(basename);
+use lib qw( lib );
+use Parrot::Install qw(
+    install_files
+    create_directories
+    lines_to_files
+);
+
+# When run from the makefile, which is probably the only time this
+# script will ever be used, all of these defaults will get overridden.
+my %options = (
+    buildprefix => '',
+    prefix      => '/usr',
+    destdir     => '',
+    exec_prefix => '/usr',
+    bindir      => '/usr/bin',
+    libdir      => '/usr/lib',       # parrot/ subdir added below
+    includedir  => '/usr/include',   # parrot/ subdir added below
+    docdir      => '/usr/share/doc', # parrot/ subdir added below
+    perl6libdir => '/usr/lib/perl6',
+    versiondir  => '',
+    'dry-run'   => 0,
+    packages    => 'main|library|pge',
+);
+
+my @manifests;
+foreach (@ARGV) {
+    if (/^--([^=]+)=(.*)/) {
+        $options{$1} = $2;
+    }
+    else {
+        push @manifests, $_;
+    }
+}
+
+my $parrotdir = $options{versiondir};
+
+# Set up transforms on filenames
+my(@transformorder) = qw(runtime lib bin include doc pkgconfig ^compilers);
+my(%metatransforms) = (
+    runtime => {
+        ismeta => 1,
+        optiondir => 'lib',
+        transform => sub {
+            my($filehash) = @_;
+            $filehash->{Dest} =~ s#^src/(pmc|ops)##;
+            $filehash->{DestDirs} = [qw(dynext rakudo)];
+            return($filehash);
+        },
+    },
+    lib => {
+        ismeta => 1,
+        optiondir => 'perl6lib',
+        transform => sub {
+            my($filehash) = @_;
+            local($_) = $filehash->{Dest};
+            s#^src/setting/##;
+            $filehash->{Dest} = $_;
+            $filehash->{DestDirs} = [qw(rakudo)];
+            return($filehash);
+        },
+    },
+    bin => {
+        ismeta => 1,
+        optiondir => 'bin',
+        transform => sub {
+            my($filehash) = @_;
+            # parrot with different config
+            $filehash->{Installable} = $filehash->{Dest} =~ s/^installable_//;
+            return($filehash);
+        },
+        isbin => 1,
+    },
+    include => {
+        ismeta => 1,
+        optiondir => 'include',
+        transform => sub {
+            my($filehash) = @_;
+            $filehash->{Dest} =~ s/^include//;
+            $filehash->{DestDirs} = [$parrotdir];
+            return($filehash);
+        },
+    },
+    doc => {
+        ismeta => 1,
+        optiondir => 'doc',
+        transform => sub {
+            my($filehash) = @_;
+            $filehash->{Dest} =~ s#^docs/resources#resources#; # resources go in the top level of docs
+            $filehash->{Dest} =~ s/^docs/pod/; # other docs are actually raw Pod
+            $filehash->{DestDirs} = [$parrotdir];
+            return($filehash);
+        },
+    },
+    pkgconfig => {
+        ismeta => 1,
+        optiondir => 'lib',
+        transform => sub {
+            my($filehash) = @_;
+            # For the time being this is hardcoded as being installed under
+            # libdir as it is typically done with automake installed packages.
+            # If there is a use case to make this configurable we'll add a
+            # seperate --pkgconfigdir option.
+            $filehash->{DestDirs} = ['pkgconfig', $parrotdir];
+            return($filehash);
+        },
+    },
+    '^compilers' => {
+        optiondir => 'lib',
+        transform => sub {
+            my($filehash) = @_;
+            $filehash->{Dest} =~ s/^compilers/languages/;
+            $filehash->{DestDirs} = [$parrotdir];
+            return($filehash);
+        },
+    },
+);
+
+my($filehashes, $directories) = lines_to_files(
+    \%metatransforms, \@transformorder, \@manifests, \%options, $parrotdir
+);
+
+unless ( $options{'dry-run'} ) {
+    create_directories($options{destdir}, $directories);
+}
+
+# TT #347
+# 1. skip build_dir-only binaries for files marked Installable
+my($filehash, @removes, $removes);
+foreach $filehash (grep { $_->{Installable} } @$filehashes) {
+    my( $src, $dest ) = map { $filehash->{$_} } qw(Source Dest);
+    my ($file) = $src =~ /installable_(.+)$/;
+    next unless $file;
+    if((grep { $_->{Source} =~ /^$file$/ } @$filehashes) and -e $file) {
+        print "skipping $file, using installable_$file instead\n";
+        push @removes, $file;
+    }
+}
+$removes = join '|', @removes;
+@$filehashes = grep { $_->{Source} !~ /^($removes)$/ } @$filehashes;
+
+# 2. for every .exe check if there's an installable. Fail if not
+my $i;
+foreach $filehash (grep { ! $_->{Installable} } @$filehashes ) {
+    my( $src, $dest ) = map { $filehash->{$_} } qw(Source Dest);
+    next unless $src =~ /\.exe$/;
+    # This logic will fail on non-win32 if the generated files are really
+    # generated as with rt #40817. We don't have [main]bin here.
+    $i = "installable_$src";
+    unless (map {$_->{Source} =~ /^$i$/} grep { $_->{Installable} } @$filehashes) {
+        die "$i is missing in MANIFEST or MANIFEST.generated\n";
+    }
+}
+
+install_files($options{destdir}, $options{'dry-run'}, $filehashes);
+
+print "Finished install_files.pl\n";
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

@p6rt
Copy link
Author

p6rt commented Jul 27, 2009

From wayland@wayland.id.au

Ok, here's a new patch against the updated ins2 branch. pmichaud has
done some "make install" stuff, and I've added to it as required for
building RPMs. Other than adding a few useful files to the installation
image (ie. the setting *.pm files could come in handy), it should have
no effect on non-RPM installs.

@p6rt
Copy link
Author

p6rt commented Jul 27, 2009

From wayland@wayland.id.au

rakudo_build_rpm_6.patch
diff --git a/build/Makefile.in b/build/Makefile.in
index 9ee3f7b..68c03b4 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -1,6 +1,8 @@
 # Copyright (C) 2006-2009, The Perl Foundation.
 # $Id$
 
+DESTDIR         :=
+
 PARROT_ARGS      =
 
 # values from parrot_config
@@ -204,13 +206,20 @@ all: $(PERL6EXE)
 
 # the install target
 install: all
-	$(MKPATH)                     $(PERL6_LANG_DIR)/lib
-	$(CP)     perl6.pbc           $(PERL6_LANG_DIR)
-	$(CP)     Test.pm             $(PERL6_LANG_DIR)/lib
-	$(CP)     lib/*.pm            $(PERL6_LANG_DIR)/lib
-	$(CP)     $(DYNPMC) $(DYNOPS) $(PARROT_LIB_DIR)/dynext
-	$(CP)     $(PERL6EXE)         $(PARROT_BIN_DIR)
-	$(CHMOD) 755 $(PARROT_BIN_DIR)/$(PERL6EXE)
+	$(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
+	$(CP)     src/setting/*.pm    $(DESTDIR)/$(PERL6_LANG_DIR)/lib
+	$(MKPATH)                     $(DESTDIR)/$(PERL6_LANG_DIR)/lib/IO
+	$(CP)     src/setting/IO/*.pm $(DESTDIR)/$(PERL6_LANG_DIR)/lib/IO
+	$(MKPATH)                     $(DESTDIR)/$(PERL6_LANG_DIR)/lib/IO/Socket
+	$(CP)     src/setting/IO/Socket/*.pm $(DESTDIR)/$(PERL6_LANG_DIR)/lib/IO/Socket
+	$(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)
 
diff --git a/build/rakudo.spec b/build/rakudo.spec
new file mode 100644
index 0000000..fb06656
--- /dev/null
+++ b/build/rakudo.spec
@@ -0,0 +1,119 @@
+%define parrot_version 1.4.0
+
+Name:           rakudo
+Version:        build20
+Release:        1
+Summary:        Rakudo Perl 6
+License:        Artistic 2.0
+Group:          Development/Libraries
+URL:            http://www.rakudo.org/
+Source0:        http://www.pmichaud.com/perl6/rakudo-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires:  parrot           >= %parrot_version
+BuildRequires:  parrot-devel     >= %parrot_version
+
+%define parrot_versiondirname %{parrot_version}-devel
+%define parrot_versiondirpath  %{_libdir}/parrot/%{parrot_versiondirname}
+
+%define parrot_dynext %{parrot_versiondirpath}/dynext
+
+#%define rakudo_libs %{_libdir}/perl6/rakudo
+%define rakudo_libs %{parrot_versiondirpath}/languages/perl6/lib
+
+# Versions don't go easily in install_files.pl yet
+#%define relative_rakudo_dynext %{name}/%{version}
+%define relative_rakudo_dynext %{name}/dynext
+%define rakudo_dynext %{parrot_dynext}/%{relative_rakudo_dynext}
+
+%description
+Rakudo Perl 6 is an implementation of the Perl 6 specification which
+runs on the Parrot virtual machine.  Perl 6 is a programming language
+which supersedes earlier versions of Perl.  
+
+%prep
+%setup -q
+
+%build
+echo Building with root $RPM_BUILD_ROOT
+%{__perl} Configure.pl
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make install DESTDIR=$RPM_BUILD_ROOT
+#echo first find
+#find $RPM_BUILD_ROOT
+
+#pushd $RPM_BUILD_ROOT/%{parrot_dynext}
+#for i in %{relative_rakudo_dynext}/*.so; do 
+#	ln -s $i
+#done
+#popd
+
+#echo second find
+#find $RPM_BUILD_ROOT
+
+%check
+# make test < /dev/null
+# %{?_with_fulltest:make fulltest < /dev/null}
+# make test || :
+# %{?_with_fulltest:make fulltest || :}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%doc CREDITS README
+%doc docs
+%{parrot_dynext}/perl6_group.so
+%{parrot_dynext}/perl6_ops.so
+%{parrot_dynext}/perl6_ops_cg.so
+%{parrot_dynext}/perl6_ops_cgp.so
+%{parrot_dynext}/perl6_ops_switch.so
+#%{rakudo_dynext}/perl6_group.so
+#%{rakudo_dynext}/perl6_ops.so
+#%{rakudo_dynext}/perl6_ops_cg.so
+#%{rakudo_dynext}/perl6_ops_cgp.so
+#%{rakudo_dynext}/perl6_ops_switch.so
+%{_bindir}/perl6
+%{parrot_versiondirpath}/languages/perl6/perl6.pbc
+%{rakudo_libs}/Test.pm
+%{rakudo_libs}/Any-list.pm
+%{rakudo_libs}/Any-num.pm
+%{rakudo_libs}/Any-str.pm
+%{rakudo_libs}/Array.pm
+%{rakudo_libs}/Bool.pm
+%{rakudo_libs}/Buf.pm
+%{rakudo_libs}/Hash.pm
+%{rakudo_libs}/Int.pm
+%{rakudo_libs}/IO.pm
+%{rakudo_libs}/IO/Socket.pm
+%{rakudo_libs}/IO/Socket/INET.pm
+%{rakudo_libs}/Junction.pm
+%{rakudo_libs}/List.pm
+%{rakudo_libs}/Match.pm
+%{rakudo_libs}/Num.pm
+%{rakudo_libs}/Object.pm
+%{rakudo_libs}/Operators.pm
+%{rakudo_libs}/Pair.pm
+%{rakudo_libs}/Range.pm
+%{rakudo_libs}/Safe.pm
+%{rakudo_libs}/Str.pm
+%{rakudo_libs}/Temporal.pm
+%{rakudo_libs}/traits.pm
+%{rakudo_libs}/Whatever.pm
+
+%changelog
+* Wed Jul 22 2009 wayland <wayland@wayland.id.au> 0.20
+- Updated to latest version
+
+* Fri Mar  6 2009 wayland <wayland@wayland.id.au> 0.17
+- created from parrot.spec
+- Didn't redo any of the files stuff
+- Played with things 'til it worked

@p6rt
Copy link
Author

p6rt commented Jul 29, 2009

From wayland@wayland.id.au

Attached patch is updated according to pmichauds comments on IRC recently.

@p6rt
Copy link
Author

p6rt commented Jul 29, 2009

From wayland@wayland.id.au

rakudo_build_rpm_7.patch
diff --git a/build/Makefile.in b/build/Makefile.in
index 9ee3f7b..97452a0 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -1,6 +1,8 @@
 # Copyright (C) 2006-2009, The Perl Foundation.
 # $Id$
 
+DESTDIR          =
+
 PARROT_ARGS      =
 
 # values from parrot_config
@@ -204,13 +206,15 @@ all: $(PERL6EXE)
 
 # the install target
 install: all
-	$(MKPATH)                     $(PERL6_LANG_DIR)/lib
-	$(CP)     perl6.pbc           $(PERL6_LANG_DIR)
-	$(CP)     Test.pm             $(PERL6_LANG_DIR)/lib
-	$(CP)     lib/*.pm            $(PERL6_LANG_DIR)/lib
-	$(CP)     $(DYNPMC) $(DYNOPS) $(PARROT_LIB_DIR)/dynext
-	$(CP)     $(PERL6EXE)         $(PARROT_BIN_DIR)
-	$(CHMOD) 755 $(PARROT_BIN_DIR)/$(PERL6EXE)
+	$(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)
 
diff --git a/build/rakudo.spec b/build/rakudo.spec
new file mode 100644
index 0000000..39239e5
--- /dev/null
+++ b/build/rakudo.spec
@@ -0,0 +1,96 @@
+%define parrot_version 1.4.0
+
+Name:           rakudo
+Version:        build20
+Release:        1
+Summary:        Rakudo Perl 6
+License:        Artistic 2.0
+Group:          Development/Libraries
+URL:            http://www.rakudo.org/
+Source0:        http://www.pmichaud.com/perl6/rakudo-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires:  parrot           >= %parrot_version
+BuildRequires:  parrot-devel     >= %parrot_version
+
+%define parrot_versiondirname %{parrot_version}-devel
+%define parrot_versiondirpath  %{_libdir}/parrot/%{parrot_versiondirname}
+
+%define parrot_dynext %{parrot_versiondirpath}/dynext
+
+#%define rakudo_libs %{_libdir}/perl6/rakudo
+%define rakudo_libs %{parrot_versiondirpath}/languages/perl6/lib
+
+# Versions don't go easily in install_files.pl yet
+#%define relative_rakudo_dynext %{name}/%{version}
+%define relative_rakudo_dynext %{name}/dynext
+%define rakudo_dynext %{parrot_dynext}/%{relative_rakudo_dynext}
+
+%description
+Rakudo Perl 6 is an implementation of the Perl 6 specification which
+runs on the Parrot virtual machine.  Perl 6 is a programming language
+which supersedes earlier versions of Perl.  
+
+%prep
+%setup -q
+
+%build
+echo Building with root $RPM_BUILD_ROOT
+%{__perl} Configure.pl
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make install DESTDIR=$RPM_BUILD_ROOT
+#echo first find
+#find $RPM_BUILD_ROOT
+
+#pushd $RPM_BUILD_ROOT/%{parrot_dynext}
+#for i in %{relative_rakudo_dynext}/*.so; do 
+#	ln -s $i
+#done
+#popd
+
+#echo second find
+#find $RPM_BUILD_ROOT
+
+%check
+# make test < /dev/null
+# %{?_with_fulltest:make fulltest < /dev/null}
+# make test || :
+# %{?_with_fulltest:make fulltest || :}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%doc CREDITS README
+%doc docs
+%{parrot_dynext}/perl6_group.so
+%{parrot_dynext}/perl6_ops.so
+%{parrot_dynext}/perl6_ops_cg.so
+%{parrot_dynext}/perl6_ops_cgp.so
+%{parrot_dynext}/perl6_ops_switch.so
+#%{rakudo_dynext}/perl6_group.so
+#%{rakudo_dynext}/perl6_ops.so
+#%{rakudo_dynext}/perl6_ops_cg.so
+#%{rakudo_dynext}/perl6_ops_cgp.so
+#%{rakudo_dynext}/perl6_ops_switch.so
+%{_bindir}/perl6
+%{parrot_versiondirpath}/languages/perl6/perl6.pbc
+%{rakudo_libs}/Test.pm
+%{rakudo_libs}/Safe.pm
+
+%changelog
+* Wed Jul 22 2009 wayland <wayland@wayland.id.au> 0.20
+- Updated to latest version
+
+* Fri Mar  6 2009 wayland <wayland@wayland.id.au> 0.17
+- created from parrot.spec
+- Didn't redo any of the files stuff
+- Played with things 'til it worked

@p6rt
Copy link
Author

p6rt commented Jul 29, 2009

From @pmichaud

On Tue Jul 28 19​:03​:45 2009, wayland wrote​:

Attached patch is updated according to pmichauds comments on IRC
recently.

Patch applied to ins2 branch in ce21ff.

As soon as we get the Sun compiler issues resolved (RT #​66560) I think
we may be able to merge to trunk and close this ticket.

Pm

@p6rt
Copy link
Author

p6rt commented Mar 30, 2010

From @moritz

rakudo has been building with an installed parrot long since. Thanks for
the patches, closing ticket...

@p6rt
Copy link
Author

p6rt commented Mar 30, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Mar 30, 2010
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant