Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / apache.mk
blob703d24c628a5c31efda6348d4f9d8152b2e65391
1 # $NetBSD: apache.mk,v 1.26 2011/03/12 14:07:13 wiz Exp $
3 # This file is meant to be included by packages that require an apache
4 # web server.
6 # User-settable variables:
8 # PKG_APACHE_DEFAULT
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 apache24
14 # Package-settable variables:
16 # PKG_APACHE_ACCEPTED
17 # The list of apache packages that can be used as a dependency for
18 # the package.
20 # Possible values: (see PKG_APACHE_DEFAULT)
22 # USE_APR
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
25 # will be added.
27 # Variables defined by this file:
29 # PKG_APACHE
30 # The Apache version that is actually used.
32 # Possible values: (see PKG_APACHE_DEFAULT)
34 # APACHE_PKG_PREFIX
35 # The package name prefix for apache modules.
37 # Possible values: ap13 ap2 ap22 ap24
40 .if !defined(APACHE_MK)
41 APACHE_MK= # defined
43 _VARGROUPS+= apache
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}
56 USE_APR?= no
58 # The available apache packages:
59 _PKG_APACHES= apache13 apache2 apache22 apache24
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.[23]*
70 _APACHE_PKG_PREFIX.apache22= ap22
71 _APACHE_PKGSRCDIR.apache22= ../../www/apache22
73 _APACHE_PKGBASE.apache24= apache-2.[456789]*
74 _APACHE_PKG_PREFIX.apache24= ap24
75 _APACHE_PKGSRCDIR.apache24= ../../www/apache24
78 # Sanity checks.
81 .if empty(_PKG_APACHES:M${PKG_APACHE_DEFAULT})
82 PKG_FAIL_REASON+= "[apache.mk] Invalid apache package \""${PKG_APACHE_DEFAULT:Q}"\" in PKG_APACHE_DEFAULT."
83 PKG_APACHE_DEFAULT= apache2
84 .endif
86 .for _ap_ in ${PKG_APACHE_ACCEPTED}
87 . if empty(_PKG_APACHES:M${_ap_})
88 PKG_FAIL_REASON+= "[apache.mk] Invalid apache package \""${_ap_:Q}"\" in PKG_APACHE_ACCEPTED."
89 PKG_APACHE_ACCEPTED= # none
90 . endif
91 .endfor
93 # Mark the acceptable apaches and check which apache packages are installed.
94 .for _ap_ in ${PKG_APACHE_ACCEPTED}
95 _APACHE_OK.${_ap_}= yes
96 _APACHE_INSTALLED.${_ap_}!= \
97 if ${PKG_INFO} -qe ${_APACHE_PKGBASE.${_ap_}:Q}; then \
98 ${ECHO} yes; \
99 else \
100 ${ECHO} no; \
102 .endfor
103 .for ap in ${_PKG_APACHES}
104 _APACHE_OK.${ap}?= no
105 .endfor
107 .undef PKG_APACHE
109 # Use one of the installed apaches, ...
110 .for _ap_ in ${PKG_APACHE_ACCEPTED}
111 . if ${_APACHE_INSTALLED.${_ap_}} == "yes"
112 PKG_APACHE?= ${_ap_}
113 . endif
114 .endfor
116 # ... otherwise, prefer the default one if it's accepted, ...
117 .if ${_APACHE_OK.${PKG_APACHE_DEFAULT}} == "yes"
118 PKG_APACHE?= ${PKG_APACHE_DEFAULT}
119 .endif
121 # ... otherwise, just use the first accepted apache.
122 .for ap in ${PKG_APACHE_ACCEPTED}
123 PKG_APACHE?= ${ap}
124 .endfor
126 .if defined(PKG_APACHE)
127 . include "${_APACHE_PKGSRCDIR.${PKG_APACHE}}/buildlink3.mk"
128 .else
129 PKG_FAIL_REASON+= "[apache.mk] No acceptable apache package found."
130 PKG_APACHE= none
131 .endif
133 APACHE_PKG_PREFIX= ${_APACHE_PKG_PREFIX.${PKG_APACHE}}
135 .if (${PKG_APACHE} == "apache2") && !empty(USE_APR:M[yY][eE][sS])
136 . include "../../devel/apr0/buildlink3.mk"
137 .elif (${PKG_APACHE} != "apache13") && !empty(USE_APR:M[Yy][Ee][Ss])
138 . include "../../devel/apr/buildlink3.mk"
139 . include "../../devel/apr-util/buildlink3.mk"
140 .endif
143 # Variable assignment for multi-apache packages
144 MULTI+= PKG_APACHE=${PKG_APACHE}
146 .endif # APACHE_MK