Annotation of pkgsrc/mk/apache.mk, Revision 1.9
1.9 ! sketch 1: # $NetBSD: apache.mk,v 1.8 2005/03/24 17:46:00 tv Exp $
1.1 erh 2: #
3: # This Makefile fragment handles Apache dependencies and make variables,
4: # and is meant to be included by packages that require Apache either at
5: # build-time or at run-time. apache.mk will:
6: #
1.9 ! sketch 7: # * set PKG_APACHE to the name of the apache web server used
1.1 erh 8: #
9: # * add a full dependency on the apache server
10: #
11: # * optionally add a full dependency on apr
12: #
13: # The available user variables are:
14: #
15: # PKG_APACHE_DEFAULT is a user-settable variable whose value is the default
1.7 seb 16: # apache server to use. Possible values are apache13 and apache2.
1.1 erh 17: # If there is already a version of apache installed this will have no
18: # effect.
19: #
20: # The available makefile variables are:
21: #
22: # PKG_APACHE_ACCEPTED is a package-settable list of servers that may be used as
23: # possible dependencies for the package. Possible values are the same as
24: # for PKG_APACHE_DEFAULT.
25: #
26: # USE_APR is used to note that the package requires the Apache Portable
27: # runtime to build and execute. This is only takes effect if apache2
28: # is chosen (by this file) as the web server to use. This adds a full
29: # dependency on apr.
30: #
31:
32: .if !defined(APACHE_MK)
33: APACHE_MK= # defined
34:
35: .include "../../mk/bsd.prefs.mk"
36:
37: PKG_APACHE_DEFAULT?= # empty
38:
1.7 seb 39: _PKG_APACHES?= apache13 apache2
1.1 erh 40:
41: .if defined(PKG_APACHE_ACCEPTED)
1.2 grant 42: . for _ap_ in ${PKG_APACHE_ACCEPTED}
43: . if !empty(_PKG_APACHES:M${_ap_})
44: _PKG_APACHE_ACCEPTED+= ${PKG_APACHE_ACCEPTED:M${_ap_}}
45: . endif
46: . endfor
1.1 erh 47: .endif
48:
49: _PKG_APACHE_ACCEPTED?= ${_PKG_APACHES}
50:
51: # Set the default apache for this platform.
52: #
53: .if !empty(PKG_APACHE_DEFAULT)
54: _PKG_APACHE_DEFAULT= ${PKG_APACHE_DEFAULT}
55: .endif
56: .if !defined(_PKG_APACHE_DEFAULT)
57: _PKG_APACHE_DEFAULT?= apache13
58: .endif
59:
1.2 grant 60: _APACHE_PKGBASE.apache13= apache-1\*
61: _APACHE_PKGBASE.apache2= apache-2\*
1.1 erh 62:
63: # Mark the acceptable apaches and check which apache packages are installed.
64: .for _ap_ in ${_PKG_APACHE_ACCEPTED}
65: _PKG_APACHE_OK.${_ap_}= yes
66: _PKG_APACHE_INSTALLED.${_ap_}!= \
67: if ${PKG_INFO} -qe ${_APACHE_PKGBASE.${_ap_}}; then \
68: ${ECHO} yes; \
69: else \
70: ${ECHO} no; \
71: fi
72: .endfor
73:
74: # Use one of the installed apaches,...
75: #
76: .if !defined(_PKG_APACHE)
77: . for _ap_ in ${_PKG_APACHE_ACCEPTED}
78: . if !empty(_PKG_APACHE_INSTALLED.${_ap_}:M[yY][eE][sS])
1.2 grant 79: _PKG_APACHE?= ${_ap_}
1.1 erh 80: . else
1.2 grant 81: _PKG_APACHE_FIRSTACCEPTED?= ${_ap_}
1.1 erh 82: . endif
83: . endfor
84: .endif
85: #
86: # ...otherwise, prefer the default one if it's accepted,...
87: #
88: .if !defined(_PKG_APACHE)
89: . if defined(_PKG_APACHE_OK.${_PKG_APACHE_DEFAULT}) && \
90: !empty(_PKG_APACHE_OK.${_PKG_APACHE_DEFAULT}:M[yY][eE][sS])
91: _PKG_APACHE= ${_PKG_APACHE_DEFAULT}
92: . endif
93: .endif
94: #
95: # ...otherwise, just use the first accepted apache.
96: #
97: .if !defined(_PKG_APACHE)
98: . if defined(_PKG_APACHE_FIRSTACCEPTED)
99: _PKG_APACHE= ${_PKG_APACHE_FIRSTACCEPTED}
100: . endif
101: .endif
102: #
103: # If there are no acceptable apaches, then generate an error.
104: #
105: .if !defined(_PKG_APACHE)
106: # force an error
107: PKG_FAIL_REASON= "no acceptable apache found"
108: _PKG_APACHE= "none"
109: .endif
110:
111: BUILDLINK_DEPENDS.apache13?= apache-1.3*
1.2 grant 112: BUILDLINK_DEPENDS.apache2?= apache-2*
1.1 erh 113:
114: .if ${_PKG_APACHE} == "apache13"
1.2 grant 115: _APACHE_PKGSRCDIR= ../../www/apache
1.1 erh 116: .elif ${_PKG_APACHE} == "apache2"
1.2 grant 117: _APACHE_PKGSRCDIR= ../../www/apache2
1.3 grant 118: _APACHE_BL_SRCDIR= ${_APACHE_PKGSRCDIR}
1.1 erh 119: .endif
120:
1.3 grant 121: _APACHE_BL_SRCDIR?= ../../www/apache
122:
1.1 erh 123: # Add a runtime dependency on the apache server.
124: # This may or may not create an actual dependency depending on
1.4 jlam 125: # what the apache buildlink[23].mk file does.
126: #
1.1 erh 127: .if defined(_APACHE_PKGSRCDIR)
1.8 tv 128: . include "${_APACHE_BL_SRCDIR}/buildlink3.mk"
1.1 erh 129: .endif
130:
131: # If we are building apache modules, then we might need a build-time
132: # dependency on apr, and the apache sources?
1.4 jlam 133: #
134: .if ${_PKG_APACHE} == "apache2"
135: . if defined(USE_APR) && !empty(USE_APR:M[yY][eE][sS])
1.8 tv 136: . include "../../devel/apr/buildlink3.mk"
1.2 grant 137: . endif
1.1 erh 138: .endif
139:
140: # PKG_APACHE is a publicly readable variable containing the name of the server
141: # we will be using.
142: #
143: PKG_APACHE:= ${_PKG_APACHE}
144: BUILD_DEFS+= PKG_APACHE
145:
146: .endif # APACHE_MK
CVSweb <webmaster@jp.NetBSD.org>