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

Contents of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.22 - (hide annotations) (download)
Sat Aug 21 19:39:52 2010 UTC (3 years, 7 months ago) by vapier
Branch: MAIN
Changes since 1.21: +2 -2 lines
remove unused references to long dead (circa 2006) AT_GNUCONF_UPDATE variable

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

  ViewVC Help
Powered by ViewVC 1.1.20