Anonymous avatar Anonymous committed 5c9450d

Have to build from an installed Parrot for packaging anyway, so biting
the bullet and diving in.

Comments (0)

Files changed (2)

 #! perl
-# Copyright (C) 2009 The Perl Foundation
 
 use strict;
 use warnings;
-use 5.008;
 
-MAIN: {
-    my %valid_options = (
-        'help'          => 'Display configuration help',
-        'parrot-config' => 'Use configuration given by parrot_config binary',
-        'gen-parrot'    => 'Automatically retrieve and build Parrot',
-    );
+my $perlbin = `parrot_config perl`;
+my $libdir = `parrot_config libdir`;
+my $versiondir = `parrot_config versiondir`;
+my $slash = `parrot_config slash`;
+my $make = `parrot_config make`;
 
-    # Get any options from the command line
-    my %options = get_command_options( \%valid_options );
+chomp($perlbin);
+chomp($libdir);
+chomp($versiondir);
+chomp($slash);
+chomp($make);
 
-    # Print help if it's requested
-    if ($options{'help'}) {
-        print_help();
-        exit(0);
-    }
+my $build_tool = $perlbin . " "
+               . $libdir
+               . $versiondir
+               . $slash
+               . "tools"
+               . $slash
+               . "dev"
+               . $slash
+               . "gen_makefile.pl";
 
-    # Update/generate parrot build if needed
-    if ($options{'gen-parrot'}) {
-        system("$^X build/gen_parrot.pl");
-    }
+my %makefiles = (
+    "build/Makefile.in" => "Makefile",
+);
 
-    # Get a list of parrot-configs to invoke.
-    my @parrot_config_exe = qw(
-        parrot/parrot_config
-        ../../parrot_config
-        parrot_config
-    );
-
-    if ($options{'parrot-config'} && $options{'parrot-config'} ne '1') {
-        @parrot_config_exe = ($options{'parrot-config'});
-    }
-
-    #  Get configuration information from parrot_config
-    my %config = read_parrot_config(@parrot_config_exe);
-    unless (%config) {
-        die <<'END';
-Unable to locate parrot_config.
-To automatically checkout (svn) and build a copy of parrot,
-try re-running Configure.pl with the '--gen-parrot' option.
-Or, use the '--parrot-config' option to explicitly specify
-the location of parrot_config.
-END
-    }
-
-#  Create the Makefile using the information we just got
-    create_makefile(%config);
-
-    my $make = $config{'make'};
-    print <<"END";
-
-You can now use '$make' to build Pynie.
-After that, you can use '$make test' to run some local tests,
-
-END
-    exit 0;
-
+foreach my $template (keys %makefiles) {
+    my $makefile = $makefiles{$template};
+    print "Creating $makefile\n";
+    system("$build_tool $template $makefile");
 }
 
+print <<"END";
 
-#  Process command line arguments into a hash.
-sub get_command_options {
-    my $valid_options = shift;
-
-    my %options = ();
-    for my $arg (@ARGV) {
-        if ($arg =~ /^--(\w[-\w]*)(?:=(.*))?/ && $valid_options->{$1}) {
-            my ($key, $value) = ($1, $2);
-            $value = 1 unless defined $value;
-            $options{$key} = $value;
-            next;
-        }
-        die qq/Invalid option "$arg".  See "perl Configure.pl --help" for valid options.\n/;
-    }
-    return %options;
-}
-
-
-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 "Reading configuration information from $exe\n";
-            while (<$PARROT_CONFIG>) {
-                if (/(\w+) => '(.*)'/) { $config{$1} = $2 }
-            }
-            close $PARROT_CONFIG or die $!;
-            last if %config;
-        }
-    }
-    return %config;
-}
-
-
-#  Generate a Makefile from a configuration
-sub create_makefile {
-    my %config = @_;
-
-    my $maketext = slurp( 'build/Makefile.in' );
-
-    $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{http:\S+}{ do {my $t = $&; $t =~ s'\\'/'g; $t} }eg;
-    }
-
-    my $outfile = 'Makefile';
-    print "Creating $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;
-}
-
-
-#  Print some help text.
-sub print_help {
-    print <<'END';
-Configure.pl - Pynie Configure
-
-General Options:
-    --help             Show this text
-    --gen-parrot       Download and build a copy of Parrot to use
-    --parrot-config=(config)
-                       Use configuration information from config
-
+You can now use '$make' to build Pynie, and '$make-test' to test it
 END
 
-    return;
-}
-
-# Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:
+exit;

build/Makefile.in

 PARROT_ARGS =
 
 # values from parrot_config
-BUILD_DIR     = @build_dir@
 LOAD_EXT      = @load_ext@
 O             = @o@
 EXE           = @exe@
 MAKE          = @make_c@
+RM_F          = @rm_f@
 PERL          = @perl@
-RM_F          = @rm_f@
+
+VERSION_DIR   = @versiondir@
+INCLUDE_DIR   = @includedir@$(VERSION_DIR)
+LIB_DIR       = @libdir@$(VERSION_DIR)
+BIN_DIR       = @bindir@
+TOOLS_DIR     = @libdir@$(VERSION_DIR)@slash@tools
+
 
 # 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
 
 # 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 = pynie.pir \
   src/gen_grammar.pir \
 CLEANUPS = \
   pynie.pbc \
   pynie.c \
-  perl6$(O) \
-  perl6$(EXE) \
+  pynie$(O) \
+  pynie$(EXE) \
   src/gen_*.pir \
   src/gen_*.pm \
 
 ##  targets for building a standalone perl6.
 pynie$(EXE): $(PBC_TO_EXE) pynie.pbc
 	$(PBC_TO_EXE) pynie.pbc
-	@win32_libparrot_copy@
 
 # the Pynie compiler
 pynie.pbc: $(PARROT) $(SOURCES) $(BUILTINS_PIR)
 src/gen_builtins.pir: $(BUILTINS_PIR)
 	$(CAT) $(BUILTINS_PIR) > src/gen_builtins.pir
 
-##  local copy of Parrot
-parrot: parrot/parrot_config build/PARROT_REVISION
-	$(PERL) build/gen_parrot.pl
-
-parrot/parrot_config:
-	@echo "Don't see parrot/parrot_config."
-
 ##  testing targets
 test    : pynie$(EXE)
 	$(PERL) t/harness t/00-parrot
 distclean: realclean
 
 realclean: clean
-	$(RM_F) src/utils/Makefile Makefile
+	$(RM_F) Makefile
 
 testclean:
 
 
-##  miscellaneous targets
 # a listing of all targets meant to be called by users
 help:
 	@echo ""
 	@echo "  all:               pynie.pbc"
 	@echo "                     This is the default."
 	@echo "  pynie$(EXE):       Some want a pony, others are satisfied with an executable."
-	@echo "  spectest_checkout  Performs svn checkout of official test suite."
-	@echo "  spectest_update    Performs svn update of official test suite."
-	@echo "  testable:          Create the pynie executable, compile the Test library,"
 	@echo "                     and update official test suite."
 	@echo ""
 	@echo "Testing:"
-	@echo "  test:              Run coretest and codetest."
-	@echo "  coretest:          Run pynie's core tests."
+	@echo "  test:              Run Pynie's tests."
 	@echo ""
 	@echo "Cleaning:"
 	@echo "  clean:             Basic cleaning up."
 	@echo "Misc:"
 	@echo "  help:              Print this help message."
 	@echo ""
-
-manifest:
-	echo MANIFEST >MANIFEST
-	# git ls-files | $(PERL) -ne '/^\./ || print' >>MANIFEST
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.