diff options
author | clement <clement@FreeBSD.org> | 2004-04-16 20:24:42 +0800 |
---|---|---|
committer | clement <clement@FreeBSD.org> | 2004-04-16 20:24:42 +0800 |
commit | 8fd14c58de8868c1791edb953c2451180d4de86d (patch) | |
tree | 0263ebf6cde527d665c2d74bcac5095d910ea0e0 | |
parent | 6a23b1ed3f9add7a8ff9266f35e2298af5f36cfe (diff) | |
download | freebsd-ports-gnome-8fd14c58de8868c1791edb953c2451180d4de86d.tar.gz freebsd-ports-gnome-8fd14c58de8868c1791edb953c2451180d4de86d.tar.zst freebsd-ports-gnome-8fd14c58de8868c1791edb953c2451180d4de86d.zip |
Add Makefile.modules.3rd, which should simplify apache modules porting.
It can not be used with USE_APACHE knob.
Most important knobs:
WANT_APACHE= {13,2}
Apache version required. if undefined, both apache version
are allowed.
AP_FAST_BUILD
Do ${APXS} -c ${APXS} -i for you
AP_GENPLIST
Autogenerate a _SIMPLE_ plist:
See future commits to know how to use this file.
-rw-r--r-- | www/apache2/Makefile.modules.3rd | 99 | ||||
-rw-r--r-- | www/apache20/Makefile.modules.3rd | 99 |
2 files changed, 198 insertions, 0 deletions
diff --git a/www/apache2/Makefile.modules.3rd b/www/apache2/Makefile.modules.3rd new file mode 100644 index 000000000000..7c788bded38a --- /dev/null +++ b/www/apache2/Makefile.modules.3rd @@ -0,0 +1,99 @@ +# Third party modules hack +# +# $FreeBSD$ +# +# Author: Clement Laforet <clement@FreeBSD.org> +# If you have questions, please contact me. +# + +.ifdef(USE_APACHE) +.error USE_APACHE and Makefile.modules.3rd can't be used together. +.endif + +APXS?= ${LOCALBASE}/sbin/apxs +MODULENAME?= ${PORTNAME} +SHORTMODNAME?= ${MODULENAME:S/mod_//} +SRC_FILE?= ${MODULENAME}.c +OVERRIDABLE_VARS= SRC_FILE MODULENAME SHORTMODNAME WRKSRC \ + PKGNAMESUFFIX + +.if exists(${LOCALBASE}/include/apache2/http_core.h) +WITH_APACHE2= YES +. if defined (WANT_APACHE) +. if ${WANT_APACHE} == 13 +BROKEN= "This module require apache13 and you have apache2 installed" +. endif +. endif +.elif exists(${LOCALBASE}/include/apache/http_core.h) +WITH_APACHE13= YES +.if exists(${LOCALBASE}/sbin/pkg_info) +PKGINFO= ${LOCALBASE}/sbin/pkg_info +.else +PKGINFO= /usr/sbin/pkg_info +.endif +APACHE_PORT!= ${PKGINFO} -qo `${PKGINFO} -qW /usr/local/include/apache/http_core.h ` +. if defined (WANT_APACHE) +. if ${WANT_APACHE} == 2 +BROKEN= "This module require apache2 and you have ${APACHE_PORT} installed" +. endif +. endif +. ifdef(WITH_APACHE2) +.error You have `WITH_APACHE2' variable defined either in environment or in make(1) argumentsm. but ${APACHE_PORT} is installed Please undefine and try again. +. endif +.endif + +.if defined (WANT_APACHE) +. if ${WANT_APACHE} == 13 +WITH_APACHE13= YES +. elif ${WANT_APACHE} == 2 +WITH_APACHE2= YES +. else +BROKEN= "Unknown apache version" +. endif +.endif + +.if defined(WITH_APACHE2) +AP_BUILDEXT= la +PLIST_SUB+= APACHEMODDIR="libexec/apache2" +APACHE_PORT= www/apache2 +AP_VER= 2 +.else +AP_BUILDEXT= so +PLIST_SUB+= APACHEMODDIR="libexec/apache" +. if !defined(APACHE_PORT) +APACHE_PORT= www/apache13 +. endif +AP_VER= 13 +.endif + +.for VAR in ${OVERRIDABLE_VARS} +. if defined(AP${AP_VER}_${VAR}) +${VAR}= ${AP${AP_VER}_${VAR}} +. endif +.endfor + +BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT} +RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT} +PLIST_SUB+= AP_NAME="${SHORTMODNAME}" +PLIST_SUB+= AP_MODULE="${MODULENAME}.so" +.if defined(AP_GENPLIST) +PLIST?= ${WRKDIR}/ap-plist +.endif + +.if defined(AP_FAST_BUILD) + +ap-gen-plist: +.if defined(AP_GENPLIST) + @${ECHO} "===> Generating apache plist" + @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" > ${PLIST} + @${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} + @${ECHO} "@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} +.else + @${DO_NADA} +.endif +do-build: ap-gen-plist + @cd ${WRKSRC} && ${APXS} -c -o ${MODULENAME}.${AP_BUILDEXT} ${SRC_FILE} + +do-install: + @${APXS} -i -a -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT} +.endif diff --git a/www/apache20/Makefile.modules.3rd b/www/apache20/Makefile.modules.3rd new file mode 100644 index 000000000000..7c788bded38a --- /dev/null +++ b/www/apache20/Makefile.modules.3rd @@ -0,0 +1,99 @@ +# Third party modules hack +# +# $FreeBSD$ +# +# Author: Clement Laforet <clement@FreeBSD.org> +# If you have questions, please contact me. +# + +.ifdef(USE_APACHE) +.error USE_APACHE and Makefile.modules.3rd can't be used together. +.endif + +APXS?= ${LOCALBASE}/sbin/apxs +MODULENAME?= ${PORTNAME} +SHORTMODNAME?= ${MODULENAME:S/mod_//} +SRC_FILE?= ${MODULENAME}.c +OVERRIDABLE_VARS= SRC_FILE MODULENAME SHORTMODNAME WRKSRC \ + PKGNAMESUFFIX + +.if exists(${LOCALBASE}/include/apache2/http_core.h) +WITH_APACHE2= YES +. if defined (WANT_APACHE) +. if ${WANT_APACHE} == 13 +BROKEN= "This module require apache13 and you have apache2 installed" +. endif +. endif +.elif exists(${LOCALBASE}/include/apache/http_core.h) +WITH_APACHE13= YES +.if exists(${LOCALBASE}/sbin/pkg_info) +PKGINFO= ${LOCALBASE}/sbin/pkg_info +.else +PKGINFO= /usr/sbin/pkg_info +.endif +APACHE_PORT!= ${PKGINFO} -qo `${PKGINFO} -qW /usr/local/include/apache/http_core.h ` +. if defined (WANT_APACHE) +. if ${WANT_APACHE} == 2 +BROKEN= "This module require apache2 and you have ${APACHE_PORT} installed" +. endif +. endif +. ifdef(WITH_APACHE2) +.error You have `WITH_APACHE2' variable defined either in environment or in make(1) argumentsm. but ${APACHE_PORT} is installed Please undefine and try again. +. endif +.endif + +.if defined (WANT_APACHE) +. if ${WANT_APACHE} == 13 +WITH_APACHE13= YES +. elif ${WANT_APACHE} == 2 +WITH_APACHE2= YES +. else +BROKEN= "Unknown apache version" +. endif +.endif + +.if defined(WITH_APACHE2) +AP_BUILDEXT= la +PLIST_SUB+= APACHEMODDIR="libexec/apache2" +APACHE_PORT= www/apache2 +AP_VER= 2 +.else +AP_BUILDEXT= so +PLIST_SUB+= APACHEMODDIR="libexec/apache" +. if !defined(APACHE_PORT) +APACHE_PORT= www/apache13 +. endif +AP_VER= 13 +.endif + +.for VAR in ${OVERRIDABLE_VARS} +. if defined(AP${AP_VER}_${VAR}) +${VAR}= ${AP${AP_VER}_${VAR}} +. endif +.endfor + +BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT} +RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT} +PLIST_SUB+= AP_NAME="${SHORTMODNAME}" +PLIST_SUB+= AP_MODULE="${MODULENAME}.so" +.if defined(AP_GENPLIST) +PLIST?= ${WRKDIR}/ap-plist +.endif + +.if defined(AP_FAST_BUILD) + +ap-gen-plist: +.if defined(AP_GENPLIST) + @${ECHO} "===> Generating apache plist" + @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" > ${PLIST} + @${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} + @${ECHO} "@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} +.else + @${DO_NADA} +.endif +do-build: ap-gen-plist + @cd ${WRKSRC} && ${APXS} -c -o ${MODULENAME}.${AP_BUILDEXT} ${SRC_FILE} + +do-install: + @${APXS} -i -a -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT} +.endif |