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

Contents of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.27 - (hide annotations) (download)
Mon Mar 5 08:20:52 2012 UTC (2 years, 4 months ago) by patrick
Branch: MAIN
Changes since 1.26: +2 -4 lines
Don't set eapi in eclass, #405911

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

  ViewVC Help
Powered by ViewVC 1.1.20