On Sun, Sep 09, 2007 at 12:57:30PM -0700, Roland Philippsen wrote: > here's a suggestion for adding an Apache2-flavor to www/mod_fastcgi. > The patch (created with git) is best applied using 'patch -p2' from > within the mod_fastcgi directory. The unflavored build is identical to > what's in CVS right now, specifying FLAVOR=ap2 builds it for > www/apache-httpd. > > Tested on a -current amd64 (as of yesterday). > > Any comments welcome, of course. I tried to infer the appropriate > style from the docs and by looking at other ports, but this is my > first attempt so please don't get too upset if I blundered somewhere :o)
I tested this on macppc and i386. Works as expected. I made a couple tweaks and used "cvs diff" (below). - I removed your "flavored_" PKGNAME prefix. - I added "@comment share/.../mod_fastcgi.html.orig" to PFRAG.ap2 so update-plist doesn't change any files. Any comments for the below diff? -ME Index: Makefile =================================================================== RCS file: /cvs/ports/www/mod_fastcgi/Makefile,v retrieving revision 1.4 diff -u -p -r1.4 Makefile --- Makefile 30 Jun 2007 15:32:30 -0000 1.4 +++ Makefile 11 Sep 2007 03:35:34 -0000 @@ -11,8 +11,8 @@ HOMEPAGE= http://www.fastcgi.com/ MASTER_SITES= ${HOMEPAGE}dist/ -MODULES= apache-module -MODAPACHE_NAME= fastcgi +FLAVORS= ap2 +FLAVOR?= MAINTAINER= Marc Balmer <[EMAIL PROTECTED]> @@ -24,6 +24,14 @@ PERMIT_DISTFILES_FTP= Yes NO_REGRESS= Yes +.if !${FLAVOR:L:Map2} + +################################################## +# default: build for builtin Apache + +MODULES= apache-module +MODAPACHE_NAME= fastcgi + do-build: (cd ${WRKBUILD}; apxs -o mod_fastcgi.so -c *.c) @@ -34,5 +42,36 @@ do-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/mod_fastcgi ${INSTALL_DATA} ${WRKBUILD}/docs/* ${PREFIX}/share/doc/mod_fastcgi ${MODAPACHE_INSTALL} + +.else + +################################################## +# ap2 flavor: build for Apache 2 port + +BUILD_DEPENDS= ::www/apache-httpd + +PATCH_LIST= ap2-patch-* patch-docs_mod_fastcgi_html + +MAKE_FILE= Makefile.AP2 + +MAKE_FLAGS= top_dir=${PREFIX}/share/apache2 \ + APXS=${PREFIX}/sbin/apxs2 \ + APACHECTL=${PREFIX}/sbin/apachectl2 + +FAKE_FLAGS= top_dir=${TRUEPREFIX}/share/apache2 \ + APXS=${TRUEPREFIX}/sbin/apxs2 \ + APACHECTL=${TRUEPREFIX}/sbin/apachectl2 + +INSTALL_TARGET= local-install + +# only automated for sub-packages, not flavors (?) +MESSAGE= ${PKGDIR}/MESSAGE-ap2 +UNMESSAGE= ${PKGDIR}/UNMESSAGE-ap2 + +post-install: + ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/apache2/mod/mod_fastcgi + ${INSTALL_DATA} ${WRKBUILD}/docs/* ${PREFIX}/share/doc/apache2/mod/mod_fastcgi + +.endif .include <bsd.port.mk> Index: patches/ap2-patch-fcgi_h =================================================================== RCS file: patches/ap2-patch-fcgi_h diff -N patches/ap2-patch-fcgi_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/ap2-patch-fcgi_h 11 Sep 2007 03:35:34 -0000 @@ -0,0 +1,41 @@ +$OpenBSD$ +--- fcgi.h.orig Mon Feb 3 15:07:37 2003 ++++ fcgi.h Sat Sep 8 16:45:23 2007 +@@ -73,6 +73,37 @@ typedef apr_status_t apcb_t; + #define ap_reset_timeout(a) + #define ap_unblock_alarms() + ++/* starting with apache 2.2 the backward-compatibility defines for ++ * 1.3 APIs are not available anymore. Define them ourselves here. ++ * see http://www.fastcgi.com/archives/fastcgi-developers/2005-December/004060.html ++ */ ++#ifndef ap_copy_table ++ ++#define ap_copy_table apr_table_copy ++#define ap_cpystrn apr_cpystrn ++#define ap_destroy_pool apr_pool_destroy ++#define ap_isspace apr_isspace ++#define ap_make_array apr_array_make ++#define ap_make_table apr_table_make ++#define ap_null_cleanup apr_pool_cleanup_null ++#define ap_palloc apr_palloc ++#define ap_pcalloc apr_pcalloc ++#define ap_psprintf apr_psprintf ++#define ap_pstrcat apr_pstrcat ++#define ap_pstrdup apr_pstrdup ++#define ap_pstrndup apr_pstrndup ++#define ap_push_array apr_array_push ++#define ap_register_cleanup apr_pool_cleanup_register ++#define ap_snprintf apr_snprintf ++#define ap_table_add apr_table_add ++#define ap_table_do apr_table_do ++#define ap_table_get apr_table_get ++#define ap_table_set apr_table_set ++#define ap_table_setn apr_table_setn ++#define ap_table_unset apr_table_unset ++ ++#endif /* defined(ap_copy_table) */ ++ + #if (defined(HAVE_WRITEV) && !HAVE_WRITEV && !defined(NO_WRITEV)) || defined WIN32 + #define NO_WRITEV + #endif Index: pkg/MESSAGE-ap2 =================================================================== RCS file: pkg/MESSAGE-ap2 diff -N pkg/MESSAGE-ap2 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/MESSAGE-ap2 11 Sep 2007 03:35:34 -0000 @@ -0,0 +1,9 @@ +To finish the install of mod_fastcgi, you need +to enable the module by adding the following line +to your /etc/apache2/httpd2.conf file: + + LoadModule fastcgi_module ${PREFIX}/lib/apache2/mod_fastcgi.so + +If you already have Apache running on your machine, +you should not use "apachectl2 restart" - instead, +you should fully stop and then restart the server. Index: pkg/PFRAG.ap2 =================================================================== RCS file: pkg/PFRAG.ap2 diff -N pkg/PFRAG.ap2 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/PFRAG.ap2 11 Sep 2007 03:35:34 -0000 @@ -0,0 +1,9 @@ [EMAIL PROTECTED] $OpenBSD$ +lib/apache2/ +lib/apache2/mod_fastcgi.so +share/doc/apache2/ +share/doc/apache2/mod/ +share/doc/apache2/mod/mod_fastcgi/ +share/doc/apache2/mod/mod_fastcgi/LICENSE.TERMS +share/doc/apache2/mod/mod_fastcgi/mod_fastcgi.html [EMAIL PROTECTED] share/doc/apache2/mod/mod_fastcgi/mod_fastcgi.html.orig Index: pkg/PFRAG.no-ap2 =================================================================== RCS file: pkg/PFRAG.no-ap2 diff -N pkg/PFRAG.no-ap2 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/PFRAG.no-ap2 11 Sep 2007 03:35:34 -0000 @@ -0,0 +1,9 @@ [EMAIL PROTECTED] $OpenBSD$ +lib/${MODAPACHE_MODULE} [EMAIL PROTECTED] test -f ${MODAPACHE_FINAL} && cp -fp %D/%F ${MODAPACHE_FINAL} +sbin/${MODAPACHE_ENABLE} +share/doc/mod_fastcgi/ +share/doc/mod_fastcgi/LICENSE.TERMS +share/doc/mod_fastcgi/mod_fastcgi.html [EMAIL PROTECTED] rm -f ${MODAPACHE_FINAL} [EMAIL PROTECTED] share/doc/mod_fastcgi/mod_fastcgi.html.orig Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/www/mod_fastcgi/pkg/PLIST,v retrieving revision 1.2 diff -u -p -r1.2 PLIST --- pkg/PLIST 22 Jun 2007 14:48:23 -0000 1.2 +++ pkg/PLIST 11 Sep 2007 03:35:34 -0000 @@ -1,9 +1,3 @@ @comment $OpenBSD: PLIST,v 1.2 2007/06/22 14:48:23 simon Exp $ -lib/${MODAPACHE_MODULE} [EMAIL PROTECTED] test -f ${MODAPACHE_FINAL} && cp -fp %D/%F ${MODAPACHE_FINAL} -sbin/${MODAPACHE_ENABLE} -share/doc/mod_fastcgi/ -share/doc/mod_fastcgi/LICENSE.TERMS -share/doc/mod_fastcgi/mod_fastcgi.html [EMAIL PROTECTED] rm -f ${MODAPACHE_FINAL} [EMAIL PROTECTED] share/doc/mod_fastcgi/mod_fastcgi.html.orig +!%%ap2%% +%%ap2%% Index: pkg/UNMESSAGE-ap2 =================================================================== RCS file: pkg/UNMESSAGE-ap2 diff -N pkg/UNMESSAGE-ap2 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/UNMESSAGE-ap2 11 Sep 2007 03:35:34 -0000 @@ -0,0 +1,8 @@ +To completely deinstall the mod_fastcgi package you +need to perform these steps as root: + + edit /etc/apache2/httpd2.conf + remove the line: LoadModule fastcgi_module + +Do not do this if you plan on re-installing the mod_fastcgi +package at some future time.