1 # $NetBSD: apache.mk,v 1.24 2007/10/17 10:43:36 rillig Exp $
3 # This file is meant to be included by packages that require an apache
6 # User-settable variables:
9 # The default apache server to use and install. If there already
10 # is an apache installed, this will have no effect.
12 # Possible values: apache13 apache2 apache22
14 # Package-settable variables:
17 # The list of apache packages that can be used as a dependency for
20 # Possible values: (see PKG_APACHE_DEFAULT)
23 # If apache2 is chosen by this file and this variable is set to
24 # "yes", a full dependency to the Apache Portable Runtime library
27 # Variables defined by this file:
30 # The Apache version that is actually used.
32 # Possible values: (see PKG_APACHE_DEFAULT)
35 # The package name prefix for apache modules.
37 # Possible values: ap13 ap2 ap22
40 .if !defined(APACHE_MK)
44 _USER_VARS.apache= PKG_APACHE_DEFAULT
45 _PKG_VARS.apache= PKG_APACHE_ACCEPTED USE_APR
46 _SYS_VARS.apache= PKG_APACHE APACHE_PKG_PREFIX
48 .include "bsd.fast.prefs.mk"
50 PKG_APACHE_DEFAULT?= apache22
51 BUILD_DEFS+= PKG_APACHE_DEFAULT
52 BUILD_DEFS_EFFECTS+= PKG_APACHE APACHE_PKG_PREFIX
54 # Package-settable variables
55 PKG_APACHE_ACCEPTED?= ${_PKG_APACHES}
58 # The available apache packages:
59 _PKG_APACHES= apache13 apache2 apache22
61 _APACHE_PKGBASE.apache13= apache-1*
62 _APACHE_PKG_PREFIX.apache13= ap13
63 _APACHE_PKGSRCDIR.apache13= ../../www/apache
65 _APACHE_PKGBASE.apache2= apache-2.0*
66 _APACHE_PKG_PREFIX.apache2= ap2
67 _APACHE_PKGSRCDIR.apache2= ../../www/apache2
69 _APACHE_PKGBASE.apache22= apache-2.[23456789]*
70 _APACHE_PKG_PREFIX.apache22= ap22
71 _APACHE_PKGSRCDIR.apache22= ../../www/apache22
77 .if empty(_PKG_APACHES:M${PKG_APACHE_DEFAULT})
78 PKG_FAIL_REASON+= "[apache.mk] Invalid apache package \""${PKG_APACHE_DEFAULT:Q}"\" in PKG_APACHE_DEFAULT."
79 PKG_APACHE_DEFAULT= apache2
82 .for _ap_ in ${PKG_APACHE_ACCEPTED}
83 . if empty(_PKG_APACHES:M${_ap_})
84 PKG_FAIL_REASON+= "[apache.mk] Invalid apache package \""${_ap_:Q}"\" in PKG_APACHE_ACCEPTED."
85 PKG_APACHE_ACCEPTED= # none
89 # Mark the acceptable apaches and check which apache packages are installed.
90 .for _ap_ in ${PKG_APACHE_ACCEPTED}
91 _APACHE_OK.${_ap_}= yes
92 _APACHE_INSTALLED.${_ap_}!= \
93 if ${PKG_INFO} -qe ${_APACHE_PKGBASE.${_ap_}:Q}; then \
99 .for ap in ${_PKG_APACHES}
100 _APACHE_OK.${ap}?= no
105 # Use one of the installed apaches, ...
106 .for _ap_ in ${PKG_APACHE_ACCEPTED}
107 . if ${_APACHE_INSTALLED.${_ap_}} == "yes"
112 # ... otherwise, prefer the default one if it's accepted, ...
113 .if ${_APACHE_OK.${PKG_APACHE_DEFAULT}} == "yes"
114 PKG_APACHE?= ${PKG_APACHE_DEFAULT}
117 # ... otherwise, just use the first accepted apache.
118 .for ap in ${PKG_APACHE_ACCEPTED}
122 .if defined(PKG_APACHE)
123 . include "${_APACHE_PKGSRCDIR.${PKG_APACHE}}/buildlink3.mk"
125 PKG_FAIL_REASON+= "[apache.mk] No acceptable apache package found."
129 APACHE_PKG_PREFIX= ${_APACHE_PKG_PREFIX.${PKG_APACHE}}
131 .if (${PKG_APACHE} == "apache2") && !empty(USE_APR:M[yY][eE][sS])
132 . include "../../devel/apr0/buildlink3.mk"
133 .elif (${PKG_APACHE} == "apache22") && !empty(USE_APR:M[Yy][Ee][Ss])
134 . include "../../devel/apr/buildlink3.mk"
135 . include "../../devel/apr-util/buildlink3.mk"