aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpmichaud <pmichaud@pobox.com>2010-07-27 15:18:55 -0500
committerpmichaud <pmichaud@pobox.com>2010-07-27 15:18:55 -0500
commit5cfe6b289455ffb2d0a17f1cab70f96083df0447 (patch)
tree1743695f22edc74fd604f2d3be541f4e02182c04
parentd7fd03c91f1e622c8585b4637ae3f5f091e0bb86 (diff)
Update build process slightly.
-rw-r--r--Makefile47
-rw-r--r--README9
-rw-r--r--build/Configure.pl231
-rw-r--r--build/Makefile.in108
4 files changed, 390 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b02796e..6dfc640 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,45 @@
-dist:
- perl build/download-stuff.pl
+PARROT_VER = 2.6.0
+RAKUDO_TAG = master
+
+DISTDIR = dist
+
+PARROT = parrot-$(PARROT_VER)
+PARROT_TGZ = $(PARROT).tar.gz
+PARROT_DIR = $(DISTDIR)/$(PARROT)
+
+RAKUDO_DIR = $(DISTDIR)/rakudo
+BUILD_DIR = $(DISTDIR)/build
+
+BUILD_FILES = \
+ build/gen_parrot.pl \
+ build/Makefile.in \
+
+DISTTARGETS = \
+ $(PARROT_DIR) \
+ $(RAKUDO_DIR) \
+ $(BUILD_DIR) \
+ $(BUILD_DIR)/PARROT_REVISION \
+ $(DISTDIR)/Configure.pl \
+
+$(DISTDIR): $(DISTTARGETS)
+
+$(PARROT_DIR): $(PARROT_TGZ)
+ mkdir -p $(DISTDIR)
+ tar -C $(DISTDIR) -xvzf $(PARROT_TGZ)
+$(PARROT).tar.gz:
+ wget http://ftp.parrot.org/releases/supported/$(PARROT_VER)/$(PARROT_TGZ)
+
+$(RAKUDO_DIR):
+ git clone git@github.com:rakudo/rakudo.git $(RAKUDO_DIR)
+ cd $(RAKUDO_DIR); git checkout $(RAKUDO_VER)
+
+$(DISTDIR)/Configure.pl: build/Configure.pl
+ cp build/Configure.pl $(DISTDIR)
+
+$(BUILD_DIR): $(BUILD_FILES)
+ mkdir -p $(BUILD_DIR)
+ cp $(BUILD_FILES) $(BUILD_DIR)
+
+$(BUILD_DIR)/PARROT_REVISION: $(RAKUDO_DIR) $(RAKUDO_DIR)/build/PARROT_REVISION
+ cp $(RAKUDO_DIR)/build/PARROT_REVISION $(BUILD_DIR)
+
diff --git a/README b/README
index dd49d64..db915a8 100644
--- a/README
+++ b/README
@@ -3,9 +3,12 @@ Rakudo Star -- a Perl 6 distribution based on Rakudo Perl
See <http://wiki.github.com/rakudo/rakudo/whats-going-into-rakudo> for a list
of modules we want included in the distribution.
+This repository doesn't contain a distribution, it contains the tools
+and scripts to build a distribution. Run "make" to populate a distribution
+image in the dist/ directory. Currently this assumes that you have
+the following tools available:
-The distribution is built in the dist/ directory. Run
+ * git
+ * wget
- perl build/download-stuff.pl
-to populate it.
diff --git a/build/Configure.pl b/build/Configure.pl
new file mode 100644
index 0000000..a0e687e
--- /dev/null
+++ b/build/Configure.pl
@@ -0,0 +1,231 @@
+#! perl
+# Copyright (C) 2009 The Perl Foundation
+
+use 5.008;
+use strict;
+use warnings;
+use Getopt::Long;
+use Cwd;
+
+MAIN: {
+ my %options;
+ GetOptions(\%options, 'help!', 'parrot-config=s', 'makefile-timing!',
+ 'gen-parrot!', 'prefix=s', 'gen-parrot-option=s@');
+
+ # Print help if it's requested
+ if ($options{'help'}) {
+ print_help();
+ exit(0);
+ }
+
+ # Determine the revision of Parrot we require
+ open my $REQ, '<', "build/PARROT_REVISION"
+ or die "cannot open build/PARROT_REVISION: $!\n";
+ my ($reqsvn, $reqpar) = split(' ', <$REQ>);
+ $reqsvn += 0;
+ close $REQ;
+
+ # Update/generate parrot build if needed
+ if ($options{'gen-parrot'}) {
+ my @opts = @{ $options{'gen-parrot-option'} || [] };
+ my $prefix = $options{'prefix'} || cwd()."/install";
+ # parrot's Configure.pl mishandles win32 backslashes in --prefix
+ $prefix =~ s{\\}{/}g;
+ my @command = ($^X, "build/gen_parrot.pl", "--prefix=$prefix", ($^O !~ /win32/i ? "--optimize" : ()), @opts);
+
+ print "Generating Parrot ...\n";
+ print "@command\n\n";
+ system @command;
+ }
+
+ # Get a list of parrot-configs to invoke.
+ my @parrot_config_exe = qw(
+ install/bin/parrot_config
+ parrot_config
+ );
+ if (exists $options{'prefix'}) {
+ unshift @parrot_config_exe,
+ $options{'prefix'} . '/bin/parrot_config';
+ }
+
+ if ($options{'parrot-config'} && $options{'parrot-config'} ne '1') {
+ @parrot_config_exe = ($options{'parrot-config'});
+ }
+
+ # Get configuration information from parrot_config
+ my %config = read_parrot_config(@parrot_config_exe);
+
+ my $parrot_errors = '';
+ if (!%config) {
+ $parrot_errors .= "Unable to locate parrot_config\n";
+ }
+ elsif ($reqsvn > $config{'revision'} &&
+ ($reqpar eq '' || version_int($reqpar) > version_int($config{'VERSION'}))) {
+ $parrot_errors .= "Parrot revision r$reqsvn required (currently r$config{'revision'})\n";
+ }
+
+ if ($parrot_errors) {
+ die <<"END";
+===SORRY!===
+$parrot_errors
+To automatically build the version of Parrot that came with this
+distribution ($reqpar), try re-running Configure.pl with the
+'--gen-parrot' option. Or, use the '--parrot-config' option to
+explicitly specify the location of parrot_config to be used to
+build Rakudo Star.
+
+END
+ }
+
+ # Verify the Parrot installation is sufficient for building Rakudo
+ verify_parrot(%config);
+
+ # Create the Makefile using the information we just got
+ create_makefile($options{'makefile-timing'}, %config);
+ my $make = $config{'make'};
+
+ {
+ no warnings;
+ print "Cleaning up ...\n";
+ if (open my $CLEAN, '-|', "$make clean") {
+ my @slurp = <$CLEAN>;
+ close $CLEAN;
+ }
+ }
+
+ print <<"END";
+
+You can now use '$make' to build Rakudo Perl.
+After that, you can use '$make test' to run some local tests,
+or '$make spectest' to check out (via svn) a copy of the Perl 6
+official test suite and run its tests.
+
+END
+ exit 0;
+
+}
+
+
+sub read_parrot_config {
+ my @parrot_config_exe = @_;
+ my %config = ();
+ for my $exe (@parrot_config_exe) {
+ no warnings;
+ if (open my $PARROT_CONFIG, '-|', "$exe --dump") {
+ print "\nReading configuration information from $exe ...\n";
+ while (<$PARROT_CONFIG>) {
+ if (/(\w+) => '(.*)'/) { $config{$1} = $2 }
+ }
+ close $PARROT_CONFIG or die $!;
+ last if %config;
+ }
+ }
+ return %config;
+}
+
+
+sub verify_parrot {
+ print "Verifying Parrot installation...\n";
+ my %config = @_;
+ my $EXE = $config{'exe'};
+ my $PARROT_BIN_DIR = $config{'bindir'};
+ my $PARROT_VERSION = $config{'versiondir'};
+ my $PARROT_LIB_DIR = $config{'libdir'}.$PARROT_VERSION;
+ my $PARROT_SRC_DIR = $config{'srcdir'}.$PARROT_VERSION;
+ my $PARROT_INCLUDE_DIR = $config{'includedir'}.$PARROT_VERSION;
+ my $PARROT_TOOLS_DIR = "$PARROT_LIB_DIR/tools";
+ my @required_files = (
+ "$PARROT_LIB_DIR/library/PGE/Perl6Grammar.pbc",
+ "$PARROT_LIB_DIR/library/PCT/HLLCompiler.pbc",
+ "$PARROT_BIN_DIR/ops2c".$EXE,
+ "$PARROT_TOOLS_DIR/build/pmc2c.pl",
+ "$PARROT_SRC_DIR",
+ "$PARROT_SRC_DIR/pmc",
+ "$PARROT_INCLUDE_DIR",
+ "$PARROT_INCLUDE_DIR/pmc",
+ );
+ my @missing = map { " $_" } grep { ! -e } @required_files;
+ if (@missing) {
+ my $missing = join("\n", @missing);
+ die <<"END";
+
+===SORRY!===
+I'm missing some needed files from the Parrot installation:
+$missing
+(Perhaps you need to use Parrot's "make install-dev" or
+install the "parrot-devel" package for your system?)
+
+END
+ }
+}
+
+# Generate a Makefile from a configuration
+sub create_makefile {
+ my ($makefile_timing, %config) = @_;
+
+ my $maketext = slurp( 'build/Makefile.in' );
+
+ $config{'stagestats'} = $makefile_timing ? '--stagestats' : '';
+ $config{'win32_libparrot_copy'} = $^O eq 'MSWin32' ? 'copy $(PARROT_BIN_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;
+ }
+
+ if ($makefile_timing) {
+ $maketext =~ s{(?<!\\\n)^\t(?!\s*-?cd)(?=[^\n]*\S)}{\ttime }mg;
+ }
+
+ 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;
+}
+
+sub slurp {
+ my $filename = shift;
+
+ open my $fh, '<', $filename or die "Unable to read $filename\n";
+ local $/ = undef;
+ my $maketext = <$fh>;
+ close $fh or die $!;
+
+ return $maketext;
+}
+
+sub version_int {
+ sprintf('%d%03d%03d', split(/\./, $_[0]))
+}
+
+
+# Print some help text.
+sub print_help {
+ print <<'END';
+Configure.pl - Rakudo Configure
+
+General Options:
+ --help Show this text
+ --gen-parrot Download and build a copy of Parrot to use
+ --gen-parrot-option='--option=value'
+ Set parrot config option when using --gen-parrot
+ --parrot-config=/path/to/parrot_config
+ Use config information from parrot_config executable
+Experimental developer's options:
+ --makefile-timing Insert 'time' command all over in the Makefile
+END
+
+ return;
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
diff --git a/build/Makefile.in b/build/Makefile.in
new file mode 100644
index 0000000..055e20b
--- /dev/null
+++ b/build/Makefile.in
@@ -0,0 +1,108 @@
+# Copyright (C) 2006-2010, The Perl Foundation.
+# $Id$
+
+PARROT_ARGS =
+
+# values from parrot_config
+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)
+HAS_ICU = @has_icu@
+
+CC = @cc@
+CFLAGS = @ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @gc_flag@
+EXE = @exe@
+LD = @ld@
+LDFLAGS = @ldflags@ @ld_debug@
+LD_LOAD_FLAGS = @ld_load_flags@
+LIBPARROT = @inst_libparrot_ldflags@
+O = @o@
+LOAD_EXT = @load_ext@
+PERL = @perl@
+CP = @cp@
+MV = @mv@
+RM_F = @rm_f@
+MKPATH = $(PERL) -MExtUtils::Command -e mkpath
+CHMOD = $(PERL) -MExtUtils::Command -e chmod
+POD2MAN = @pod2man@
+
+# locations of parrot resources
+PARROT = $(PARROT_BIN_DIR)/parrot$(EXE)
+NQP_EXE = $(PARROT_BIN_DIR)/parrot-nqp$(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
+OPS2C = $(PARROT_BIN_DIR)/ops2c$(EXE)
+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) @libs@ @icu_shared@
+
+# rakudo directories
+DYNEXT_DIR = dynext
+PMC_DIR = src/pmc
+OPS_DIR = src/ops
+PERL6_LANG_DIR = $(PARROT_LIB_DIR)/languages/perl6
+MANDIR = @mandir@
+DOCDIR = @prefix@/share/doc
+
+## cleaning
+clean:
+ $(RM_F) $(CLEANUPS)
+
+distclean: realclean
+
+realclean: clean
+ $(RM_F) Makefile
+
+testclean:
+
+
+## miscellaneous targets
+# a listing of all targets meant to be called by users
+help:
+ @echo ""
+ @echo "Following targets are available for the user:"
+ @echo ""
+ @echo " all: perl6.pbc"
+ @echo " install: Install stuff."
+ @echo ""
+ @echo "Maintenance:"
+ @echo " perlcritic: Run Perl::Critic on all the Perl 5 code."
+ @echo ""
+ @echo "Cleaning:"
+ @echo " clean: Basic cleaning up."
+ @echo " distclean: Removes also anything built, in theory."
+ @echo " realclean: Removes also files generated by 'Configure.pl'."
+ @echo " testclean: Clean up test results."
+ @echo ""
+ @echo "Misc:"
+ @echo " help: Print this help message."
+ @echo ""
+
+config:
+ $(PERL) Configure.pl
+
+$(PARROT):
+
+CRITIC_FILES=Configure.pl t/harness build/ tools/
+
+perlcritic:
+ perlcritic -1 --profile tools/util/perlcritic.conf $(CRITIC_FILES)
+
+manifest:
+ echo MANIFEST >MANIFEST
+ git ls-files | $(PERL) -ne '/^\./ || print' >>MANIFEST
+ rm -rf t/spec
+ svn export "http://svn.pugscode.org/pugs/t/spec" t/spec
+ find t/spec -type f >>MANIFEST
+ sort -u -o MANIFEST MANIFEST
+
+release: manifest
+ [ -n "$(VERSION)" ] || ( echo "\nTry 'make release VERSION=yyyy.mm'\n\n"; exit 1 )
+ [ -d rakudo-star-$(VERSION) ] || ln -s . rakudo-star-$(VERSION)
+ $(PERL) -ne 'print "rakudo-star-$(VERSION)/$$_"' MANIFEST | \
+ tar -zcv -T - -f rakudo-star-$(VERSION).tar.gz
+ rm rakudo-star-$(VERSION)