Hi,
Here's a patch that does the minimal amount of work necessary to tell
ExtUtils::MakeMaker how to build Parrot::Embed from a compiled but
uninstalled Parrot. It works on Linux; my hope is that it will work much
better on Windows.
If it doesn't, it's because of one missing configuration item, so I believe we
can fix this with relative ease.
Testers welcome, especially on non-Linux platforms.
-- c
=== config/gen/makefiles/ext.in
==================================================================
--- config/gen/makefiles/ext.in (revision 2186)
+++ config/gen/makefiles/ext.in (local)
@@ -3,7 +3,7 @@
# setup of commands
@make_set_make@
PERL = @perl@
-MAKE = @make_c@
+MAKE = @make@
RM_F = @rm_f@
# add new languages here
@@ -16,10 +16,8 @@
# hard-code these for now
test: Parrot-Embed
- - cd Parrot-Embed && $(PERL) Build test
+ - cd Parrot-Embed && $(MAKE) test
-clean: Parrot-Embed
- - cd Parrot-Embed && $(PERL) Build clean
# This is a listing of all targets, that are meant to be called by users
help:
@@ -61,4 +59,7 @@
Parrot-Embed : Parrot-Embed.dummy
Parrot-Embed.dummy:
- - cd Parrot-Embed && $(PERL) Build.PL && $(PERL) Build
+ - cd Parrot-Embed && $(PERL) Makefile.PL && $(MAKE)
+
+Parrot-Embed.clean:
+ - cd Parrot-Embed && $(MAKE) clean
=== config/gen/makefiles/parrot_embed.in
==================================================================
--- config/gen/makefiles/parrot_embed.in (revision 2186)
+++ config/gen/makefiles/parrot_embed.in (local)
@@ -1,62 +1,41 @@
# Copyright (C) 2007, The Perl Foundation.
# $Id$
#
-# cross-platform commands and paths
-RM_F = @rm_f@
-RM_RF = @rm_rf@
-MKPATH = @mkpath@
-CP = @cp@
-PERL = @perl@
-PARROTDIR = ../..
-PARROT = $(PARROTDIR)/parrot$(EXE)
+use File::Copy;
+use ExtUtils::MakeMaker;
-# compilation options
-A = @a@
-O = @o@
-SHARE_EXT = @share_ext@
-C_LIBS = @libs@
-#CONDITIONED_LINE(win32):ALL_PARROT_LIBS = $(PARROTDIR)/@libparrot_ldflags@ $(ICU_SHARED) $(C_LIBS)
-#INVERSE_CONDITIONED_LINE(win32):ALL_PARROT_LIBS = @libparrot_ldflags@ $(ICU_SHARED) $(C_LIBS)
-LINKFLAGS = @linkflags@ @link_debug@ @ld_debug@
-LINK = @link@
-LD_SHARE_FLAGS = @ld_share_flags@
-CC_INC = [EMAIL PROTECTED]@ -I../../include
-CFLAGS = $(CC_INC) @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(CC_SHARED)
-#CONDITIONED_LINE(win32):LD_FLAGS = -def:lib\Parrot\Embed.def $(LD_SHARE_FLAGS)
-#INVERSE_CONDITIONED_LINE(win32):LD_FLAGS = $(LD_SHARE_FLAGS)
+copy( 'lib/Parrot/Embed.xs', 'Embed.xs' );
-# files needing compilation
-C_FILE = lib/Parrot/Embed.c
-SO_FILE = blib/arch/auto/Parrot/Embed/Embed$(SHARE_EXT)
-O_FILE = lib/Parrot/Embed$(O)
+# cross-platform commands and paths
+my %config;
+$config{EXE} = '@exe@';
+$config{PARROTDIR} = '../..';
+$config{PARROT} = "$config{PARROTDIR}/parrot$config{EXE}";
+$config{C_LIBS} = '@libs@';
+$config{INCLUDE} = "$config{PARROTDIR}/include";
+$config{ALL_PARROT_LIBS} = "@libparrot_ldflags@ $config{C_LIBS}";
-# other useful files
-PM = blib/lib/Parrot/Embed.pm
-PBC = t/greet.pbc
-TEST_FILES = t/*.t
+WriteMakefile(
+ 'NAME' => 'Parrot::Embed',
+ 'VERSION_FROM' => 'lib/Parrot/Embed.pm',
+ 'PREREQ_PM' => { 'ExtUtils::CBuilder' => 0 },
+ 'LIBS' => [ $config{ALL_PARROT_LIBS} ],
+ 'INC' => "-I$config{INCLUDE}",
+ 'PM' => { map { $_ => "blib/$_" } <lib/Parrot/*pm> },
+ 'clean' => { FILES => '*.xs t/greet.pbc' },
+);
-all : $(SO_FILE) $(PM) $(PBC)
+package MY;
-.c$(O) :
- @$(PERL) $(PARROTDIR)\tools\dev\cc_flags.pl $(PARROTDIR)\CFLAGS $(CC) "" $(CFLAGS) -I$(@D) -Fo$@ -c $<
+sub postamble
+{
+ "t/greet.pbc:\n\t$config{PARROT} -o t/greet.pbc t/greet.pir\n";
+}
-$(PM) : lib/Parrot/Embed.pm
- $(MKPATH) blib/lib/Parrot
- $(CP) lib/Parrot/Embed.pm blib/lib/Parrot
-
-$(SO_FILE) : $(O_FILE)
- $(PERL) -MExtUtils::Mksymlists -e "eval { Mksymlists( NAME => \"Parrot::Embed\" ) }"
- $(MKPATH) blib/arch/auto/Parrot/Embed
- $(LINK) $(LD_SHARE_FLAGS) @[EMAIL PROTECTED](SO_FILE) $(O_FILE) @rpath_blib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
-
-$(C_FILE) : lib/Parrot/Embed.xs
- $(PERL) tools/write_typemap.pl
-
-$(PBC) : t/greet.pir
- $(PARROT) -o $(PBC) t/greet.pir
-
-test : $(TEST_FILES)
- prove -b $(TEST_FILES)
-
-clean :
- $(RM_RF) blib $(C_FILE) $(O_FILE)
+sub dynamic_lib
+{
+ my $inherited = shift->SUPER::dynamic_lib(@_);
+ my $sub_target = quotemeta( ': $(OBJECT)' );
+ $inherited =~ s{($sub_target)}{$1 t/greet.pbc};
+ $inherited;
+}
=== config/gen/makefiles.pm
==================================================================
--- config/gen/makefiles.pm (revision 2186)
+++ config/gen/makefiles.pm (local)
@@ -60,7 +60,7 @@
my ( $self, $conf ) = @_;
genfile( 'config/gen/makefiles/root.in' => 'Makefile' );
- genfile( 'config/gen/makefiles/parrot_embed.in' => 'ext/Parrot-Embed/Makefile' );
+ genfile( 'config/gen/makefiles/parrot_embed.in' => 'ext/Parrot-Embed/Makefile.PL' );
genfile( 'config/gen/makefiles/past.in' => 'compilers/past/Makefile' );
genfile( 'config/gen/makefiles/past-pm.in' => 'compilers/past-pm/Makefile' );