From 0e52b10d4f3bddb695b9453f50401169c233e50d Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 3 May 1999 19:45:43 +0000 Subject: Make the php3 pkg work and add full dynamic module support. This includes: - the CGI-based interpreter, xbase support binaries, and php2 converter - compiled-in support for Berkeley DB (ndbm), yp, zlib, dBase (xbase), and filePro - the ability to compile PHP3 extensions as dynamic modules (such as support for MySQL/PostgreSQL/freeODBC) that may be exchanged freely between different server interfaces to PHP (abstractions.c and php.h/tls.h patches) --- www/php3/Makefile | 72 ++++++++++++++++++++++++++++++++----------- www/php3/files/abstractions.c | 30 ++++++++++++++++++ www/php3/files/md5 | 4 +-- www/php3/patches/patch-aa | 16 ++++++++++ www/php3/patches/patch-ab | 29 +++++++++++++++++ www/php3/patches/patch-ac | 27 ++++++++++++++++ www/php3/patches/patch-ad | 20 ++++++++++++ www/php3/patches/patch-ae | 13 ++++++++ www/php3/patches/patch-af | 33 ++++++++++++++++++++ www/php3/pkg/COMMENT | 2 +- www/php3/pkg/DESCR | 2 +- www/php3/pkg/MESSAGE | 13 +++----- www/php3/pkg/PLIST | 33 ++++++++++++++++++-- 13 files changed, 262 insertions(+), 32 deletions(-) create mode 100644 www/php3/files/abstractions.c create mode 100644 www/php3/patches/patch-aa create mode 100644 www/php3/patches/patch-ab create mode 100644 www/php3/patches/patch-ac create mode 100644 www/php3/patches/patch-ad create mode 100644 www/php3/patches/patch-ae create mode 100644 www/php3/patches/patch-af (limited to 'www') diff --git a/www/php3/Makefile b/www/php3/Makefile index d004feb0303..5afb31720da 100644 --- a/www/php3/Makefile +++ b/www/php3/Makefile @@ -1,29 +1,65 @@ -# $NetBSD: Makefile,v 1.2 1998/08/20 15:17:31 tsarna Exp $ -# -# Notes: -# -# This package is configured to work with the NetBSD apache-1.3 package -# And the NetBSD mysql package. -# -# 1. Downloading the distribution from http://ca.php.net/distributions/ -# works with netscape, but not with our FTP client or when done by -# hand. I've sent a message to webmaster@php.org about this. -# -# 2. The DEPENDS line still needs to be done. I (cjs) am not entirely -# certain of how to go about this. +# $NetBSD: Makefile,v 1.3 1999/05/03 19:45:43 tv Exp $ # -DISTNAME= php-3.0.2a -PKGNAME= php-3.0.2a +DISTNAME= php-${PHP_VERSION} CATEGORIES= www -MASTER_SITES= http://ca.php.net/distributions/ +MASTER_SITES= ftp://ftp.php.net/pub/distributions/ MAINTAINER= cjs@netbsd.org HOMEPAGE= http://www.php.net/ -#DEPENDS+= perl,apache1.3,mysql +# This is needed because other pkgs .include this Makefile +DISTFILES+= ${DISTNAME}.tar.gz +PHP_VERSION= 3.0.7 + +.if defined(BUILDING_EXTENSION_MODULE) || defined(BUILDING_SERVER_MODULE) +DEPENDS+= php-${PHP_VERSION}:../../www/php3 +.endif + +.if !defined(BUILDING_EXTENSION_MODULE) +# Here we configure only for what NetBSD ships. We add the rest via modules. +CONFIGURE_ARGS+=--with-system-regex --without-gd \ + --with-yp --with-zlib --with-dbase --with-filepro \ + --with-config-file-path=${PREFIX}/etc \ + --with-exec-dir=${PREFIX}/libexec/php3 \ + --enable-track-vars --enable-force-cgi-redirect \ + --enable-discard-path --enable-memory-limit \ + --enable-sysvsem --enable-sysvshm -CONFIGURE_ARGS+=--with-apxs --with-mysql=/usr/pkg --with-system-regex --enable-track-vars GNU_CONFIGURE= YES +LDFLAGS= -Wl,-R${PREFIX}/lib/php3 +CONFIGURE_ENV= CPPFLAGS="-DPHP_INTERNAL_FUNCS" + +post-extract: + @${CP} ${FILESDIR}/abstractions.c ${WRKSRC} + +.if !defined(BUILDING_SERVER_MODULE) +post-build: + @cd ${WRKSRC}/convertor && ${MAKE} + +# The PHP includes are not easily detachable from the source tree in this +# release, so we extract the PHP sources with every module, and only install +# config.h so that `./configure' need not be run every time. +# This should improve in PHP 3.1 or 4.0. + +do-install: + ${INSTALL_DATA_DIR} ${PREFIX}/lib/php3 ${PREFIX}/include/php3 + cd ${WRKSRC} && \ + ${INSTALL_DATA} config.h ${PREFIX}/include/php3/ + ${INSTALL_PROGRAM} ${WRKSRC}/php ${PREFIX}/bin/ + ${INSTALL_PROGRAM} ${WRKSRC}/convertor/convertor \ + ${PREFIX}/bin/php2convert + ${LN} -sf ${PREFIX}/bin/php ${PREFIX}/libexec/cgi-bin/php + cd ${WRKSRC}/dbase && \ + ${INSTALL_PROGRAM} dbfadd dbfcreat dbfdel dbfget dbflst \ + dbfndx dbfpack dbftst ${PREFIX}/bin/ + ${INSTALL_SCRIPT} ${WRKSRC}/dbase/dbfscan ${PREFIX}/bin/ + ${INSTALL_DATA_DIR} ${PREFIX}/share/php3 + ${INSTALL_DATA} ${WRKSRC}/extra/icons/* ${PREFIX}/share/php3/ + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/php3 + ${INSTALL_DATA} ${WRKSRC}/examples/README* ${WRKSRC}/examples/*.php3 \ + ${PREFIX}/share/examples/php3/ +.endif +.endif .include "../../mk/bsd.pkg.mk" diff --git a/www/php3/files/abstractions.c b/www/php3/files/abstractions.c new file mode 100644 index 00000000000..7d8048f1249 --- /dev/null +++ b/www/php3/files/abstractions.c @@ -0,0 +1,30 @@ +/* $NetBSD: abstractions.c,v 1.1 1999/05/03 19:45:44 tv Exp $ */ + +/* + * This provides abstracted definitions for a few functions that are + * "inlined" in normal statically-compiled PHP modules. This way, any + * dynamic module can be used with any PHP server interface (CGI, Apache, ...). + */ + +#define PHP_INTERNAL_FUNCS 1 +#include "php.h" + +void _php3_puts(const char *s) { + PUTS(s); +} + +void _php3_putc(char c) { + PUTC(c); +} + +int _php3_write(const void *a, int n) { + PHPWRITE(a, n); +} + +void _php3_block_interruptions(void) { + BLOCK_INTERRUPTIONS; +} + +void _php3_unblock_interruptions(void) { + UNBLOCK_INTERRUPTIONS; +} diff --git a/www/php3/files/md5 b/www/php3/files/md5 index 5089585c290..d813efc2422 100644 --- a/www/php3/files/md5 +++ b/www/php3/files/md5 @@ -1,3 +1,3 @@ -$NetBSD: md5,v 1.2 1998/08/07 13:27:42 agc Exp $ +$NetBSD: md5,v 1.3 1999/05/03 19:45:44 tv Exp $ -MD5 (php-3.0.2a.tar.gz) = b6dcf0abbb28fa67bbebb5919b4ebcef +MD5 (php-3.0.7.tar.gz) = 3881388d0bc88f0fda5bb925d908314a diff --git a/www/php3/patches/patch-aa b/www/php3/patches/patch-aa new file mode 100644 index 00000000000..f610b544cf2 --- /dev/null +++ b/www/php3/patches/patch-aa @@ -0,0 +1,16 @@ +$NetBSD: patch-aa,v 1.4 1999/05/03 19:45:44 tv Exp $ + +--- functions/dl.c.orig Sun May 2 14:34:53 1999 ++++ functions/dl.c Sun May 2 14:35:15 1999 +@@ -123,7 +123,11 @@ + #endif + RETURN_FALSE; + } ++#ifdef __ELF__ + get_module = (php3_module_entry *(*)(void)) dlsym(handle, "get_module"); ++#else ++ get_module = (php3_module_entry *(*)(void)) dlsym(handle, "_get_module"); ++#endif + + if (!get_module) { + dlclose(handle); diff --git a/www/php3/patches/patch-ab b/www/php3/patches/patch-ab new file mode 100644 index 00000000000..c5c825ab4da --- /dev/null +++ b/www/php3/patches/patch-ab @@ -0,0 +1,29 @@ +$NetBSD: patch-ab,v 1.1 1999/05/03 19:45:44 tv Exp $ + +--- php.h.orig Sun May 2 15:38:36 1999 ++++ php.h Sun May 2 15:49:49 1999 +@@ -309,6 +309,24 @@ + # endif + #endif + ++#ifndef PHP_INTERNAL_FUNCS ++#undef PUTS ++#undef PUTC ++#undef PHPWRITE ++#undef BLOCK_INTERRUPTIONS ++#undef UNBLOCK_INTERRUPTIONS ++extern PHPAPI void _php3_puts(const char *s); ++extern PHPAPI void _php3_putc(char c); ++extern PHPAPI int _php3_write(const void *a, int n); ++extern PHPAPI void _php3_block_interruptions(void); ++extern PHPAPI void _php3_unblock_interruptions(void); ++#define PUTS(a) _php3_puts(a) ++#define PUTC(a) _php3_putc(a) ++#define PHPWRITE(a,n) _php3_write((a),(n)) ++#define BLOCK_INTERRUPTIONS _php3_block_interruptions() ++#define UNBLOCK_INTERRUPTIONS _php3_unblock_interruptions() ++#endif ++ + #define E_ERROR 0x1 + #define E_WARNING 0x2 + #define E_PARSE 0x4 diff --git a/www/php3/patches/patch-ac b/www/php3/patches/patch-ac new file mode 100644 index 00000000000..86cf278612f --- /dev/null +++ b/www/php3/patches/patch-ac @@ -0,0 +1,27 @@ +$NetBSD: patch-ac,v 1.1 1999/05/03 19:45:44 tv Exp $ + +--- tls.h.orig Sun May 2 15:36:41 1999 ++++ tls.h Sun May 2 15:38:32 1999 +@@ -120,9 +120,13 @@ + int php3_preprocess; + #if APACHE + request_rec *php3_rqst; ++#else ++ void *__php3_rqst; + #endif + #if USE_SAPI + struct sapi_request_info *sapi_rqst; ++#else ++ void *__sapi_rqst; + #endif + #if WIN32|WINNT + unsigned int wintimer_counter; +@@ -177,6 +181,8 @@ + /*info.c*/ + #if APACHE + module *top_module; ++#else ++ void *__top_module; + #endif + /*pageinfo.c*/ + long page_uid; diff --git a/www/php3/patches/patch-ad b/www/php3/patches/patch-ad new file mode 100644 index 00000000000..71868439bf1 --- /dev/null +++ b/www/php3/patches/patch-ad @@ -0,0 +1,20 @@ +$NetBSD: patch-ad,v 1.1 1999/05/03 19:45:44 tv Exp $ + +--- Makefile.in.orig Sun May 2 16:20:41 1999 ++++ Makefile.in Sun May 2 16:21:02 1999 +@@ -58,13 +58,13 @@ + snprintf.c php3_sprintf.c alloc.c list.c highlight.c debugger.c \ + configuration-parser.tab.c configuration-scanner.c \ + request_info.c safe_mode.c fopen-wrappers.c constants.c \ +- php3_realpath.c alloca.c php_compat.c ++ php3_realpath.c alloca.c php_compat.c abstractions.c + OBJS = language-parser.tab.o language-scanner.o main.o php3_hash.o operators.o \ + variables.o token_cache.o stack.o internal_functions.o \ + snprintf.o php3_sprintf.o alloc.o list.o highlight.o debugger.o \ + configuration-parser.tab.o configuration-scanner.o \ + request_info.o safe_mode.o fopen-wrappers.o constants.o \ +- php3_realpath.o alloca.o php_compat.o @LIBOBJS@ ++ php3_realpath.o alloca.o php_compat.o abstractions.o @LIBOBJS@ + + FUNCTIONS_SOURCE = functions/adabasd.c functions/aspell.c functions/apache.c functions/fhttpd.c \ + functions/basic_functions.c \ diff --git a/www/php3/patches/patch-ae b/www/php3/patches/patch-ae new file mode 100644 index 00000000000..1a86f54c22a --- /dev/null +++ b/www/php3/patches/patch-ae @@ -0,0 +1,13 @@ +$NetBSD: patch-ae,v 1.1 1999/05/03 19:45:44 tv Exp $ + +--- dbase/Makefile.in.orig Sun May 2 17:01:57 1999 ++++ dbase/Makefile.in Sun May 2 17:02:08 1999 +@@ -11,7 +11,7 @@ + LIB=@libdir@ + + CC=@CC@ +-CFLAGS=-I. -I@srcdir@ @CFLAGS@ ++CFLAGS=-I. -I@srcdir@ @CFLAGS@ @CFLAGS_SHLIB@ + RANLIB=@RANLIB@ + + TARGETS = dbflst tmpl dbfadd dbfdel dbfpack dbfget dbfndx dbfcreat \ diff --git a/www/php3/patches/patch-af b/www/php3/patches/patch-af new file mode 100644 index 00000000000..0c5b70a3ea6 --- /dev/null +++ b/www/php3/patches/patch-af @@ -0,0 +1,33 @@ +$NetBSD: patch-af,v 1.1 1999/05/03 19:45:44 tv Exp $ + +--- convertor/Makefile.orig Mon May 3 12:05:58 1999 ++++ convertor/Makefile Mon May 3 12:06:35 1999 +@@ -1,27 +1,15 @@ + convertor: language-scanner.o language-parser.tab.o token_cache.o main.o alloc.o +- gcc -o convertor language-scanner.o language-parser.tab.o token_cache.o main.o alloc.o +- +-language-parser.tab.c language-parser.tab.h: language-parser.y token_cache.h +- bison -p php -v -d language-parser.y +- +-language-scanner.c: language-scanner.lex token_cache.h +- flex -i -Pphp -olanguage-scanner.c language-scanner.lex +- ++ ${LINK.c} -o convertor language-scanner.o language-parser.tab.o token_cache.o main.o alloc.o + + language-parser.tab.o: language-parser.tab.c token_cache.h +- gcc -c language-parser.tab.c -o language-parser.tab.o + + language-scanner.o: language-scanner.c token_cache.h language-parser.tab.h +- gcc -c language-scanner.c -o language-scanner.o + + token_cache.o: token_cache.c token_cache.h +- gcc -c token_cache.c -o token_cache.o + + main.o: main.c token_cache.h +- gcc -c main.c -o main.o + + alloc.o: alloc.c token_cache.h +- gcc -c alloc.c -o alloc.o + + clean: + rm -f *.o *.tab.c *.output language-scanner.c convertor diff --git a/www/php3/pkg/COMMENT b/www/php3/pkg/COMMENT index a7b5b45bd0d..26de6d78cb9 100644 --- a/www/php3/pkg/COMMENT +++ b/www/php3/pkg/COMMENT @@ -1 +1 @@ -php3 HTML-embedded programming language with database connectivity +PHP3 HTML-embedded programming language with database connectivity diff --git a/www/php3/pkg/DESCR b/www/php3/pkg/DESCR index 11b0e9f180e..ad4220925cf 100644 --- a/www/php3/pkg/DESCR +++ b/www/php3/pkg/DESCR @@ -1,2 +1,2 @@ PHP is a programming language designed to be embedded into web pages. -This version is compiled with MySQL database connectivity. +This is the core support package with the CGI-based interpreter. diff --git a/www/php3/pkg/MESSAGE b/www/php3/pkg/MESSAGE index dced85b153b..19a5dfdf673 100644 --- a/www/php3/pkg/MESSAGE +++ b/www/php3/pkg/MESSAGE @@ -1,9 +1,6 @@ -$NetBSD: MESSAGE,v 1.2 1998/08/07 11:14:26 agc Exp $ +=========================================================================== +$NetBSD: MESSAGE,v 1.3 1999/05/03 19:45:45 tv Exp $ -To add this to your Apache server, you will need to add the following -lines to the appropriate place in your httpd.conf file: - - LoadModule php3_module /usr/pkg/lib/apache/libphp3.so - - AddModule mod_php3.c - AddType application/x-httpd-php3 .php3 +Commands for global initialization of PHP3 may be placed in the file +PREFIX/etc/php3.ini (where php3 is installed in PREFIX/bin/php). +=========================================================================== diff --git a/www/php3/pkg/PLIST b/www/php3/pkg/PLIST index 2e00eceff87..ac68fe3d983 100644 --- a/www/php3/pkg/PLIST +++ b/www/php3/pkg/PLIST @@ -1,2 +1,31 @@ -@comment $NetBSD: PLIST,v 1.2 1998/12/04 17:34:54 tv Exp $ -lib/httpd/libphp3.so +@comment $NetBSD: PLIST,v 1.3 1999/05/03 19:45:45 tv Exp $ +bin/dbfadd +bin/dbfcreat +bin/dbfdel +bin/dbfget +bin/dbflst +bin/dbfndx +bin/dbfpack +bin/dbfscan +bin/dbftst +bin/php +bin/php2convert +include/php3/config.h +libexec/cgi-bin/php +share/examples/php3/README.logging +share/examples/php3/date.php3 +share/examples/php3/dir.php3 +share/examples/php3/log-db.php3 +share/examples/php3/log-footer.php3 +share/examples/php3/log-header.php3 +share/examples/php3/log-test.php3 +share/php3/README +share/php3/php2.gif +share/php3/php3.gif +share/php3/phpi.gif +share/php3/phps.gif +@exec mkdir -p %D/lib/php3 +@dirrm include/php3 +@dirrm lib/php3 +@dirrm share/examples/php3 +@dirrm share/php3 -- cgit v1.2.3