Index: Mk/Uses/apache.mk =================================================================== --- Mk/Uses/apache.mk +++ Mk/Uses/apache.mk @@ -1,131 +1,155 @@ # $FreeBSD: head/Mk/bsd.apache.mk 419511 2016-08-03 12:09:37Z mat $ # -# bsd.apache.mk - Apache related macros. +# apache.mk - Apache related macros. # Author: Clement Laforet # Author: Olli Hauer +# Author: Bernard Spil # # Please view me with 4 column tabs! -# ========================================================================= -# User controlled parameters for usage in /etc/make.conf: +# Feature: apache +# Usage: USES=apache or USES=apache:args +# Valid args: , build, run, server # -# DEFAULT_VERSIONS - define the default apache version -# valid args: apache=2.2, apache=2.4 +# version If your port requires a specific Apache httpd version, you can +# set this to [min]-[max] or min+ or -max or an explicit version # -# APACHE_PORT - use www/apache22-(event|itk|peruser|worker)-mpm -# instead www/apache22. Use this parameter only in -# combination with "DEFAULT_VERSIONS+= apache=2.2" +# USES=apache:2.2 # Only use Apache 2.2 +# USES=apache:2.4+ # Use Apache 2.4 or newer +# USES=apache:2.2-2.4 # Use Apache 2.2 or 2.4 +# USES=apache # Use the default apache version # -# Example entry in /etc/make.conf: -# - Set apache22 as default version -# DEFAULT_VERSIONS+= apache=2.2 +# Valid version numbers are specified in the variable +# APACHE_SUPPORTED_VERSION below # -# - Additional use a special www/apache22-$MPM port -# APACHE_PORT= www/apache22-event-mpm +# build Indicates that Apache is needed at build time and adds it to +# BUILD_DEPENDS. +# run Indicates that Apache is needed at run time and adds it to +# RUN_DEPENDS. +# server Indicates that the port is a server port. # -# Note: -# - This parameters should never be used in the Makefile of a port! -# - To get a list of "possible" APACHE_PORT values execute the command: -# $> awk '/apache22-/ {print "www/" $3}' ports/www/Makefile +# If build and run are omitted, Apache will be added as BUILD_DEPENDS and +# RUN_DEPENDS # -# ========================================================================= +# Variables, which can be set by the port: # -# This script will be included if one of the following parameter -# is defined in the Makefile of the port +# AP_FAST_BUILD automatic module build # -# USE_APACHE - Set apache and apxs as build and run dependency -# USE_APACHE_BUILD - Set apache and apxs as build dependency -# USE_APACHE_RUN - Set apache and apxs as run dependency +# AP_GENPLIST automatic PLIST generation plus add +# the module disabled into httpd.conf +# (only if no pkg-plist exist) # -# The following example is representative of all three possible -# parameters to use. +# MODULENAME Name of the Apache module +# default: ${PORTNAME} +# SHORTMODNAME Short name of the Apache module +# default: ${MODULENAME:S/mod_//} +# SRC_FILE Source file of the APACHE MODULE +# default: ${MODULENAME}.c # -# Examples: -# USE_APACHE= 22 # specify exact version -# USE_APACHE= 22+ # specify [min] version, no [max] version -# USE_APACHE= 22-24 # specify [min]-[max] range -# USE_APACHE= -22 # specify [max] version, no [min] version +# Variables, for internal use by the Apache ports framework only +# The following values for USE_APACHE are reserved and only valid +# in apache-server ports! +# USES= apache:common22 # -# Note: -# - If "+" is specified and no apache is installed, then -# ${DEFAULT_APACHE_VERSION} will be used. # -# - Valid version numbers are specified in the variable -# APACHE_SUPPORTED_VERSION below +# The following variables can be read by ports and must not be modified +# +# APACHE_VERSION The major-minor release version of the chosen +# Apache server, e.g. 2.2 or 2.4 # -# - The following values for USE_APACHE are reserverd and only valid -# in apache-server ports! -# USE_APACHE= common22 +# APACHEETCDIR Location of the Apache configuration directory +# Default: ${LOCALBASE}/etc/apache24 # +# APACHEINCLUDEDIR Location of the Apache include files +# Default: ${LOCALBASE}/include/apache24 # -# The following variables can be used (ro) in ports Makefile -# ========================================================================= -# - APACHE_VERSION -# - APACHEETCDIR -# - APACHEINCLUDEDIR -# - APACHEMODDIR -# - DEFAULT_APACHE_VERSION -# -# -# Parameters for building third party apache modules: -# ========================================================================= -# - AP_FAST_BUILD # automatic module build -# -# - AP_GENPLIST # automatic PLIST generation plus add -# # the module disabled into httpd.conf -# # (only if no pkg-plist exist) -# -# - MODULENAME # default: ${PORTNAME} -# - SHORTMODNAME # default: ${MODULENAME:S/mod_//} -# - SRC_FILE # default: ${MODULENAME}.c +# APACHEMODDIR Location of the Apache modules +# Default: ${LOCALBASE}/libxexec/apache24 # +# DEFAULT_APACHE_VERSION Default Apache version # -.if !defined(Apache_Pre_Include) - -Apache_Pre_Include= bsd.apache.mk - -.if defined(DEFAULT_APACHE_VER) -WARNING+= "DEFAULT_APACHE_VER is defined, consider using DEFAULT_VERSIONS+=apache=${DEFAULT_APACHE_VER} instead" -.endif +.if !defined(_INCLUDE_USES_APACHE_PRE_MK) +_INCLUDE_USES_APACHE_PRE_MK= yes DEFAULT_APACHE_VERSION?= ${APACHE_DEFAULT:S/.//} # When adding a version, please keep the comment in # Mk/bsd.default-versions.mk in sync. -APACHE_SUPPORTED_VERSION= 24 22 # preferred version first +_APACHE_VERSIONS= 2.4 2.2 # preferred version first # Print warnings -_ERROR_MSG= : Error from bsd.apache.mk. +_ERROR_MSG= : Error from apache.mk. # Important Note: # Keep apache version in ascending order! # The "+" sign is only valid as last sign, not between # two versions or in combination with range! -.if defined(USE_APACHE) && !empty(USE_APACHE) -. if ${USE_APACHE:Mcommon*} != "" -AP_PORT_IS_SERVER= yes -. elif ${USE_APACHE:C/\-//:S/^22//:S/^24//:C/\+$//} == "" -AP_PORT_IS_MODULE= yes -. if ${USE_APACHE:C/\-//:S/^22//:S/^24//} == "+" -AP_PLUS= yes +.if defined(apache_ARGS) && !empty(apache_ARGS) +. if ${apache_ARGS:Mcommon*} != "" +_APACHE_PORT_IS_SERVER= yes +apache_ARGS+= 2.2 +. elif ${apache_ARGS:C/\-//:S/^2.2//:S/^2.4//:C/\+$//} == "" +_APACHE_PORT_IS_MODULE= yes +. if ${apache_ARGS:C/\-//:S/^2.2//:S/^2.4//} == "+" +_APACHE_PLUS= yes . endif . else -IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) +IGNORE= ${_ERROR_MSG} 1 Illegal use of USES= apache ( ${apache_ARGS} ) . endif # Catch unknown apache versions and silly USE_APACHE constructs -. if empty(AP_PORT_IS_SERVER) && empty(AP_PORT_IS_MODULE) -IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) -. endif +. if empty(_APACHE_PORT_IS_SERVER) && empty(_APACHE_PORT_IS_MODULE) +IGNORE= ${_ERROR_MSG} 2 Illegal use of USES= apache ( ${apache_ARGS} ) +. endif # Catch USE_APACHE [min]-[max]+ -. if defined(AP_PLUS) && ${USE_APACHE:C/[.+0-9]//g} == "-" -IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) -. endif -.elif defined(USE_APACHE) -IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( no version specified ) -.endif # defined(USE_APACHE) +. if defined(_APACHE_PLUS) && ${apache_ARGS:C/[.+a-z0-9]//g} == "-" +IGNORE= ${_ERROR_MSG} 3 Illegal use of USES= apache ( ${apache_ARGS} ) +. endif +.elif defined(apache_ARGS) +#IGNORE= ${_ERROR_MSG} 4 Illegal use of USES= apache ( no version specified ) +.endif # defined(apache_ARGS) + +# Split USES=apache:args +_APACHE_ARGS= ${apache_ARGS:S/,/ /g} + +# Process args +.if ${_APACHE_ARGS:Mbuild} +_APACHE_BUILD_DEP= yes +_APACHE_ARGS:= ${_APACHE_ARGS:Nbuild} +.endif +.if ${_APACHE_ARGS:Mrun} +_APACHE_RUN_DEP= yes +_APACHE_ARGS:= ${_APACHE_ARGS:Nrun} +.endif +.if ${_APACHE_ARGS:Mserver} +_APACHE_PORT_IS_SERVER= yes +_APACHE_ARGS:= ${_APACHE_ARGS:Nserver} +.endif +# _APACHE_ARGS is now empty or contains a version(-range) + +.if !defined(_APACHE_BUILD_DEP) && !defined(_APACHE_RUN_DEP) && \ + !defined(_APACHE_PORT_IS_SERVER) +_APACHE_BUILD_DEP= yes +_APACHE_RUN_DEP= yes +.endif + +.if defined(DEFAULT_APACHE_VER) +WARNING+= "DEFAULT_APACHE_VER is defined, consider using DEFAULT_VERSIONS+=apache=${DEFAULT_APACHE_VER} instead" +.endif + +# Check if the version-args are correct (e.g. 2.2-2.4+ is invalid) +.if ${_APACHE_ARGS:S/.//:C/\-//:S/common//:C/^2[24]//g:C/\+$//} != "" || \ + ${_APACHE_ARGS:C/[.0-9]//g} == "-+" +IGNORE= ${_ERROR_MSG} 5 Illegal use of USES=apache ( apache:${apache_ARGS} ) +.endif + +_APACHE_VERSION_CHECK:= ${_APACHE_ARGS:C/^([1-9][0-9])$/\1-\1/} +_APACHE_VERSION_MINIMUM_TMP:= ${_APACHE_VERSION_CHECK:C/([1-9][0-9])[-+].*/\1/} +_APACHE_VERSION_MINIMUM:= ${_APACHE_VERSION_MINIMUM_TMP:M[1-9][0-9]} +_APACHE_VERSION_MAXIMUM_TMP:= ${_APACHE_VERSION_CHECK:C/.*-([1-9][0-9])/\1/} +_APACHE_VERSION_MAXIMUM:= ${_APACHE_VERSION_MAXIMUM_TMP:M[1-9][0-9]} # =============================================================== -.if defined(AP_PORT_IS_SERVER) +.if defined(_APACHE_PORT_IS_SERVER) # Module selection .for category in ${DEFAULT_MODULES_CATEGORIES} DEFAULT_MODULES+= ${${category}_MODULES} @@ -267,10 +291,10 @@ # end pkg-plist adjustments -#### End of AP_PORT_IS_SERVER #### +#### End of _APACHE_PORT_IS_SERVER #### # =============================================================== -.elif defined(AP_PORT_IS_MODULE) || defined(USE_APACHE_RUN) || defined(USE_APACHE_BUILD) +.elif defined(_APACHE_PORT_IS_MODULE) || defined(_APACHE_RUN_DEP) || defined(_APACHE_BUILD_DEP) APXS?= ${LOCALBASE}/sbin/apxs HTTPD?= ${LOCALBASE}/sbin/httpd @@ -280,16 +304,10 @@ .if exists(${HTTPD}) _APACHE_VERSION!= ${HTTPD} -v | ${SED} -ne 's/^Server version: Apache\/\([0-9]\)\.\([0-9]*\).*/\1\2/p' -.elif defined(APACHE_PORT) -_APACHE_VERSION!= ${ECHO_CMD} ${APACHE_PORT} | ${SED} -ne 's,.*/apache\([0-9]*\).*,\1,p' .endif -.if defined(USE_APACHE) -_USE_APACHE:= ${USE_APACHE} -.elif defined(USE_APACHE_BUILD) -_USE_APACHE:= ${USE_APACHE_BUILD} -.elif defined(USE_APACHE_RUN) -_USE_APACHE:= ${USE_APACHE_RUN} +.if defined(_APACHE_ARGS) +_USE_APACHE:= ${_APACHE_ARGS:S/.//g} .endif _APACHE_VERSION_CHECK:= ${_USE_APACHE:C/^([1-9][0-9])$/\1-\1/} @@ -305,7 +323,7 @@ # -num .elif ${_USE_APACHE:M\-[0-9][0-9]} -.for _v in ${APACHE_SUPPORTED_VERSION:O} +.for _v in ${_APACHE_VERSIONS:O} . if ${_APACHE_VERSION_MAXIMUM} >= ${_v} _APACHE_WANTED_VERSIONS+= ${_v} . endif @@ -313,7 +331,7 @@ # num-num .elif ${_USE_APACHE:M[0-9][0-9]-[0-9][0-9]} -.for _v in ${APACHE_SUPPORTED_VERSION} +.for _v in ${_APACHE_VERSIONS} . if ${_APACHE_VERSION_MINIMUM} <= ${_v} && ${_APACHE_VERSION_MAXIMUM} >= ${_v} _APACHE_WANTED_VERSIONS+= ${_v} . endif @@ -382,11 +400,11 @@ PKGNAMEPREFIX?= ${APACHE_PKGNAMEPREFIX} .endif -.if defined(USE_APACHE) || defined(USE_APACHE_BUILD) +.if defined(_APACHE_BUILD_DEP) BUILD_DEPENDS+= ${APXS}:${APACHE_PORT} .endif -.if defined(USE_APACHE) || defined(USE_APACHE_RUN) +.if defined(_APACHE_RUN_DEP) RUN_DEPENDS+= ${APXS}:${APACHE_PORT} .endif @@ -404,41 +422,17 @@ AP_EXTRAS+= -L ${AP_LIB} .endif -.endif # End of AP_PORT_IS_SERVER / AP_PORT_IS_MOULE -.endif # End of !Apache_Pre_Include +.endif # End of _APACHE_PORT_IS_SERVER / _APACHE_PORT_IS_MOULE +.endif # End of !_INCLUDE_USES_APACHE_PRE_MK # =============================================================== -.if defined(_POSTMKINCLUDED) && !defined(Apache_Post_Include) -Apache_Post_Include= bsd.apache.mk - -.if defined(USE_APACHE_RUN) && !empty(USE_APACHE_RUN) -. if ${USE_APACHE_RUN:C/\-//:S/^22//:S/^24//:C/\+$//} != "" -IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_RUN ( ${USE_APACHE_RUN} ) -. endif -.elif defined(USE_APACHE_RUN) -IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_RUN ( no valid version specified ) -.endif - -.if defined(USE_APACHE_BUILD) && !empty(USE_APACHE_BUILD) -. if ${USE_APACHE_BUILD:C/\-//:S/^22//:S/^24//:C/\+$//} != "" -IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_BUILD ( ${USE_APACHE_BUILD} ) -. endif -.elif defined(USE_APACHE_BUILD) -IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_BUILD ( no valid version specified ) -.endif - -# Check if USE_APACHE(_BUILD|_RUN) are mixed together -.if defined(USE_APACHE) && ( defined(USE_APACHE_BUILD) || defined(USE_APACHE_RUN) ) -IGNORE= ${_ERROR_MSG} specify only one of: USE_APACHE USE_APACHE_BUILD USE_APACHE_RUN -.elif defined(USE_APACHE_BUILD) && defined(USE_APACHE_RUN) -IGNORE= ${_ERROR_MSG} use USE_APACHE instead of USE_APACHE_BUILD and USE_APACHE_RUN together -.endif - -.if defined(NO_BUILD) && defined(USE_APACHE) -BROKEN= If NO_BUILD is used, then USE_APACHE_RUN is sufficient. Please fix your Makefile +.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_APACHE_POST_MK) +_INCLUDE_USES_APACHE_POST_MK= apache.mk +.if defined(NO_BUILD) && !defined(_APACHE_RUN_DEP) +BROKEN= If NO_BUILD is used, then apache:run is sufficient. Please fix your Makefile .endif -.if defined(AP_PORT_IS_SERVER) +.if defined(_APACHE_PORT_IS_SERVER) .if !target(print-closest-mirrors) print-closest-mirrors: @${ECHO_MSG} -n "Fetching list of nearest mirror: " >&2 @@ -474,7 +468,7 @@ .endif .endif -.elif defined(AP_PORT_IS_MODULE) +.elif defined(_APACHE_PORT_IS_MODULE) .if defined(AP_MODENABLE) AP_MOD_EN= -a @@ -516,5 +510,5 @@ .endif .endif # defined(AP_FAST_BUILD) -.endif # defined(AP_PORT_IS_SERVER / AP_PORT_IS_MODULE) -.endif # defined(_POSTMKINCLUDED) && !defined(Apache_Post_Include) +.endif # defined(_APACHE_PORT_IS_SERVER / _APACHE_PORT_IS_MODULE) +.endif # defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_APACHE_PRE_MK) Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -434,8 +434,6 @@ # ${PREFIX}/etc/rc.d if ${PREFIX} is not /usr, otherwise they # will be installed in /etc/rc.d/ and added to the packing list. ## -# USE_APACHE - If set, this port relies on an apache webserver. -# # Conflict checking. Use if your port cannot be installed at the same time as # another package. # @@ -890,8 +888,8 @@ # SUB_LIST - List of "variable=value" pair for substitution in ${SUB_FILES} # Some pairs are added by default: eg. PREFIX=${PREFIX} # -# USE_LDCONFIG - If set to "yes", this adds ${PREFIX}/lib to the list of -# directories to be searched for shared libraries. +# USE_LDCONFIG - If set to "yes" or empty, this adds ${PREFIX}/lib to the list +# of directories to be searched for shared libraries. # Otherwise, this is a list of directories to be added to that # list. The directory names are written to # ${LOCALBASE}/libdata/ldconfig/${PKGBASE} which is then @@ -1369,8 +1367,12 @@ .include "${PORTSDIR}/Mk/bsd.ocaml.mk" .endif -.if defined(USE_APACHE) || defined(USE_APACHE_BUILD) || defined(USE_APACHE_RUN) -.include "${PORTSDIR}/Mk/bsd.apache.mk" +.if defined(USE_APACHE_BUILD) +USES+= apache:build,${USE_APACHE_BUILD:C/2/2./} +.elif defined(USE_APACHE_RUN) +USES+= apache:run,${USE_APACHE_RUN:C/2/2./} +.elif defined(USE_APACHE) +USES+= apache:${USE_APACHE:C/2/2./} .endif .if defined(USE_QT4) || defined(USE_QT5) @@ -1886,8 +1888,9 @@ .include "${PORTSDIR}/Mk/bsd.wx.mk" .endif -.if defined(USE_APACHE) || defined(USE_APACHE_BUILD) || defined(USE_APACHE_RUN) -.include "${PORTSDIR}/Mk/bsd.apache.mk" +.if defined(USE_APACHE) || defined(USE_APACHE_BUILD) || defined(USE_APACHE_RUN) \ + || ( defined(USES) && !empty(${USES:Mapache}) ) +_USES_POST+= apache .endif .if defined(USE_AUTOTOOLS) Index: Mk/bsd.sanity.mk =================================================================== --- Mk/bsd.sanity.mk +++ Mk/bsd.sanity.mk @@ -179,11 +179,11 @@ USE_PYTHON_PREFIX USE_BZIP2 USE_XZ USE_PGSQL NEED_ROOT \ UNIQUENAME LATEST_LINK USE_SQLITE USE_FIREBIRD USE_PHPEXT \ USE_ZENDEXT USE_PHP_BUILD USE_BDB PLIST_DIRSTRY USE_RCORDER \ - USE_OPENSSL + USE_OPENSSL APACHE_PORT SANITY_DEPRECATED= PYTHON_PKGNAMESUFFIX USE_AUTOTOOLS \ - USE_MYSQL WANT_MYSQL_VER \ - USE_PHPIZE WANT_PHP_CLI WANT_PHP_CGI WANT_PHP_MOD \ - WANT_PHP_WEB WANT_PHP_EMB + USE_MYSQL WANT_MYSQL_VER USE_PHPIZE WANT_PHP_CLI \ + WANT_PHP_CGI WANT_PHP_MOD WANT_PHP_WEB WANT_PHP_EMB \ + USE_APACHE USE_APACHE_BUILD USE_APACHE_RUN SANITY_NOTNEEDED= CMAKE_NINJA WX_UNICODE USE_AUTOTOOLS_ALT= USES=autoreconf and GNU_CONFIGURE=yes @@ -239,6 +239,10 @@ WANT_PHP_WEB_ALT= USES=php:web WANT_PHP_EMB_ALT= USES=php:embed USE_RCORDER_ALT= USE_RC_SUBR=${USE_RCORDER} +USE_APACHE_ALT= USES=apache:${USE_APACHE:S/2/2./} +USE_APACHE_BUILD_ALT= USES=apache:build,${USE_APACHE_BUILD:S/2/2./} +USE_APACHE_RUN_ALT= USES=apache:run,${USE_APACHE_RUN:S/2/2./} +APACHE_PORT_ALT= DEFAULT_VERSIONS+=apache=${APACHE_PORT:S/www\/apache//:S/2/2./} .for a in ${SANITY_DEPRECATED} .if defined(${a})