develooper Front page | perl.cvs.mod_parrot | Postings from August 2009

[svn:mod_parrot] r655 - in mod_parrot/branches/configure-jeff: . include src src/pmc

From:
jhorwitz
Date:
August 29, 2009 10:20
Subject:
[svn:mod_parrot] r655 - in mod_parrot/branches/configure-jeff: . include src src/pmc
Message ID:
20090829172025.AEB0B1844D8@xx12.develooper.com
Author: jhorwitz
Date: Sat Aug 29 10:20:23 2009
New Revision: 655

Added:
   mod_parrot/branches/configure-jeff/include/io_private.h
Modified:
   mod_parrot/branches/configure-jeff/Configure.pl
   mod_parrot/branches/configure-jeff/Makefile.in
   mod_parrot/branches/configure-jeff/src/parrot_util.c
   mod_parrot/branches/configure-jeff/src/pmc/modparrothandle.pmc

Log:
fix compilation and linking to work with an installed parrot (modparrothandle tests still fail)


Modified: mod_parrot/branches/configure-jeff/Configure.pl
==============================================================================
--- mod_parrot/branches/configure-jeff/Configure.pl	(original)
+++ mod_parrot/branches/configure-jeff/Configure.pl	Sat Aug 29 10:20:23 2009
@@ -93,8 +93,15 @@
     extra_cppflags       => `$apxs -q EXTRA_CPPFLAGS`,
     libexecdir           => `$apxs -q LIBEXECDIR`,
     libtool              => `$apxs -q LIBTOOL`,
-    parrot               => catfile($parrot_config{'build_dir'}, 'parrot'),
-    parrot_blib_dir      => $parrot_config{'blib_dir'},
+    cp                   => $parrot_config{'cp'},
+    load_ext             => $parrot_config{'load_ext'},
+    o                    => $parrot_config{'o'},
+    parrot_bin_dir       => $parrot_config{'bindir'},
+    parrot_inc_dir       => $parrot_config{'includedir'},
+    parrot_ld            => $parrot_config{'ld'},
+    parrot_ld_load_flags => $parrot_config{'ld_load_flags'},
+    parrot_lib_dir       => $parrot_config{'libdir'},
+    parrot_src_dir       => $parrot_config{'srcdir'},
     parrot_build_dir     => $parrot_config{'build_dir'},
     perl                 => $^X,
 );
@@ -108,11 +115,11 @@
 $config{mpm} = $mpm;
 $config{ap_cflags} = `$apxs -q CFLAGS`;
 chomp($config{ap_cflags});
-$config{cflags} = " -I$parrot_config{'build_dir'}/include -Iinclude $config{ap_cflags}";
+$config{cflags} = " -I$config{'parrot_inc_dir'} -Iinclude $config{ap_cflags}";
 $config{cflags} .= " -DMPM_IS_THREADED" if (mpm_is_threaded($mpm));
 $config{libs} = "$parrot_config{'libparrot_linkflags'}" .
     " $parrot_config{'libparrot_ldflags'}" .
-    " -R " . catfile($parrot_config{'build_dir'}, $parrot_config{'blib_dir'}) .
+    " -R$parrot_config{'libdir'}" .
     " $parrot_config{'libparrot_linkflags'} $parrot_config{'libparrot_ldflags'}";
 
 # we have our config hash, so create the makefile

Modified: mod_parrot/branches/configure-jeff/Makefile.in
==============================================================================
--- mod_parrot/branches/configure-jeff/Makefile.in	(original)
+++ mod_parrot/branches/configure-jeff/Makefile.in	Sat Aug 29 10:20:23 2009
@@ -14,12 +14,22 @@
 LIBEXECDIR=@libexecdir@
 PERL=@perl@
 APXS=@apxs@
-PARROT_SOURCE=@parrot_build_dir@
-PARROT_BLIB_DIR=@parrot_blib_dir@
-PARROT=@parrot@
-PARROT_DYNEXT=$(PARROT_SOURCE)/runtime/parrot/dynext
-BUILD_DYNPMC=$(PERL) $(PARROT_SOURCE)/tools/build/dynpmc.pl
-MODPARROT_GROUP=modparrot_group.so
+CP=@cp@
+PARROT_BIN_DIR=@parrot_bin_dir@
+PARROT_INC_DIR=@parrot_inc_dir@
+PARROT_LD=@parrot_ld@
+PARROT_LD_LOAD_FLAGS=@parrot_ld_load_flags@
+PARROT_LIB_DIR=@parrot_lib_dir@
+PARROT_SRC_DIR=@parrot_src_dir@
+PARROT=$(PARROT_BIN_DIR)/parrot
+PARROT_DYNEXT=$(PARROT_LIB_DIR)/dynext
+PMC2C=$(PERL) $(PARROT_LIB_DIR)/tools/build/pmc2c.pl
+PMC_DIR=src/pmc
+PMC2C_INCLUDES=--include $(PMC_DIR) --include $(PARROT_SRC_DIR) --include $(PARROT_SRC_DIR)/pmc
+MODPARROT_GROUP=modparrot_group
+O=@o@
+LOAD_EXT=@load_ext@
+DYNPMC=$(MODPARROT_GROUP)$(LOAD_EXT)
 export DYNPMC_INCLUDE=$(APACHE_INCLUDE_DIR),$(APR_INCLUDE_DIR),$(APU_INCLUDE_DIR),../../include
 
 SRC_DIR = src
@@ -59,11 +69,9 @@
 	lib/ModParrot/HLL/pipp.pbc \
 	lib/ModParrot/HLL/lolcode.pbc
 
-PMCS= modparrothandle
-
 PMC_SOURCES= $(SRC_DIR)/pmc/modparrothandle.pmc
 
-all: gen-src $(SRC_DIR)/mod_parrot.la libs $(MODPARROT_GROUP)
+all: gen-src $(SRC_DIR)/mod_parrot.la libs $(DYNPMC)
 
 %.lo: %.c
 	$(LIBTOOL) --mode=compile $(CC) -o $@ $(EXTRA_CPPFLAGS) $(DEBUG) $(CFLAGS) -I$(APACHE_INCLUDE_DIR) -I$(APR_INCLUDE_DIR) -I$(APU_INCLUDE_DIR) $(DEFINES) -c $<
@@ -80,16 +88,19 @@
 
 libs: $(MPLIBS)
 
-$(MODPARROT_GROUP): $(PMC_SOURCES)
-	cd $(SRC_DIR)/pmc && $(BUILD_DYNPMC) generate $(PMCS)
-	cd $(SRC_DIR)/pmc && $(BUILD_DYNPMC) compile $(PMCS)
-	cd $(SRC_DIR)/pmc && $(BUILD_DYNPMC) linklibs $(PMCS)
+$(DYNPMC): $(PMC_SOURCES)
+	$(PMC2C) --no-lines --dump $(PMC2C_INCLUDES) $(PMC_SOURCES)
+	$(PMC2C) --no-lines --c $(PMC2C_INCLUDES) $(PMC_SOURCES)
+	$(PMC2C) --no-lines --library $(MODPARROT_GROUP) --c $(PMC_SOURCES)
+	$(CC) -c -o $(MODPARROT_GROUP)$(O) -I$(PMC_DIR) -I$(PARROT_INC_DIR) -I$(PARROT_INC_DIR)/pmc $(CFLAGS) $(MODPARROT_GROUP).c
+	cd $(PMC_DIR) && $(CC) -c $(DFEINES) $(EXTRA_CPPFLAGS) $(CFLAGS) -I../../include -I$(APACHE_INCLUDE_DIR) -I$(APR_INCLUDE_DIR) -I$(APU_INCLUDE_DIR) -I$(PARROT_INC_DIR) -I$(PARROT_INC_DIR)/pmc $(CFLAGS) *.c
+	$(PARROT_LD) -o $@ $(MODPARROT_GROUP)$(O) $(PMC_DIR)/*$(O) $(PARROT_LD_LOAD_FLAGS)
 
 modperl6: languages/perl6/lib/mod_perl6.pir languages/perl6/lib/ModPerl6/Registry.pir
 
 %.pir: %.pm
 	PERL6LIB=languages/perl6/lib \
-	$(PARROT) $(PARROT_SOURCE)/languages/rakudo/perl6.pbc \
+	$(PARROT) $(PARROT_LIB_DIR)/languages/perl6/perl6.pbc \
 	--output=$@ --target=pir $<
 
 modperl6-clean:
@@ -107,12 +118,10 @@
 	rm -f $(MPLIBS)
 
 pmcs-clean:
-	rm -f $(SRC_DIR)/pmc/$(MODPARROT_GROUP)
-	rm -f $(SRC_DIR)/pmc/*.c
-	rm -f $(SRC_DIR)/pmc/*.h
-	rm -f $(SRC_DIR)/pmc/*.o
-	rm -f $(SRC_DIR)/pmc/*.dump
-	rm -f $(SRC_DIR)/pmc/*.exp
+	rm -f $(MODPARROT_GROUP).* $(DYNPMC)
+	rm -f $(PMC_DIR)/*.h
+	rm -f $(PMC_DIR)/*.c
+	rm -f $(PMC_DIR)/*.dump
 
 test-clean:
 	if [ -x t/TEST ]; then t/TEST -clean; fi
@@ -125,7 +134,7 @@
 
 install: $(SRC_DIR)/mod_parrot.la $(MODPARROT_GROUP)
 	$(APXS) -i -n parrot -a $(SRC_DIR)/mod_parrot.la
-	cd $(SRC_DIR)/pmc && $(BUILD_DYNPMC) copy "--destination=$(PARROT_DYNEXT)" $(PMCS)
+	$(CP) $(DYNPMC) $(PARROT_DYNEXT)
 
 test: $(SRC_DIR)/mod_parrot.la libs
 	$(PARROT) -o t/lib/handlers.pbc t/lib/handlers.pir

Added: mod_parrot/branches/configure-jeff/include/io_private.h
==============================================================================
--- (empty file)
+++ mod_parrot/branches/configure-jeff/include/io_private.h	Sat Aug 29 10:20:23 2009
@@ -0,0 +1,117 @@
+/*
+Copyright (C) 2001-2008, Parrot Foundation.
+$Id: io_private.h 36832 2009-02-17 19:58:58Z allison $
+
+=head1 NAME
+
+src/io/io_private.h - IO internals
+
+=head1 DESCRIPTION
+
+Internal Details of the Parrot IO subsystem.
+
+=head2 References
+
+Perl6 RFCs (14,30,47,60,186,239,321,345,350).
+
+Some ideas and goals from Perl5.7 and Nick Ing-Simmons' work.
+
+Some ideas from AT&T SFIO.
+
+=cut
+
+*/
+
+#ifndef PARROT_IO_PRIVATE_H_GUARD
+#define PARROT_IO_PRIVATE_H_GUARD
+
+#define PARROT_IN_IO 1
+#define PARROT_ASYNC_DEVEL 0
+#define PARROT_NET_DEVEL 1
+
+#include <parrot/io.h>
+
+#if PARROT_NET_DEVEL
+/* XXX: Parrot config is currently not probing for all headers so
+ * I'm sticking here rather than parrot.h
+ */
+#  ifdef UNIX
+#    include <sys/socket.h>
+#  endif
+
+#  ifdef WIN32
+#    include <winsock.h>
+#  endif
+
+#endif /* PARROT_NET_DEVEL */
+
+/* IO object flags */
+#define PIO_F_READ      00000001
+#define PIO_F_WRITE     00000002
+#define PIO_F_APPEND    00000004
+#define PIO_F_TRUNC     00000010
+#define PIO_F_EOF       00000020
+#define PIO_F_FILE      00000100
+#define PIO_F_PIPE      00000200
+#define PIO_F_SOCKET    00000400
+#define PIO_F_CONSOLE   00001000        /* A terminal                   */
+#define PIO_F_READLINE  00002000        /* user interactive readline    */
+#define PIO_F_LINEBUF   00010000        /* Flushes on newline           */
+#define PIO_F_BLKBUF    00020000
+#define PIO_F_SOFT_SP   00040000        /* Python softspace */
+#define PIO_F_SHARED    00100000        /* Stream shares a file handle  */
+#define PIO_F_ASYNC     01000000        /* In Parrot async is default   */
+
+/* Buffer flags */
+#define PIO_BF_MALLOC   00000001        /* Buffer malloced              */
+#define PIO_BF_READBUF  00000002        /* Buffer is read-buffer        */
+#define PIO_BF_WRITEBUF 00000004        /* Buffer is write-buffer       */
+#define PIO_BF_MMAP     00000010        /* Buffer mmap()ed              */
+
+
+#define PIO_ACCMODE     0000003
+#define PIO_DEFAULTMODE DEFAULT_OPEN_MODE
+#define PIO_UNBOUND     (size_t)-1
+
+typedef PMC **ParrotIOTable;
+
+struct _ParrotIOData {
+    ParrotIOTable table;
+};
+
+/* redefine PIO_STD* for internal use */
+#define _PIO_STDIN(i)   (((ParrotIOData*)(i)->piodata)->table[PIO_STDIN_FILENO])
+#define _PIO_STDOUT(i)  (((ParrotIOData*)(i)->piodata)->table[PIO_STDOUT_FILENO])
+#define _PIO_STDERR(i)  (((ParrotIOData*)(i)->piodata)->table[PIO_STDERR_FILENO])
+
+/* Parrot_Socklen_t is used in POSIX accept call */
+#if PARROT_HAS_SOCKLEN_T
+typedef socklen_t Parrot_Socklen_t;
+#else
+typedef int Parrot_Socklen_t;
+#endif
+
+#endif /* PARROT_IO_PRIVATE_H_GUARD */
+
+/*
+
+=head1 SEE ALSO
+
+F<src/io/api.c>,
+F<src/io/buffer.c>,
+F<src/io/portable.c>,
+F<src/io/unix.c>,
+F<src/io/utf8.c>,
+F<src/io/io_win32.c>.
+
+=cut
+
+*/
+
+
+/*
+ * Local variables:
+ *   c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */

Modified: mod_parrot/branches/configure-jeff/src/parrot_util.c
==============================================================================
--- mod_parrot/branches/configure-jeff/src/parrot_util.c	(original)
+++ mod_parrot/branches/configure-jeff/src/parrot_util.c	Sat Aug 29 10:20:23 2009
@@ -21,7 +21,7 @@
 #include "parrot/embed.h"
 #include "parrot/extend.h"
 #include "mod_parrot.h"
-#include "../src/pmc/pmc_continuation.h"
+#include "pmc/pmc_continuation.h"
 
 static Parrot_PMC get_sub_pmc_s(Parrot_Interp interp, char *namespace, char *name)
 {

Modified: mod_parrot/branches/configure-jeff/src/pmc/modparrothandle.pmc
==============================================================================
--- mod_parrot/branches/configure-jeff/src/pmc/modparrothandle.pmc	(original)
+++ mod_parrot/branches/configure-jeff/src/pmc/modparrothandle.pmc	Sat Aug 29 10:20:23 2009
@@ -32,7 +32,12 @@
 */
 
 #include "parrot/parrot.h"
-#include "../src/io/io_private.h"
+
+/* We need constants are from ../src/io/io_private.h, which are missing
+ * from an installed parrot as of r40850.  So we roll our own.
+ */
+#include "io_private.h"
+
 #include "mod_parrot.h"
 #include "httpd.h"
 #include "http_protocol.h"



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About