/[gentoo-x86]/eclass/apache-2.eclass
Gentoo

Contents of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.38 - (show annotations) (download)
Tue Aug 5 14:19:19 2014 UTC (6 weeks, 6 days ago) by ottxor
Branch: MAIN
Changes since 1.37: +37 -30 lines
added prefix support (bug #433736)

1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.37 2014/07/30 19:01:02 robbat2 Exp $
4
5 # @ECLASS: apache-2.eclass
6 # @MAINTAINER:
7 # apache-devs@gentoo.org
8 # @BLURB: Provides a common set of functions for apache-2.x ebuilds
9 # @DESCRIPTION:
10 # This eclass handles apache-2.x ebuild functions such as LoadModule generation
11 # and inter-module dependency checking.
12
13 inherit autotools eutils flag-o-matic multilib ssl-cert user toolchain-funcs versionator
14
15 [[ ${CATEGORY}/${PN} != www-servers/apache ]] \
16 && die "Do not use this eclass with anything else than www-servers/apache ebuilds!"
17
18 case ${EAPI:-0} in
19 0|1|2|3)
20 die "This eclass requires >=EAPI-4"
21 ;;
22 esac
23
24 # settings which are version specific go in here:
25 case $(get_version_component_range 1-2) in
26 2.4)
27 DEFAULT_MPM_THREADED="event" #509922
28 RDEPEND=">=dev-libs/apr-1.5.1" #492578
29 ;;
30 *)
31 DEFAULT_MPM_THREADED="worker"
32 RDEPEND=">=dev-libs/apr-1.4.5" #368651
33 ;;
34 esac
35
36 # ==============================================================================
37 # INTERNAL VARIABLES
38 # ==============================================================================
39
40 # @ECLASS-VARIABLE: GENTOO_PATCHNAME
41 # @DESCRIPTION:
42 # This internal variable contains the prefix for the patch tarball.
43 # Defaults to the full name and version (including revision) of the package.
44 # If you want to override this in an ebuild, use:
45 # ORIG_PR="(revision of Gentoo stuff you want)"
46 # GENTOO_PATCHNAME="gentoo-${PN}-${PV}${ORIG_PR:+-${ORIG_PR}}"
47 [[ -n "$GENTOO_PATCHNAME" ]] || GENTOO_PATCHNAME="gentoo-${PF}"
48
49 # @ECLASS-VARIABLE: GENTOO_PATCHDIR
50 # @DESCRIPTION:
51 # This internal variable contains the working directory where patches and config
52 # files are located.
53 # Defaults to the patchset name appended to the working directory.
54 [[ -n "$GENTOO_PATCHDIR" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}"
55
56 # @VARIABLE: GENTOO_DEVELOPER
57 # @DESCRIPTION:
58 # This variable needs to be set in the ebuild and contains the name of the
59 # gentoo developer who created the patch tarball
60
61 # @VARIABLE: GENTOO_PATCHSTAMP
62 # @DESCRIPTION:
63 # This variable needs to be set in the ebuild and contains the date the patch
64 # tarball was created at in YYYYMMDD format
65
66 # @VARIABLE: GENTOO_PATCH_A
67 # @DESCRIPTION:
68 # This variable should contain the entire filename of patch tarball.
69 # Defaults to the name of the patchset, with a datestamp.
70 [[ -n "$GENTOO_PATCH_A" ]] || GENTOO_PATCH_A="${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2"
71
72 SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2
73 http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}"
74
75 # @VARIABLE: IUSE_MPMS_FORK
76 # @DESCRIPTION:
77 # This variable needs to be set in the ebuild and contains a list of forking
78 # (i.e. non-threaded) MPMs
79
80 # @VARIABLE: IUSE_MPMS_THREAD
81 # @DESCRIPTION:
82 # This variable needs to be set in the ebuild and contains a list of threaded
83 # MPMs
84
85 # @VARIABLE: IUSE_MODULES
86 # @DESCRIPTION:
87 # This variable needs to be set in the ebuild and contains a list of available
88 # built-in modules
89
90 IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}"
91 IUSE="${IUSE} debug doc ldap selinux ssl static suexec threads"
92
93 for module in ${IUSE_MODULES} ; do
94 IUSE="${IUSE} apache2_modules_${module}"
95 done
96
97 for mpm in ${IUSE_MPMS} ; do
98 IUSE="${IUSE} apache2_mpms_${mpm}"
99 done
100
101 DEPEND="dev-lang/perl
102 =dev-libs/apr-1*
103 =dev-libs/apr-util-1*[ldap?]
104 dev-libs/libpcre
105 apache2_modules_deflate? ( sys-libs/zlib )
106 apache2_modules_mime? ( app-misc/mime-types )
107 ldap? ( =net-nds/openldap-2* )
108 selinux? ( sec-policy/selinux-apache )
109 ssl? ( >=dev-libs/openssl-0.9.8m )
110 !=www-servers/apache-1*"
111 RDEPEND+=" ${DEPEND}"
112 PDEPEND="~app-admin/apache-tools-${PV}"
113
114 S="${WORKDIR}/httpd-${PV}"
115
116 # ==============================================================================
117 # INTERNAL FUNCTIONS
118 # ==============================================================================
119
120 # @ECLASS-VARIABLE: MY_MPM
121 # @DESCRIPTION:
122 # This internal variable contains the selected MPM after a call to setup_mpm()
123
124 # @FUNCTION: setup_mpm
125 # @DESCRIPTION:
126 # This internal function makes sure that only one of APACHE2_MPMS was selected
127 # or a default based on USE=threads is selected if APACHE2_MPMS is empty
128 setup_mpm() {
129 MY_MPM=""
130 for x in ${IUSE_MPMS} ; do
131 if use apache2_mpms_${x} ; then
132 if [[ -z "${MY_MPM}" ]] ; then
133 MY_MPM=${x}
134 elog
135 elog "Selected MPM: ${MY_MPM}"
136 elog
137 else
138 eerror "You have selected more then one mpm USE-flag."
139 eerror "Only one MPM is supported."
140 die "more then one mpm was specified"
141 fi
142 fi
143 done
144
145 if [[ -z "${MY_MPM}" ]] ; then
146 if use threads ; then
147 MY_MPM=${DEFAULT_MPM_THREADED}
148 elog
149 elog "Selected default threaded MPM: ${MY_MPM}"
150 elog
151 else
152 MY_MPM=prefork
153 elog
154 elog "Selected default MPM: ${MY_MPM}"
155 elog
156 fi
157 fi
158
159 if has ${MY_MPM} ${IUSE_MPMS_THREAD} && ! use threads ; then
160 eerror "You have selected a threaded MPM but USE=threads is disabled"
161 die "invalid use flag combination"
162 fi
163
164 if has ${MY_MPM} ${IUSE_MPMS_FORK} && use threads ; then
165 eerror "You have selected a non-threaded MPM but USE=threads is enabled"
166 die "invalid use flag combination"
167 fi
168 }
169
170 # @VARIABLE: MODULE_CRITICAL
171 # @DESCRIPTION:
172 # This variable needs to be set in the ebuild and contains a space-separated
173 # list of modules critical for the default apache. A user may still
174 # disable these modules for custom minimal installation at their own risk.
175
176 # @FUNCTION: check_module_critical
177 # @DESCRIPTION:
178 # This internal function warns the user about modules critical for the default
179 # apache configuration.
180 check_module_critical() {
181 local unsupported=0
182
183 for m in ${MODULE_CRITICAL} ; do
184 if ! has ${m} ${MY_MODS} ; then
185 ewarn "Module '${m}' is required in the default apache configuration."
186 unsupported=1
187 fi
188 done
189
190 if [[ ${unsupported} -ne 0 ]] ; then
191 ewarn
192 ewarn "You have disabled one or more required modules"
193 ewarn "for the default apache configuration."
194 ewarn "Although this is not an error, please be"
195 ewarn "aware that this setup is UNSUPPORTED."
196 ewarn
197 fi
198 }
199
200 # @VARIABLE: MODULE_DEPENDS
201 # @DESCRIPTION:
202 # This variable needs to be set in the ebuild and contains a space-separated
203 # list of dependency tokens each with a module and the module it depends on
204 # separated by a colon
205
206 # @FUNCTION: check_module_depends
207 # @DESCRIPTION:
208 # This internal function makes sure that all inter-module dependencies are
209 # satisfied with the current module selection
210 check_module_depends() {
211 local err=0
212
213 for m in ${MY_MODS} ; do
214 for dep in ${MODULE_DEPENDS} ; do
215 if [[ "${m}" == "${dep%:*}" ]] ; then
216 if ! use apache2_modules_${dep#*:} ; then
217 eerror "Module '${m}' depends on '${dep#*:}'"
218 err=1
219 fi
220 fi
221 done
222 done
223
224 if [[ ${err} -ne 0 ]] ; then
225 die "invalid use flag combination"
226 fi
227 }
228
229 # @ECLASS-VARIABLE: MY_CONF
230 # @DESCRIPTION:
231 # This internal variable contains the econf options for the current module
232 # selection after a call to setup_modules()
233
234 # @ECLASS-VARIABLE: MY_MODS
235 # @DESCRIPTION:
236 # This internal variable contains a sorted, space separated list of currently
237 # selected modules after a call to setup_modules()
238
239 # @FUNCTION: setup_modules
240 # @DESCRIPTION:
241 # This internal function selects all built-in modules based on USE flags and
242 # APACHE2_MODULES USE_EXPAND flags
243 setup_modules() {
244 local mod_type=
245
246 if use static ; then
247 mod_type="static"
248 else
249 mod_type="shared"
250 fi
251
252 MY_CONF="--enable-so=static"
253
254 if use ldap ; then
255 MY_CONF+=" --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type}"
256 MY_MODS+=" ldap authnz_ldap"
257 else
258 MY_CONF+=" --disable-authnz_ldap --disable-ldap"
259 fi
260
261 if use ssl ; then
262 MY_CONF+=" --with-ssl="${EPREFIX}"/usr --enable-ssl=${mod_type}"
263 MY_MODS+=" ssl"
264 else
265 MY_CONF+=" --without-ssl --disable-ssl"
266 fi
267
268 if use suexec ; then
269 elog "You can manipulate several configure options of suexec"
270 elog "through the following environment variables:"
271 elog
272 elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: "${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/bin)"
273 elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: "${EPREFIX}"/var/log/apache2/suexec_log)"
274 elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)"
275 elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: "${EPREFIX}"/var/www)"
276 elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)"
277 elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)"
278 elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)"
279 elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
280 elog
281
282 MY_CONF+=" --with-suexec-safepath=${SUEXEC_SAFEPATH:-"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/bin}"
283 MY_CONF+=" --with-suexec-logfile=${SUEXEC_LOGFILE:-"${EPREFIX}"/var/log/apache2/suexec_log}"
284 MY_CONF+=" --with-suexec-bin="${EPREFIX}"/usr/sbin/suexec"
285 MY_CONF+=" --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}"
286 MY_CONF+=" --with-suexec-caller=${SUEXEC_CALLER:-apache}"
287 MY_CONF+=" --with-suexec-docroot=${SUEXEC_DOCROOT:-"${EPREFIX}"/var/www}"
288 MY_CONF+=" --with-suexec-uidmin=${SUEXEC_MINUID:-1000}"
289 MY_CONF+=" --with-suexec-gidmin=${SUEXEC_MINGID:-100}"
290 MY_CONF+=" --with-suexec-umask=${SUEXEC_UMASK:-077}"
291 MY_CONF+=" --enable-suexec=${mod_type}"
292 MY_MODS+=" suexec"
293 else
294 MY_CONF+=" --disable-suexec"
295 fi
296
297 for x in ${IUSE_MODULES} ; do
298 if use apache2_modules_${x} ; then
299 MY_CONF+=" --enable-${x}=${mod_type}"
300 MY_MODS+=" ${x}"
301 else
302 MY_CONF+=" --disable-${x}"
303 fi
304 done
305
306 # sort and uniquify MY_MODS
307 MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u)
308 check_module_depends
309 check_module_critical
310 }
311
312 # @VARIABLE: MODULE_DEFINES
313 # @DESCRIPTION:
314 # This variable needs to be set in the ebuild and contains a space-separated
315 # list of tokens each mapping a module to a runtime define which can be
316 # specified in APACHE2_OPTS in /etc/conf.d/apache2 to enable this particular
317 # module.
318
319 # @FUNCTION: generate_load_module
320 # @DESCRIPTION:
321 # This internal function generates the LoadModule lines for httpd.conf based on
322 # the current module selection and MODULE_DEFINES
323 generate_load_module() {
324 local endit=0 mod_lines= mod_dir="${ED}/usr/$(get_libdir)/apache2/modules"
325
326 if use static; then
327 sed -i -e "/%%LOAD_MODULE%%/d" \
328 "${GENTOO_PATCHDIR}"/conf/httpd.conf
329 return
330 fi
331
332 for m in ${MY_MODS} ; do
333 if [[ -e "${mod_dir}/mod_${m}.so" ]] ; then
334 for def in ${MODULE_DEFINES} ; do
335 if [[ "${m}" == "${def%:*}" ]] ; then
336 mod_lines="${mod_lines}\n<IfDefine ${def#*:}>"
337 endit=1
338 fi
339 done
340
341 mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_${m}.so"
342
343 if [[ ${endit} -ne 0 ]] ; then
344 mod_lines="${mod_lines}\n</IfDefine>"
345 endit=0
346 fi
347 fi
348 done
349
350 sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \
351 "${GENTOO_PATCHDIR}"/conf/httpd.conf
352 }
353
354 # @FUNCTION: check_upgrade
355 # @DESCRIPTION:
356 # This internal function checks if the previous configuration file for built-in
357 # modules exists in ROOT and prevents upgrade in this case. Users are supposed
358 # to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove
359 # it afterwards.
360 check_upgrade() {
361 if [[ -e "${EROOT}"etc/apache2/apache2-builtin-mods ]]; then
362 eerror "The previous configuration file for built-in modules"
363 eerror "(${EROOT}etc/apache2/apache2-builtin-mods) exists on your"
364 eerror "system."
365 eerror
366 eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml"
367 eerror "for detailed information how to convert this file to the new"
368 eerror "APACHE2_MODULES USE_EXPAND variable."
369 eerror
370 die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods"
371 fi
372 }
373
374 # ==============================================================================
375 # EXPORTED FUNCTIONS
376 # ==============================================================================
377
378 # @FUNCTION: apache-2_pkg_setup
379 # @DESCRIPTION:
380 # This function selects built-in modules, the MPM and other configure options,
381 # creates the apache user and group and informs about CONFIG_SYSVIPC being
382 # needed (we don't depend on kernel sources and therefore cannot check).
383 apache-2_pkg_setup() {
384 check_upgrade
385
386 # setup apache user and group
387 enewgroup apache 81
388 enewuser apache 81 -1 /var/www apache
389
390 setup_mpm
391 setup_modules
392
393 if use debug; then
394 MY_CONF+=" --enable-maintainer-mode --enable-exception-hook"
395 fi
396
397 elog "Please note that you need SysV IPC support in your kernel."
398 elog "Make sure CONFIG_SYSVIPC=y is set."
399 elog
400
401 if use userland_BSD; then
402 elog "On BSD systems you need to add the following line to /boot/loader.conf:"
403 elog " accf_http_load=\"YES\""
404 elog
405 fi
406 }
407
408 # @FUNCTION: apache-2_src_prepare
409 # @DESCRIPTION:
410 # This function applies patches, configures a custom file-system layout and
411 # rebuilds the configure scripts.
412 apache-2_src_prepare() {
413 #fix prefix in conf files etc (bug #433736)
414 use !prefix || sed -e "s@/\(usr\|var\|etc\|run\)/@${EPREFIX}&@g" \
415 -i "${GENTOO_PATCHDIR}"/conf/httpd.conf "${GENTOO_PATCHDIR}"/scripts/* \
416 "${GENTOO_PATCHDIR}"/docs/*.example "${GENTOO_PATCHDIR}"/patches/*.layout \
417 "${GENTOO_PATCHDIR}"/init/* "${GENTOO_PATCHDIR}"/conf/vhosts.d/* \
418 "${GENTOO_PATCHDIR}"/conf/modules.d/* || die
419
420 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
421 # idea for everyone
422 case ${CHOST} in
423 *-linux-gnu|*-solaris*|*-freebsd*)
424 # do nothing, these use GNU binutils
425 :
426 ;;
427 *-darwin*)
428 sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \
429 "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
430 ;;
431 *)
432 # patch it out to be like upstream
433 sed -i -e 's/-Wl,-z,now//g' \
434 "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
435 ;;
436 esac
437
438 # Use correct multilib libdir in gentoo patches
439 sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \
440 "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \
441 || die "libdir sed failed"
442
443 epatch "${GENTOO_PATCHDIR}"/patches/*.patch
444
445 # setup the filesystem layout config
446 cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \
447 die "Failed preparing config.layout!"
448 sed -i -e "s:version:${PF}:g" "${S}"/config.layout
449
450 # apache2.8 instead of httpd.8 (bug #194828)
451 mv docs/man/{httpd,apache2}.8
452 sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
453
454 # patched-in MPMs need the build environment rebuilt
455 sed -i -e '/sinclude/d' configure.in
456 AT_M4DIR=build eautoreconf
457
458 # ${T} must be not group-writable, else grsec TPE will block it
459 chmod g-w "${T}"
460
461 # This package really should upgrade to using pcre's .pc file.
462 cat <<-\EOF >"${T}"/pcre-config
463 #!/bin/sh
464 [ "${flag}" = "--version" ] && set -- --modversion
465 exec ${PKG_CONFIG} libpcre "$@"
466 EOF
467 chmod a+x "${T}"/pcre-config
468 }
469
470 # @FUNCTION: apache-2_src_configure
471 # @DESCRIPTION:
472 # This function adds compiler flags and runs econf and emake based on MY_MPM and
473 # MY_CONF
474 apache-2_src_configure() {
475 tc-export PKG_CONFIG
476
477 # Sanity check in case people have bad mounts/TPE settings. #500928
478 if ! "${T}"/pcre-config --help >/dev/null ; then
479 eerror "Could not execute ${T}/pcre-config; do you have bad mount"
480 eerror "permissions in ${T} or have TPE turned on in your kernel?"
481 die "check your runtime settings #500928"
482 fi
483
484 # Instead of filtering --as-needed (bug #128505), append --no-as-needed
485 # Thanks to Harald van Dijk
486 append-ldflags $(no-as-needed)
487
488 # peruser MPM debugging with -X is nearly impossible
489 if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
490 use debug && append-flags -DMPM_PERUSER_DEBUG
491 fi
492
493 # econf overwrites the stuff from config.layout, so we have to put them into
494 # our myconf line too
495 ac_cv_path_PKGCONFIG=${PKG_CONFIG} \
496 econf \
497 --includedir="${EPREFIX}"/usr/include/apache2 \
498 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/apache2/modules \
499 --datadir="${EPREFIX}"/var/www/localhost \
500 --sysconfdir="${EPREFIX}"/etc/apache2 \
501 --localstatedir="${EPREFIX}"/var \
502 --with-mpm=${MY_MPM} \
503 --with-apr="${SYSROOT}${EPREFIX}"/usr \
504 --with-apr-util="${SYSROOT}${EPREFIX}"/usr \
505 --with-pcre="${T}"/pcre-config \
506 --with-z="${EPREFIX}"/usr \
507 --with-port=80 \
508 --with-program-name=apache2 \
509 --enable-layout=Gentoo \
510 ${MY_CONF} || die "econf failed!"
511
512 sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h
513 }
514
515 # @FUNCTION: apache-2_src_install
516 # @DESCRIPTION:
517 # This function runs `emake install' and generates, installs and adapts the gentoo
518 # specific configuration files found in the tarball
519 apache-2_src_install() {
520 emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install || die "make install failed"
521
522 # install our configuration files
523 keepdir /etc/apache2/vhosts.d
524 keepdir /etc/apache2/modules.d
525
526 generate_load_module
527 insinto /etc/apache2
528 doins -r "${GENTOO_PATCHDIR}"/conf/*
529 use apache2_modules_mime_magic && doins docs/conf/magic
530
531 insinto /etc/logrotate.d
532 newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
533
534 # generate a sane default APACHE2_OPTS
535 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
536 use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL"
537 use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST"
538 use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC"
539 if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
540 APACHE2_OPTS="${APACHE2_OPTS} -D LANGUAGE"
541 fi
542
543 sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
544 "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed"
545
546 newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
547 newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
548
549 # install apache2ctl wrapper for our init script if available
550 if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then
551 exeinto /usr/sbin
552 doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl
553 else
554 dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
555 fi
556
557 # provide legacy symlink for apxs, bug 177697
558 dosym apxs /usr/sbin/apxs2
559
560 # install some documentation
561 dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
562 dodoc "${GENTOO_PATCHDIR}"/docs/*
563
564 # drop in a convenient link to the manual
565 if use doc ; then
566 sed -i -e "s:VERSION:${PVR}:" "${ED}/etc/apache2/modules.d/00_apache_manual.conf"
567 docompress -x /usr/share/doc/${PF}/manual # 503640
568 else
569 rm -f "${ED}/etc/apache2/modules.d/00_apache_manual.conf"
570 rm -Rf "${ED}/usr/share/doc/${PF}/manual"
571 fi
572
573 # the default icons and error pages get stored in
574 # /usr/share/apache2/{error,icons}
575 dodir /usr/share/apache2
576 mv -f "${ED}/var/www/localhost/error" "${ED}/usr/share/apache2/error"
577 mv -f "${ED}/var/www/localhost/icons" "${ED}/usr/share/apache2/icons"
578 rm -rf "${ED}/var/www/localhost/"
579 eend $?
580
581 # set some sane permissions for suexec
582 if use suexec ; then
583 fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
584 fperms 4710 /usr/sbin/suexec
585 # provide legacy symlink for suexec, bug 177697
586 dosym /usr/sbin/suexec /usr/sbin/suexec2
587 fi
588
589 # empty dirs
590 for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
591 keepdir ${i}
592 fowners apache:apache ${i}
593 fperms 0750 ${i}
594 done
595 }
596
597 # @FUNCTION: apache-2_pkg_postinst
598 # @DESCRIPTION:
599 # This function creates test certificates if SSL is enabled and installs the
600 # default index.html to /var/www/localhost if it does not exist. We do this here
601 # because the default webroot is a copy of the files that exist elsewhere and we
602 # don't want them to be managed/removed by portage when apache is upgraded.
603 apache-2_pkg_postinst() {
604 if use ssl && [[ ! -e "${EROOT}/etc/ssl/apache2/server.pem" ]]; then
605 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
606 install_cert /etc/ssl/apache2/server
607 ewarn
608 ewarn "The location of SSL certificates has changed. If you are"
609 ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
610 ewarn "*any* apache version), you might want to move your old"
611 ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
612 ewarn "update your config files."
613 ewarn
614 fi
615
616 if [[ ! -e "${EROOT}/var/www/localhost" ]] ; then
617 mkdir -p "${EROOT}/var/www/localhost/htdocs"
618 echo "<html><body><h1>It works!</h1></body></html>" > "${EROOT}/var/www/localhost/htdocs/index.html"
619 fi
620
621 echo
622 elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags"
623 elog "in make.conf. Make sure to enable those in order to compile them."
624 elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise."
625 echo
626
627 }
628
629 EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20