Edit

IABSD.fr/ports/infrastructure/mk/apache-module.port.mk

Branch :

  • Show log

    Commit

  • Author : sthen
    Date : 2018-10-16 13:11:30
    Hash : be94a602
    Message : just call apxs and apachectl instead of apxs2/apachectl2, there is no more conflict with Apache httpd 1.x so the suffix is no longer needed.

  • infrastructure/mk/apache-module.port.mk
  • # $OpenBSD: apache-module.port.mk,v 1.12 2018/10/16 13:11:30 sthen Exp $
    # simplify installation of apache modules
    # written by Marc Espie 2007, public domain
    #
    # how to use:
    # - define your module name as MODAPACHE_NAME (e.g., auth_kerb)
    # - give a longer description as MODAPACHE_LONG_DESCRIPTION (for enable-script)
    # - define MODAPACHE_LOCATION to be the directory into which the module is built
    # (defaults to WRKBUILD)
    # - or define MODAPACHE_FILE to the full name of the module file before installation.
    
    # in your targets:
    # - add ${MODAPACHE_CREATE_ENABLE_SCRIPT} somewhere in build
    # - add ${MODAPACHE_INSTALL} to an install target.
    
    # this will
    # - install your module
    # - create and install an apxs wrapper
    
    # subst_vars are provided:
    # MODAPACHE_MODULE, MODAPACHE_ENABLE, MODAPACHE_FINAL
    
    # a typical packing-list (minimal) will be:
    # lib/${MODAPACHE_MODULE}
    # @exec-update test -f ${MODAPACHE_FINAL} && cp -fp %D/%F ${MODAPACHE_FINAL}
    # sbin/${MODAPACHE_ENABLE}
    # @unexec-delete rm -f ${MODAPACHE_FINAL}
    
    MODAPACHE_ENABLE ?= mod_${MODAPACHE_NAME}-enable
    MODAPACHE_MODULE ?= mod_${MODAPACHE_NAME}.so
    MODAPACHE_FINAL = ${LOCALBASE}/lib/apache2/modules/${MODAPACHE_MODULE}
    MODAPACHE_LOCATION ?= ${WRKBUILD}
    MODAPACHE_FILE ?= ${MODAPACHE_LOCATION}/${MODAPACHE_MODULE}
    MODAPACHE_APXS ?= ${LOCALBASE}/sbin/apxs
    MODAPACHE_CTL ?= ${LOCALBASE}/sbin/apachectl
    
    MAKE_FLAGS += APXS=${MODAPACHE_APXS} APACHECTL=${MODAPACHE_CTL}
    BUILD_DEPENDS += www/apache-httpd
    RUN_DEPENDS += www/apache-httpd
    
    MODAPACHE_CREATE_ENABLE_SCRIPT = \
    	exec >${WRKBUILD}/${MODAPACHE_ENABLE}; \
    	echo '\#! /bin/sh'; \
    	echo 'MODULE=${TRUEPREFIX}/lib/${MODAPACHE_MODULE}'; \
    	echo 'if [ `id -u` -ne 0 ]; then'; \
    	echo '    echo "You must be root to run this script."'; \
    	echo '    exit 0'; \
    	echo 'fi'; \
    	echo ; \
    	echo 'if [ ! -f $${MODULE} ]; then'; \
    	echo '    echo "Cannot find ${MODAPACHE_NAME} module ($${MODULE})"'; \
    	echo '    exit 1'; \
    	echo 'else'; \
    	echo '    echo "Enabling ${MODAPACHE_LONG_DESCRIPTION} module..."'; \
    	echo '    ${MODAPACHE_APXS} -i -a -n ${MODAPACHE_NAME} $${MODULE}'; \
    	echo 'fi'
    
    MODAPACHE_INSTALL= \
    	${INSTALL_DATA} ${MODAPACHE_FILE} ${PREFIX}/lib/${MODAPACHE_MODULE}; \
    	${INSTALL_SCRIPT} ${WRKBUILD}/${MODAPACHE_ENABLE} ${PREFIX}/sbin
    
    SUBST_VARS += MODAPACHE_MODULE MODAPACHE_ENABLE MODAPACHE_FINAL MODAPACHE_APXS