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