| 1 | # Copyright 2004 Gentoo Foundation |
1 | # Copyright 1999-2011 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License, v2 or later |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # Author Michael Tindal <urilith@gentoo.org> |
|
|
| 4 | # $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.10 2005/07/06 20:20:03 agriffis Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/apache-module.eclass,v 1.25 2011/12/27 17:55:12 fauli Exp $ |
| 5 | INHERITED="$INHERITED $ECLASS" |
4 | |
|
|
5 | # @ECLASS: apache-module.eclass |
|
|
6 | # @MAINTAINER: |
|
|
7 | # apache-devs@gentoo.org |
|
|
8 | # @BLURB: Provides a common set of functions for apache modules |
|
|
9 | # @DESCRIPTION: |
|
|
10 | # This eclass handles apache modules in a sane way. |
|
|
11 | # |
|
|
12 | # To make use of this eclass simply call one of the need/want_apache functions |
|
|
13 | # described in depend.apache.eclass. Make sure you use the need/want_apache call |
|
|
14 | # after you have defined DEPEND and RDEPEND. Also note that you can not rely on |
|
|
15 | # the automatic RDEPEND=DEPEND that portage does if you use this eclass. |
|
|
16 | # |
|
|
17 | # See Bug 107127 for more information. |
|
|
18 | # |
|
|
19 | # @EXAMPLE: |
|
|
20 | # |
|
|
21 | # Here is a simple example of an ebuild for mod_foo: |
|
|
22 | # |
|
|
23 | # @CODE |
|
|
24 | # APACHE2_MOD_CONF="42_mod_foo" |
|
|
25 | # APACHE2_MOD_DEFINE="FOO" |
|
|
26 | # need_apache2 |
|
|
27 | # @CODE |
|
|
28 | # |
|
|
29 | # A more complicated example for a module with non-standard locations: |
|
|
30 | # |
|
|
31 | # @CODE |
|
|
32 | # APXS2_S="${S}/apache22/src" |
|
|
33 | # APACHE2_MOD_FILE="${APXS2_S}/${PN}.so" |
|
|
34 | # APACHE2_MOD_CONF="42_${PN}" |
|
|
35 | # APACHE2_MOD_DEFINE="FOO" |
|
|
36 | # DOCFILES="docs/*.html" |
|
|
37 | # need_apache2_2 |
|
|
38 | # @CODE |
|
|
39 | # |
|
|
40 | # A basic module configuration which just loads the module into apache: |
|
|
41 | # |
|
|
42 | # @CODE |
|
|
43 | # <IfDefine FOO> |
|
|
44 | # LoadModule foo_module modules/mod_foo.so |
|
|
45 | # </IfDefine> |
|
|
46 | # @CODE |
| 6 | |
47 | |
| 7 | inherit depend.apache |
48 | inherit depend.apache |
| 8 | |
49 | |
| 9 | # This eclass provides a common set of functions for Apache modules. |
50 | # ============================================================================== |
|
|
51 | # PUBLIC VARIABLES |
|
|
52 | # ============================================================================== |
| 10 | |
53 | |
| 11 | ###### |
54 | # @VARIABLE: APXS2_S |
| 12 | ## Common ebuild variables |
55 | # @DESCRIPTION: |
| 13 | ###### |
56 | # Path to temporary build directory. (Defaults to `${S}/src' if it exists, |
|
|
57 | # `${S}' otherwise) |
| 14 | |
58 | |
| 15 | #### |
59 | # @VARIABLE: APXS2_ARGS |
| 16 | ## APXS1_S, APXS2_S |
60 | # @DESCRIPTION: |
| 17 | ## |
61 | # Arguments to pass to the apxs tool. (Defaults to `-c ${PN}.c') |
| 18 | ## Paths to temporary build directories |
|
|
| 19 | #### |
|
|
| 20 | APXS1_S="" |
|
|
| 21 | APXS2_S="" |
|
|
| 22 | |
62 | |
| 23 | #### |
63 | # @VARIABLE: APACHE2_EXECFILES |
| 24 | ## APXS1_ARGS, APXS2_ARGS |
64 | # @DESCRIPTION: |
| 25 | ## |
65 | # List of files that will be installed into ${APACHE_MODULE_DIR} beside |
| 26 | ## Arguments to pass to the apxs tool |
66 | # ${APACHE2_MOD_FILE}. In addition, this function also sets the executable |
| 27 | #### |
67 | # permission on those files. |
| 28 | APXS1_ARGS="" |
|
|
| 29 | APXS2_ARGS="" |
|
|
| 30 | |
68 | |
| 31 | #### |
69 | # @VARIABLE: APACHE2_MOD_CONF |
| 32 | ## APACHE1_MOD_FILE, APACHE2_MOD_FILE |
70 | # @DESCRIPTION: |
| 33 | ## |
71 | # Module configuration file installed by src_install (minus the .conf suffix and |
| 34 | ## Name of the module that src_install installs (only, minus the .so) |
72 | # relative to ${FILESDIR}). |
| 35 | #### |
|
|
| 36 | APACHE1_MOD_FILE="" |
|
|
| 37 | APACHE2_MOD_FILE="" |
|
|
| 38 | |
73 | |
| 39 | #### |
74 | # @VARIABLE: APACHE2_MOD_DEFINE |
| 40 | ## APACHE1_MOD_CONF, APACHE2_MOD_CONF |
75 | # @DESCRIPTION: |
| 41 | ## |
|
|
| 42 | ## Configuration file installed by src_install |
|
|
| 43 | #### |
|
|
| 44 | APACHE1_MOD_CONF="" |
|
|
| 45 | APACHE2_MOD_CONF="" |
|
|
| 46 | |
|
|
| 47 | #### |
|
|
| 48 | ## APACHE1_MOD_DEFINE, APACHE2_MOD_DEFINE |
|
|
| 49 | ## |
|
|
| 50 | ## Name of define (eg FOO) to use in conditional loading of the installed |
76 | # Name of define (e.g. FOO) to use in conditional loading of the installed |
| 51 | ## module/it's config file |
77 | # module/its config file, multiple defines should be space separated. |
| 52 | #### |
|
|
| 53 | APACHE1_MOD_DEFINE="" |
|
|
| 54 | APACHE2_MOD_DEFINE="" |
|
|
| 55 | |
78 | |
| 56 | #### |
79 | # @VARIABLE: APACHE2_MOD_FILE |
| 57 | ## DOCFILES |
80 | # @DESCRIPTION: |
| 58 | ## |
81 | # Name of the module that src_install installs minus the .so suffix. (Defaults |
|
|
82 | # to `${APXS2_S}/.libs/${PN}.so') |
|
|
83 | |
|
|
84 | # @VARIABLE: APACHE2_VHOST_CONF |
|
|
85 | # @DESCRIPTION: |
|
|
86 | # Virtual host configuration file installed by src_install (minus the .conf |
|
|
87 | # suffix and relative to ${FILESDIR}). |
|
|
88 | |
|
|
89 | # @VARIABLE: DOCFILES |
|
|
90 | # @DESCRIPTION: |
| 59 | ## If the exported src_install() is being used, and ${DOCFILES} is non-zero, |
91 | # If the exported src_install() is being used, and ${DOCFILES} is non-zero, some |
| 60 | ## some sed-fu is applied to split out html documentation (if any) from normal |
92 | # sed-fu is applied to split out html documentation (if any) from normal |
| 61 | ## documentation, and dodoc'd or dohtml'd |
93 | # documentation, and dodoc'd or dohtml'd. |
| 62 | #### |
|
|
| 63 | DOCFILES="" |
|
|
| 64 | |
94 | |
| 65 | ###### |
95 | # ============================================================================== |
| 66 | ## Utility functions |
96 | # INTERNAL FUNCTIONS |
| 67 | ###### |
97 | # ============================================================================== |
| 68 | |
98 | |
| 69 | #### |
99 | # Internal function to construct the default ${APXS2_S} path if required. |
| 70 | ## apache_cd_dir |
|
|
| 71 | ## |
|
|
| 72 | ## Return the path to our temporary build dir |
|
|
| 73 | #### |
|
|
| 74 | apache_cd_dir() { |
100 | apache_cd_dir() { |
| 75 | debug-print-function apache_cd_dir |
101 | debug-print-function $FUNCNAME $* |
| 76 | |
102 | |
| 77 | if [ "${APACHE_VERSION}" == "1" ]; then |
103 | local CD_DIR="${APXS2_S}" |
| 78 | [ -n "${APXS1_S}" ] && CD_DIR="${APXS1_S}" |
|
|
| 79 | else |
|
|
| 80 | [ -n "${APXS2_S}" ] && CD_DIR="${APXS2_S}" |
|
|
| 81 | fi |
|
|
| 82 | |
104 | |
| 83 | # XXX - is this really needed? can't we just return ${S}? |
|
|
| 84 | if [ -z "${CD_DIR}" ]; then |
105 | if [[ -z "${CD_DIR}" ]] ; then |
| 85 | if [ -d ${S}/src ] ; then |
106 | if [[ -d "${S}/src" ]] ; then |
| 86 | CD_DIR="${S}/src" |
107 | CD_DIR="${S}/src" |
| 87 | else |
108 | else |
| 88 | CD_DIR="${S}" |
109 | CD_DIR="${S}" |
| 89 | fi |
110 | fi |
| 90 | fi |
111 | fi |
| 91 | |
112 | |
| 92 | debug-print apache_cd_dir: "CD_DIR=${CD_DIR}" |
113 | debug-print $FUNCNAME "CD_DIR=${CD_DIR}" |
| 93 | echo ${CD_DIR} |
114 | echo "${CD_DIR}" |
| 94 | } |
115 | } |
| 95 | |
116 | |
| 96 | #### |
117 | # Internal function to construct the default ${APACHE2_MOD_FILE} if required. |
| 97 | ## apache_mod_file |
|
|
| 98 | ## |
|
|
| 99 | ## Return the path to the module file |
|
|
| 100 | #### |
|
|
| 101 | apache_mod_file() { |
118 | apache_mod_file() { |
| 102 | debug-print-function apache_mod_file |
119 | debug-print-function $FUNCNAME $* |
| 103 | |
120 | |
| 104 | if [ "${APACHE_VERSION}" == "1" ]; then |
121 | local MOD_FILE="${APACHE2_MOD_FILE:-$(apache_cd_dir)/.libs/${PN}.so}" |
| 105 | [ -n "${APACHE1_MOD_FILE}" ] && MOD_FILE="${APACHE1_MOD_FILE}" |
|
|
| 106 | [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/${PN}.so" |
|
|
| 107 | else |
|
|
| 108 | [ -n "${APACHE2_MOD_FILE}" ] && MOD_FILE="${APACHE2_MOD_FILE}" |
|
|
| 109 | [ -z "${MOD_FILE}" ] && MOD_FILE="$(apache_cd_dir)/.libs/${PN}.so" |
|
|
| 110 | fi |
|
|
| 111 | |
122 | |
| 112 | debug-print apache_mod_file: MOD_FILE=${MOD_FILE} |
123 | debug-print $FUNCNAME "MOD_FILE=${MOD_FILE}" |
| 113 | echo ${MOD_FILE} |
124 | echo "${MOD_FILE}" |
| 114 | } |
125 | } |
| 115 | |
126 | |
| 116 | #### |
|
|
| 117 | ## apache_doc_magic |
|
|
| 118 | ## |
|
|
| 119 | ## Some magic for picking out html files from ${DOCFILES}. It takes |
127 | # Internal function for picking out html files from ${DOCFILES}. It takes an |
| 120 | ## an optional first argument `html'; if the first argument is equals |
128 | # optional first argument `html'; if the first argument is equals `html', only |
| 121 | ## `html', only html files are returned, otherwise normal (non-html) |
129 | # html files are returned, otherwise normal (non-html) docs are returned. |
| 122 | ## docs are returned. |
|
|
| 123 | #### |
|
|
| 124 | apache_doc_magic() { |
130 | apache_doc_magic() { |
| 125 | debug-print-function apache_doc_magic $* |
131 | debug-print-function $FUNCNAME $* |
| 126 | |
132 | |
|
|
133 | local DOCS= |
|
|
134 | |
| 127 | if [ -n "${DOCFILES}" ]; then |
135 | if [[ -n "${DOCFILES}" ]] ; then |
| 128 | if [ "x$1" == "xhtml" ]; then |
136 | if [[ "x$1" == "xhtml" ]] ; then |
| 129 | DOCS="`echo ${DOCFILES} | sed -e 's/ /\n/g' | sed -e '/^[^ ]*.html$/ !d'`" |
137 | DOCS="`echo ${DOCFILES} | sed -e 's/ /\n/g' | sed -e '/^[^ ]*.html$/ !d'`" |
| 130 | else |
138 | else |
| 131 | DOCS="`echo ${DOCFILES} | sed 's, *[^ ]*\+.html, ,g'`" |
139 | DOCS="`echo ${DOCFILES} | sed 's, *[^ ]*\+.html, ,g'`" |
| 132 | fi |
140 | fi |
|
|
141 | fi |
| 133 | |
142 | |
| 134 | debug-print apache_doc_magic: DOCS=${DOCS} |
143 | debug-print $FUNCNAME "DOCS=${DOCS}" |
| 135 | echo ${DOCS} |
144 | echo "${DOCS}" |
| 136 | fi |
|
|
| 137 | } |
145 | } |
| 138 | |
146 | |
| 139 | ###### |
147 | # ============================================================================== |
| 140 | ## Apache 1.x ebuild functions |
148 | # EXPORTED FUNCTIONS |
| 141 | ###### |
149 | # ============================================================================== |
| 142 | |
150 | |
| 143 | #### |
151 | # @FUNCTION: apache-module_src_compile |
| 144 | ## apache1_src_compile |
152 | # @DESCRIPTION: |
| 145 | ## The default action is to call ${APXS11} with the value of |
153 | # The default action is to call ${APXS} with the value of ${APXS2_ARGS}. If a |
| 146 | ## ${APXS1_ARGS}. If a module requires a different build setup |
154 | # module requires a different build setup than this, use ${APXS} in your own |
| 147 | ## than this, use ${APXS1} in your own src_compile routine. |
155 | # src_compile routine. |
| 148 | #### |
|
|
| 149 | apache1_src_compile() { |
156 | apache-module_src_compile() { |
| 150 | debug-print-function apache1_src_compile |
157 | debug-print-function $FUNCNAME $* |
| 151 | |
158 | |
| 152 | CD_DIR=$(apache_cd_dir) |
159 | local CD_DIR=$(apache_cd_dir) |
| 153 | cd ${CD_DIR} || die "cd ${CD_DIR} failed" |
160 | cd "${CD_DIR}" || die "cd ${CD_DIR} failed" |
|
|
161 | |
| 154 | APXS1_ARGS="${APXS1_ARGS:--c ${PN}.c}" |
162 | APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}" |
| 155 | ${APXS1} ${APXS1_ARGS} || die "${APXS1} ${APXS1_ARGS} failed" |
163 | ${APXS} ${APXS2_ARGS} || die "${APXS} ${APXS2_ARGS} failed" |
| 156 | } |
164 | } |
| 157 | |
165 | |
| 158 | #### |
166 | # @FUNCTION: apache-module_src_install |
| 159 | ## apache1_src_install |
167 | # @DESCRIPTION: |
| 160 | ## |
|
|
| 161 | ## This installs the files into apache's directories. The module is installed |
168 | # This installs the files into apache's directories. The module is installed |
| 162 | ## from a directory chosen as above (APXS2_S or ${S}/src). In addition, |
169 | # from a directory chosen as above (apache_cd_dir). In addition, this function |
| 163 | ## this function can also set the executable permission on files listed in EXECFILES. |
170 | # can also set the executable permission on files listed in |
| 164 | ## The configuration file name is listed in APACHE1_MOD_CONF without the .conf extensions, |
171 | # ${APACHE2_EXECFILES}. The configuration file name is listed in |
| 165 | ## so if you configuration is 55_mod_foo.conf, APACHE1_MOD_CONF would be 55_mod_foo. |
172 | # ${APACHE2_MOD_CONF} without the .conf extensions, so if you configuration is |
| 166 | ## DOCFILES contains the list of files you want filed as documentation. The name of the |
173 | # 55_mod_foo.conf, APACHE2_MOD_CONF would be 55_mod_foo. ${DOCFILES} contains |
| 167 | ## module can also be specified using the APACHE1_MOD_FILE or defaults to |
174 | # the list of files you want filed as documentation. |
| 168 | ## .libs/${PN}.so. |
|
|
| 169 | #### |
|
|
| 170 | apache1_src_install() { |
175 | apache-module_src_install() { |
| 171 | debug-print-function apache1_src_install |
176 | debug-print-function $FUNCNAME $* |
| 172 | |
177 | |
| 173 | CD_DIR=$(apache_cd_dir) |
178 | local CD_DIR=$(apache_cd_dir) |
| 174 | cd ${CD_DIR} || die "cd ${CD_DIR} failed" |
179 | cd "${CD_DIR}" || die "cd ${CD_DIR} failed" |
| 175 | |
180 | |
| 176 | MOD_FILE=$(apache_mod_file) |
181 | local MOD_FILE=$(apache_mod_file) |
| 177 | |
182 | |
| 178 | exeinto ${APACHE1_MODULESDIR} |
183 | exeinto "${APACHE_MODULESDIR}" |
| 179 | doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found" |
184 | doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found" |
| 180 | [ -n "${APACHE1_EXECFILES}" ] && doexe ${APACHE1_EXECFILES} |
185 | [[ -n "${APACHE2_EXECFILES}" ]] && doexe ${APACHE2_EXECFILES} |
| 181 | |
186 | |
| 182 | if [ -n "${APACHE1_MOD_CONF}" ] ; then |
187 | if [[ -n "${APACHE2_MOD_CONF}" ]] ; then |
| 183 | insinto ${APACHE1_MODULES_CONFDIR} |
188 | insinto "${APACHE_MODULES_CONFDIR}" |
| 184 | doins ${FILESDIR}/${APACHE1_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE1_MOD_CONF}.conf' not found." |
189 | set -- ${APACHE2_MOD_CONF} |
|
|
190 | newins "${FILESDIR}/${1}.conf" "$(basename ${2:-$1}).conf" \ |
|
|
191 | || die "internal ebuild error: '${FILESDIR}/${1}.conf' not found" |
| 185 | fi |
192 | fi |
| 186 | |
193 | |
|
|
194 | if [[ -n "${APACHE2_VHOST_CONF}" ]] ; then |
|
|
195 | insinto "${APACHE_VHOSTS_CONFDIR}" |
|
|
196 | set -- ${APACHE2_VHOST_CONF} |
|
|
197 | newins "${FILESDIR}/${1}.conf" "$(basename ${2:-$1}).conf " \ |
|
|
198 | || die "internal ebuild error: '${FILESDIR}/${1}.conf' not found" |
|
|
199 | fi |
|
|
200 | |
| 187 | cd ${S} |
201 | cd "${S}" |
| 188 | |
202 | |
| 189 | if [ -n "${DOCFILES}" ] ; then |
203 | if [[ -n "${DOCFILES}" ]] ; then |
| 190 | OTHER_DOCS=$(apache_doc_magic) |
204 | local OTHER_DOCS=$(apache_doc_magic) |
| 191 | HTML_DOCS=$(apache_doc_magic html) |
205 | local HTML_DOCS=$(apache_doc_magic html) |
| 192 | |
206 | |
| 193 | [ -n "${OTHER_DOCS}" ] && dodoc ${OTHER_DOCS} |
207 | [[ -n "${OTHER_DOCS}" ]] && dodoc ${OTHER_DOCS} |
| 194 | [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS} |
208 | [[ -n "${HTML_DOCS}" ]] && dohtml ${HTML_DOCS} |
| 195 | fi |
209 | fi |
| 196 | } |
210 | } |
| 197 | |
211 | |
| 198 | #### |
212 | # @FUNCTION: apache-module_pkg_postinst |
| 199 | ## apache1_pkg_postinst |
213 | # @DESCRIPTION: |
| 200 | ## |
214 | # This prints out information about the installed module and how to enable it. |
| 201 | ## Prints the standard config message, unless APACHE1_NO_CONFIG is set to yes. |
|
|
| 202 | #### |
|
|
| 203 | apache1_pkg_postinst() { |
215 | apache-module_pkg_postinst() { |
| 204 | debug-print-function apache1_pkg_postinst |
216 | debug-print-function $FUNCNAME $* |
| 205 | |
217 | |
| 206 | if [ -n "${APACHE1_MOD_DEFINE}" ]; then |
218 | if [[ -n "${APACHE2_MOD_DEFINE}" ]] ; then |
|
|
219 | local my_opts="-D ${APACHE2_MOD_DEFINE// / -D }" |
|
|
220 | |
| 207 | einfo |
221 | einfo |
| 208 | einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache file and" |
222 | einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and" |
| 209 | einfo "add '-D ${APACHE1_MOD_DEFINE}' to APACHE_OPTS." |
223 | einfo "add '${my_opts}' to APACHE2_OPTS." |
| 210 | einfo |
224 | einfo |
| 211 | fi |
225 | fi |
|
|
226 | |
| 212 | if [ -n "${APACHE1_MOD_CONF}" ] ; then |
227 | if [[ -n "${APACHE2_MOD_CONF}" ]] ; then |
|
|
228 | set -- ${APACHE2_MOD_CONF} |
| 213 | einfo |
229 | einfo |
| 214 | einfo "Configuration file installed as" |
230 | einfo "Configuration file installed as" |
| 215 | einfo " ${APACHE1_MODULES_CONFDIR}/$(basename ${APACHE1_MOD_CONF}).conf" |
231 | einfo " ${APACHE_MODULES_CONFDIR}/$(basename ${2:-$1}).conf" |
| 216 | einfo "You may want to edit it before turning the module on in /etc/conf.d/apache" |
|
|
| 217 | einfo |
|
|
| 218 | fi |
|
|
| 219 | } |
|
|
| 220 | |
|
|
| 221 | ###### |
|
|
| 222 | ## Apache 2.x ebuild functions |
|
|
| 223 | ###### |
|
|
| 224 | |
|
|
| 225 | #### |
|
|
| 226 | ## apache2_pkg_setup |
|
|
| 227 | ## |
|
|
| 228 | ## Checks to see if APACHE2_MT_UNSAFE is set to anything other than "no". If it is, then |
|
|
| 229 | ## we check what the MPM style used by Apache is, if it isnt prefork, we let the user |
|
|
| 230 | ## know they need prefork, and then exit the build. |
|
|
| 231 | #### |
|
|
| 232 | apache2_pkg_setup() { |
|
|
| 233 | debug-print-function apache2_pkg_setup |
|
|
| 234 | |
|
|
| 235 | if [ -n "${APACHE2_SAFE_MPMS}" ]; then |
|
|
| 236 | |
|
|
| 237 | INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)" |
|
|
| 238 | |
|
|
| 239 | if hasq ${INSTALLED_MPM} ${APACHE2_SAFE_MPMS} ; then |
|
|
| 240 | INSTALLED_MPM_SAFE="yes" |
|
|
| 241 | fi |
|
|
| 242 | |
|
|
| 243 | if [ -z "${INSTALLED_MPM_SAFE}" ] ; then |
|
|
| 244 | eerror "The module you are trying to install (${PN})" |
|
|
| 245 | eerror "will only work with one of the following MPMs:" |
|
|
| 246 | eerror " ${APACHE2_SAFE_MPMS}" |
|
|
| 247 | eerror "You do not currently have any of these MPMs installed." |
|
|
| 248 | eerror "Please re-install apache with the correct mpm-* USE flag set." |
|
|
| 249 | die "No safe MPM installed." |
|
|
| 250 | fi |
|
|
| 251 | |
|
|
| 252 | fi |
|
|
| 253 | |
|
|
| 254 | } |
|
|
| 255 | |
|
|
| 256 | #### |
|
|
| 257 | ## apache2_src_compile |
|
|
| 258 | ## |
|
|
| 259 | ## The default action is to call ${APXS2} with the value of |
|
|
| 260 | ## ${APXS2_ARGS}. If a module requires a different build setup |
|
|
| 261 | ## than this, use ${APXS2} in your own src_compile routine. |
|
|
| 262 | #### |
|
|
| 263 | apache2_src_compile() { |
|
|
| 264 | debug-print-function apache2_src_compile |
|
|
| 265 | |
|
|
| 266 | CD_DIR=$(apache_cd_dir) |
|
|
| 267 | cd ${CD_DIR} || die "cd ${CD_DIR} failed" |
|
|
| 268 | APXS2_ARGS="${APXS2_ARGS:--c ${PN}.c}" |
|
|
| 269 | ${APXS2} ${APXS2_ARGS} || die "${APXS2} ${APXS2_ARGS} failed" |
|
|
| 270 | } |
|
|
| 271 | |
|
|
| 272 | #### |
|
|
| 273 | ## apache2_src_install |
|
|
| 274 | ## |
|
|
| 275 | ## This installs the files into apache's directories. The module is installed |
|
|
| 276 | ## from a directory chosen as above (APXS2_S or ${S}/src). In addition, |
|
|
| 277 | ## this function can also set the executable permission on files listed in EXECFILES. |
|
|
| 278 | ## The configuration file name is listed in CONFFILE without the .conf extensions, |
|
|
| 279 | ## so if you configuration is 55_mod_foo.conf, CONFFILE would be 55_mod_foo. |
|
|
| 280 | ## DOCFILES contains the list of files you want filed as documentation. |
|
|
| 281 | #### |
|
|
| 282 | apache2_src_install() { |
|
|
| 283 | debug-print-function apache2_src_install |
|
|
| 284 | |
|
|
| 285 | CD_DIR=$(apache_cd_dir) |
|
|
| 286 | cd ${CD_DIR} || die "cd ${CD_DIR} failed" |
|
|
| 287 | |
|
|
| 288 | MOD_FILE=$(apache_mod_file) |
|
|
| 289 | |
|
|
| 290 | exeinto ${APACHE2_MODULESDIR} |
|
|
| 291 | doexe ${MOD_FILE} || die "internal ebuild error: '${MOD_FILE}' not found" |
|
|
| 292 | [ -n "${APACHE2_EXECFILES}" ] && doexe ${APACHE2_EXECFILES} |
|
|
| 293 | |
|
|
| 294 | if [ -n "${APACHE2_MOD_CONF}" ] ; then |
|
|
| 295 | insinto ${APACHE2_MODULES_CONFDIR} |
|
|
| 296 | doins ${FILESDIR}/${APACHE2_MOD_CONF}.conf || die "internal ebuild error: '${FILESDIR}/${APACHE2_MOD_CONF}.conf' not found." |
|
|
| 297 | fi |
|
|
| 298 | |
|
|
| 299 | if [ -n "${APACHE2_VHOSTFILE}" ]; then |
|
|
| 300 | insinto ${APACHE2_MODULES_VHOSTDIR} |
|
|
| 301 | doins ${FILESDIR}/${APACHE2_VHOSTFILE}.conf |
|
|
| 302 | fi |
|
|
| 303 | |
|
|
| 304 | cd ${S} |
|
|
| 305 | |
|
|
| 306 | if [ -n "${DOCFILES}" ] ; then |
|
|
| 307 | OTHER_DOCS=$(apache_doc_magic) |
|
|
| 308 | HTML_DOCS=$(apache_doc_magic html) |
|
|
| 309 | |
|
|
| 310 | [ -n "${OTHER_DOCS}" ] && dodoc ${OTHER_DOCS} |
|
|
| 311 | [ -n "${HTML_DOCS}" ] && dohtml ${HTML_DOCS} |
|
|
| 312 | fi |
|
|
| 313 | } |
|
|
| 314 | |
|
|
| 315 | apache2_pkg_postinst() { |
|
|
| 316 | debug-print-function apache2_pkg_postinst |
|
|
| 317 | |
|
|
| 318 | if [ -n "${APACHE2_MOD_DEFINE}" ]; then |
|
|
| 319 | einfo |
|
|
| 320 | einfo "To enable ${PN}, you need to edit your /etc/conf.d/apache2 file and" |
|
|
| 321 | einfo "add '-D ${APACHE2_MOD_DEFINE}' to APACHE2_OPTS." |
|
|
| 322 | einfo |
|
|
| 323 | fi |
|
|
| 324 | if [ -n "${APACHE2_MOD_CONF}" ] ; then |
|
|
| 325 | einfo |
|
|
| 326 | einfo "Configuration file installed as" |
|
|
| 327 | einfo " ${APACHE2_MODULES_CONFDIR}/$(basename ${APACHE2_MOD_CONF}).conf" |
|
|
| 328 | einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2" |
232 | einfo "You may want to edit it before turning the module on in /etc/conf.d/apache2" |
| 329 | einfo |
233 | einfo |
| 330 | fi |
234 | fi |
| 331 | |
|
|
| 332 | if [ -n "${APACHE2_SAFE_MPMS}" ]; then |
|
|
| 333 | |
|
|
| 334 | INSTALLED_MPM="$(${ROOT}/usr/sbin/apxs2 -q MPM_NAME)" |
|
|
| 335 | |
|
|
| 336 | if ! hasq ${INSTALLED_MPM} ${APACHE2_SAFE_MPMS} ; then |
|
|
| 337 | INSTALLED_MPM_UNSAFE="${INSTALLED_MPM_UNSAFE} ${mpm}" |
|
|
| 338 | else |
|
|
| 339 | INSTALLED_MPM_SAFE="${INSTALLED_MPM_SAFE} ${mpm}" |
|
|
| 340 | fi |
|
|
| 341 | |
|
|
| 342 | if [ -n "${INSTALLED_MPM_UNSAFE}" ] ; then |
|
|
| 343 | ewarn "You have one or more MPMs installed that will not work with" |
|
|
| 344 | ewarn "this module (${PN}). Please make sure that you only enable" |
|
|
| 345 | ewarn "this module if you are using one of the following MPMs:" |
|
|
| 346 | ewarn " ${INSTALLED_MPM_SAFE}" |
|
|
| 347 | fi |
|
|
| 348 | |
|
|
| 349 | fi |
|
|
| 350 | |
|
|
| 351 | |
|
|
| 352 | } |
235 | } |
| 353 | |
236 | |
| 354 | ###### |
|
|
| 355 | ## Apache dual (1.x or 2.x) ebuild functions |
|
|
| 356 | ## |
|
|
| 357 | ## This is where the magic happens. We provide dummy routines of all of the functions |
|
|
| 358 | ## provided by all of the specifics. We use APACHE_ECLASS_VER_* to see which versions |
|
|
| 359 | ## to call. If a function is provided by a given section (ie pkg_postinst in Apache 2.x) |
|
|
| 360 | ## the exported routine simply does nothing. |
|
|
| 361 | ###### |
|
|
| 362 | |
|
|
| 363 | apache-module_pkg_setup() { |
|
|
| 364 | debug-print-function apache-module_pkg_setup |
|
|
| 365 | |
|
|
| 366 | if [ ${APACHE_VERSION} -eq '2' ]; then |
|
|
| 367 | apache2_pkg_setup |
|
|
| 368 | fi |
|
|
| 369 | } |
|
|
| 370 | |
|
|
| 371 | apache-module_src_compile() { |
|
|
| 372 | debug-print-function apache-module_src_compile |
|
|
| 373 | |
|
|
| 374 | if [ ${APACHE_VERSION} -eq '1' ]; then |
|
|
| 375 | apache1_src_compile |
|
|
| 376 | else |
|
|
| 377 | apache2_src_compile |
|
|
| 378 | fi |
|
|
| 379 | } |
|
|
| 380 | |
|
|
| 381 | apache-module_src_install() { |
|
|
| 382 | debug-print-function apache-module_src_install |
|
|
| 383 | |
|
|
| 384 | if [ ${APACHE_VERSION} -eq '1' ]; then |
|
|
| 385 | apache1_src_install |
|
|
| 386 | else |
|
|
| 387 | apache2_src_install |
|
|
| 388 | fi |
|
|
| 389 | } |
|
|
| 390 | |
|
|
| 391 | apache-module_pkg_postinst() { |
|
|
| 392 | debug-print-function apache-module_pkg_postinst |
|
|
| 393 | |
|
|
| 394 | if [ ${APACHE_VERSION} -eq '1' ]; then |
|
|
| 395 | apache1_pkg_postinst |
|
|
| 396 | else |
|
|
| 397 | apache2_pkg_postinst |
|
|
| 398 | fi |
|
|
| 399 | } |
|
|
| 400 | |
|
|
| 401 | EXPORT_FUNCTIONS pkg_setup src_compile src_install pkg_postinst |
237 | EXPORT_FUNCTIONS src_compile src_install pkg_postinst |
| 402 | |
|
|
| 403 | # vim:ts=4 |
|
|