Index: bsd.apache_PR156533.mk =================================================================== --- bsd.apache_PR156533.mk (revision 20) +++ bsd.apache_PR156533.mk (working copy) @@ -59,11 +59,29 @@ # # the module disabled into httpd.conf # # (only if no pkg-plist exist) # +# - AP_MODACTIVE # default: unset +# # +# # +# # +# # +# # See man apxs(8) parameter -a/-A. +# # - MODULENAME # default: ${PORTNAME} # - SHORTMODNAME # default: ${MODULENAME:S/mod_//} # - SRC_FILE # default: ${MODULENAME}.c # # +# In pkg-plist the following expressions can be used as replacement +# ========================================================================= +# Expression | Replace the following line(s) in pkg-plist +# ------------------|----------------------------------------------------- +# @apadd | %%APACHEMODDIR%%/%%AP_MODULE%% +# | @exec %D/sbin/apxs -e -a -n %%AP_NAME%% %D/%F +# ------------------|----------------------------------------------------- +# @apdel | @unexec %%SED%% -i "" "/LoadModule.*%%AP_NAME%%/d" %D/%%APACHEETCDIR%%/httpd.conf +# | @unexec %%SED%% -i "" "/AddModule.*mod_%%AP_NAME%%.c/d" %D/%%APACHEETCDIR%%/httpd.conf +# | @unexec echo "Do not forget to remove all %%AP_MODULE%%-related directives in your httpd.conf" +# .if !defined(Apache_Pre_Include) @@ -509,6 +527,31 @@ .elif defined(AP_PORT_IS_MODULE) +# Install module activated or deactivated +# TODO find better variable names and documentation ( they should begin with AP_ ) XXX +.if defined(AP_MODACTIVE) +_APMODACTIVE= -a +.else +_APMODACTIVE= -A +.endif +PLIST_SUB+= AP_MODACTIVE="${_APMODACTIVE}" + +# Additional Keywords for pkg-plist +PLIST_REINPLACE+= apadd apdel + +# The "§" sign acts as seperator for sed, do not change or remove! +PLIST_REINPLACE_APADD= s!^@apadd!${APACHEMODDIR}/${MODULENAME}.so +PLIST_REINPLACE_APADD+= §@exec %D/sbin/apxs -e ${_APMODACTIVE} -n ${SHORTMODNAME} %D/%F!' +#PLIST_REINPLACE_APADD+= -e '/${SHORTMODNAME}/ y!§!\n!' -e '/${SHORTMODNAME}/ s! $$!! +PLIST_REINPLACE_APADD+= -e '/${SHORTMODNAME}/ y!§!\n! + +PLIST_REINPLACE_APDEL= s!^@apdel!@unexec ${SED} -i "" "/LoadModule.*${SHORTMODNAME}/d" %D/${APACHEETCDIR}/httpd.conf +PLIST_REINPLACE_APDEL+= §@unexec ${SED} -i "" "/AddModule.*mod_${SHORTMODNAME}.c/d" %D/${APACHEETCDIR}/httpd.conf +PLIST_REINPLACE_APDEL+= §@unexec echo "Do not forget to remove all ${MODULENAME}-related directives in your httpd.conf"!' +PLIST_REINPLACE_APDEL+= -e '/${SHORTMODNAME}/ y!§!\n!' +# trim trailing whitespaces for apadd and apdel +PLIST_REINPLACE_APDEL+= -e '/${SHORTMODNAME}/ s! $$!! + .if defined(AP_FAST_BUILD) .if !target(ap-gen-plist) ap-gen-plist: @@ -521,7 +564,7 @@ @${ECHO} "@unexec ${SED} -i '' '/AddModule.*mod_%%AP_NAME%%.c/d' %D/%%APACHEETCDIR%%/httpd.conf" >> ${PLIST} @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST} - @${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} + @${ECHO} "@exec %D/sbin/apxs -e ${_APMODACTIVE} -n %%AP_NAME%% %D/%F" >> ${PLIST} @${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST} . endif .else @@ -536,7 +579,7 @@ .if !target(do-install) do-install: - @${APXS} -i -A -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT} + @${APXS} -i ${_APMODACTIVE} -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT} .endif .endif .endif