Hi,

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)

Greets,
Roland


diff --git a/flavored_mod_fastcgi/Makefile b/flavored_mod_fastcgi/Makefile
index f426594..e9485fb 100644
--- a/flavored_mod_fastcgi/Makefile
+++ b/flavored_mod_fastcgi/Makefile
@@ -3,7 +3,7 @@
 COMMENT=        "Apache FastCGI module"
 
 DISTNAME=       mod_fastcgi-2.4.2
-PKGNAME=       ${DISTNAME}p1
+PKGNAME=       flavored_${DISTNAME}p1
 
 CATEGORIES=     www
 
@@ -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)
 
@@ -35,4 +43,35 @@ do-install:
        ${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>
diff --git a/flavored_mod_fastcgi/patches/ap2-patch-fcgi_h 
b/flavored_mod_fastcgi/patches/ap2-patch-fcgi_h
new file mode 100644
index 0000000..2bc85f9
--- /dev/null
+++ b/flavored_mod_fastcgi/patches/ap2-patch-fcgi_h
@@ -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
diff --git a/flavored_mod_fastcgi/pkg/MESSAGE-ap2 
b/flavored_mod_fastcgi/pkg/MESSAGE-ap2
new file mode 100644
index 0000000..f40ffdb
--- /dev/null
+++ b/flavored_mod_fastcgi/pkg/MESSAGE-ap2
@@ -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.
diff --git a/flavored_mod_fastcgi/pkg/PFRAG.ap2 
b/flavored_mod_fastcgi/pkg/PFRAG.ap2
new file mode 100644
index 0000000..920d7fd
--- /dev/null
+++ b/flavored_mod_fastcgi/pkg/PFRAG.ap2
@@ -0,0 +1,10 @@
[EMAIL PROTECTED] $OpenBSD$
+lib/apache2/mod_fastcgi.so
+lib/apache2/
+man/cat3f/
+man/man3f/
+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
diff --git a/flavored_mod_fastcgi/pkg/PFRAG.no-ap2 
b/flavored_mod_fastcgi/pkg/PFRAG.no-ap2
new file mode 100644
index 0000000..32d1dd7
--- /dev/null
+++ b/flavored_mod_fastcgi/pkg/PFRAG.no-ap2
@@ -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
diff --git a/flavored_mod_fastcgi/pkg/PLIST b/flavored_mod_fastcgi/pkg/PLIST
index 8853815..9c45731 100644
--- a/flavored_mod_fastcgi/pkg/PLIST
+++ b/flavored_mod_fastcgi/pkg/PLIST
@@ -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%%
diff --git a/flavored_mod_fastcgi/pkg/UNMESSAGE-ap2 
b/flavored_mod_fastcgi/pkg/UNMESSAGE-ap2
new file mode 100644
index 0000000..58456de
--- /dev/null
+++ b/flavored_mod_fastcgi/pkg/UNMESSAGE-ap2
@@ -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.

Reply via email to