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

Contents of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.37 - (hide annotations) (download)
Wed Jul 30 19:01:02 2014 UTC (4 months, 3 weeks ago) by robbat2
Branch: MAIN
Changes since 1.36: +4 -1 lines
Handle grsec TPE to ensure apache can compile. $T is group-writable, owned by portage, and TPE blocks that.

1 patrick 1.33 # Copyright 1999-2014 Gentoo Foundation
2 hollow 1.1 # Distributed under the terms of the GNU General Public License v2
3 robbat2 1.37 # $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.36 2014/05/22 13:58:46 polynomial-c 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 polynomial-c 1.36 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 hollow 1.1
36     # ==============================================================================
37     # INTERNAL VARIABLES
38     # ==============================================================================
39    
40     # @ECLASS-VARIABLE: GENTOO_PATCHNAME
41     # @DESCRIPTION:
42 robbat2 1.14 # This internal variable contains the prefix for the patch tarball.
43 robbat2 1.15 # 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 robbat2 1.14 [[ -n "$GENTOO_PATCHNAME" ]] || GENTOO_PATCHNAME="gentoo-${PF}"
48 hollow 1.1
49     # @ECLASS-VARIABLE: GENTOO_PATCHDIR
50     # @DESCRIPTION:
51     # This internal variable contains the working directory where patches and config
52 robbat2 1.14 # files are located.
53     # Defaults to the patchset name appended to the working directory.
54     [[ -n "$GENTOO_PATCHDIR" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}"
55 hollow 1.1
56 hollow 1.9 # @VARIABLE: GENTOO_DEVELOPER
57 hollow 1.1 # @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 hollow 1.9 # @VARIABLE: GENTOO_PATCHSTAMP
62 hollow 1.1 # @DESCRIPTION:
63     # This variable needs to be set in the ebuild and contains the date the patch
64 hollow 1.7 # tarball was created at in YYYYMMDD format
65 hollow 1.1
66 robbat2 1.14 # @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 hollow 1.1 SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2
73 robbat2 1.14 http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}"
74 hollow 1.1
75 hollow 1.9 # @VARIABLE: IUSE_MPMS_FORK
76 hollow 1.1 # @DESCRIPTION:
77     # This variable needs to be set in the ebuild and contains a list of forking
78 hollow 1.11 # (i.e. non-threaded) MPMs
79 hollow 1.1
80 hollow 1.9 # @VARIABLE: IUSE_MPMS_THREAD
81 hollow 1.1 # @DESCRIPTION:
82     # This variable needs to be set in the ebuild and contains a list of threaded
83 hollow 1.11 # MPMs
84 hollow 1.1
85 hollow 1.9 # @VARIABLE: IUSE_MODULES
86 hollow 1.1 # @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 hollow 1.3 IUSE="${IUSE} debug doc ldap selinux ssl static suexec threads"
92 hollow 1.1
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 hollow 1.18 =dev-libs/apr-util-1*[ldap?]
104 hollow 1.1 dev-libs/libpcre
105 polynomial-c 1.36 apache2_modules_deflate? ( sys-libs/zlib )
106     apache2_modules_mime? ( app-misc/mime-types )
107 hollow 1.1 ldap? ( =net-nds/openldap-2* )
108     selinux? ( sec-policy/selinux-apache )
109 polynomial-c 1.36 ssl? ( >=dev-libs/openssl-0.9.8m )
110 hollow 1.1 !=www-servers/apache-1*"
111 polynomial-c 1.36 RDEPEND+=" ${DEPEND}"
112 hollow 1.1 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 hollow 1.7 # @DESCRIPTION:
122 hollow 1.1 # 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 zmedico 1.4 MY_MPM=""
130 hollow 1.1 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 polynomial-c 1.36 MY_MPM=${DEFAULT_MPM_THREADED}
148 hollow 1.1 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 hollow 1.9 # @VARIABLE: MODULE_CRITICAL
171 hollow 1.3 # @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 hollow 1.9 # @VARIABLE: MODULE_DEPENDS
201 hollow 1.1 # @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 hollow 1.7 if [[ "${m}" == "${dep%:*}" ]] ; then
216 hollow 1.1 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 hollow 1.8 # @DESCRIPTION:
231 hollow 1.1 # 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 hollow 1.8 # @DESCRIPTION:
236 hollow 1.1 # 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 polynomial-c 1.36 MY_CONF+=" --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type}"
256     MY_MODS+=" ldap authnz_ldap"
257 hollow 1.1 else
258 polynomial-c 1.36 MY_CONF+=" --disable-authnz_ldap --disable-ldap"
259 hollow 1.1 fi
260    
261     if use ssl ; then
262 polynomial-c 1.36 MY_CONF+=" --with-ssl=/usr --enable-ssl=${mod_type}"
263     MY_MODS+=" ssl"
264 hollow 1.1 else
265 polynomial-c 1.36 MY_CONF+=" --without-ssl --disable-ssl"
266 hollow 1.1 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: /usr/local/bin:/usr/bin:/bin)"
273     elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: /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: /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 polynomial-c 1.36 MY_CONF+=" --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}"
283     MY_CONF+=" --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}"
284     MY_CONF+=" --with-suexec-bin=/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:-/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 hollow 1.1 else
294 polynomial-c 1.36 MY_CONF+=" --disable-suexec"
295 hollow 1.1 fi
296    
297     for x in ${IUSE_MODULES} ; do
298     if use apache2_modules_${x} ; then
299 polynomial-c 1.36 MY_CONF+=" --enable-${x}=${mod_type}"
300     MY_MODS+=" ${x}"
301 hollow 1.1 else
302 polynomial-c 1.36 MY_CONF+=" --disable-${x}"
303 hollow 1.1 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 hollow 1.3 check_module_critical
310 hollow 1.1 }
311    
312 hollow 1.9 # @VARIABLE: MODULE_DEFINES
313 hollow 1.1 # @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 hollow 1.8 local endit=0 mod_lines= mod_dir="${D}/usr/$(get_libdir)/apache2/modules"
325 hollow 1.1
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 "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then
362     eerror "The previous configuration file for built-in modules"
363     eerror "(${ROOT}etc/apache2/apache2-builtin-mods) exists on your"
364     eerror "system."
365     eerror
366 hollow 1.2 eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml"
367 hollow 1.1 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 hollow 1.11 # setup apache user and group
387     enewgroup apache 81
388     enewuser apache 81 -1 /var/www apache
389    
390 hollow 1.1 setup_mpm
391     setup_modules
392    
393     if use debug; then
394 polynomial-c 1.36 MY_CONF+=" --enable-maintainer-mode --enable-exception-hook"
395 hollow 1.1 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 hollow 1.12
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 hollow 1.1 }
407    
408 hollow 1.18 # @FUNCTION: apache-2_src_prepare
409 hollow 1.1 # @DESCRIPTION:
410     # This function applies patches, configures a custom file-system layout and
411 hollow 1.3 # rebuilds the configure scripts.
412 hollow 1.18 apache-2_src_prepare() {
413 grobian 1.16 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
414     # idea for everyone
415     case ${CHOST} in
416     *-linux-gnu|*-solaris*|*-freebsd*)
417     # do nothing, these use GNU binutils
418     :
419     ;;
420     *-darwin*)
421     sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \
422     "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
423     ;;
424     *)
425     # patch it out to be like upstream
426     sed -i -e 's/-Wl,-z,now//g' \
427     "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
428     ;;
429     esac
430    
431 hollow 1.1 # Use correct multilib libdir in gentoo patches
432     sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \
433     "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \
434     || die "libdir sed failed"
435    
436     epatch "${GENTOO_PATCHDIR}"/patches/*.patch
437    
438     # setup the filesystem layout config
439     cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \
440     die "Failed preparing config.layout!"
441     sed -i -e "s:version:${PF}:g" "${S}"/config.layout
442    
443 hollow 1.3 # apache2.8 instead of httpd.8 (bug #194828)
444     mv docs/man/{httpd,apache2}.8
445     sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
446    
447 hollow 1.1 # patched-in MPMs need the build environment rebuilt
448     sed -i -e '/sinclude/d' configure.in
449 vapier 1.22 AT_M4DIR=build eautoreconf
450 vapier 1.34
451 robbat2 1.37 # ${T} must be not group-writable, else grsec TPE will block it
452     chmod g-w "${T}"
453    
454 vapier 1.34 # This package really should upgrade to using pcre's .pc file.
455     cat <<-\EOF >"${T}"/pcre-config
456     #!/bin/sh
457     [ "${flag}" = "--version" ] && set -- --modversion
458     exec ${PKG_CONFIG} libpcre "$@"
459     EOF
460     chmod a+x "${T}"/pcre-config
461 hollow 1.1 }
462    
463 hollow 1.18 # @FUNCTION: apache-2_src_configure
464 hollow 1.1 # @DESCRIPTION:
465     # This function adds compiler flags and runs econf and emake based on MY_MPM and
466     # MY_CONF
467 hollow 1.18 apache-2_src_configure() {
468 vapier 1.34 tc-export PKG_CONFIG
469    
470 vapier 1.35 # Sanity check in case people have bad mounts/TPE settings. #500928
471     if ! "${T}"/pcre-config --help >/dev/null ; then
472     eerror "Could not execute ${T}/pcre-config; do you have bad mount"
473     eerror "permissions in ${T} or have TPE turned on in your kernel?"
474     die "check your runtime settings #500928"
475     fi
476    
477 hollow 1.1 # Instead of filtering --as-needed (bug #128505), append --no-as-needed
478     # Thanks to Harald van Dijk
479 ssuominen 1.19 append-ldflags $(no-as-needed)
480 hollow 1.1
481     # peruser MPM debugging with -X is nearly impossible
482     if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
483     use debug && append-flags -DMPM_PERUSER_DEBUG
484     fi
485    
486     # econf overwrites the stuff from config.layout, so we have to put them into
487     # our myconf line too
488 vapier 1.34 ac_cv_path_PKGCONFIG=${PKG_CONFIG} \
489 hollow 1.1 econf \
490     --includedir=/usr/include/apache2 \
491     --libexecdir=/usr/$(get_libdir)/apache2/modules \
492     --datadir=/var/www/localhost \
493     --sysconfdir=/etc/apache2 \
494     --localstatedir=/var \
495     --with-mpm=${MY_MPM} \
496 vapier 1.34 --with-apr="${SYSROOT}"/usr \
497     --with-apr-util="${SYSROOT}"/usr \
498     --with-pcre="${T}"/pcre-config \
499 hollow 1.1 --with-z=/usr \
500     --with-port=80 \
501     --with-program-name=apache2 \
502     --enable-layout=Gentoo \
503     ${MY_CONF} || die "econf failed!"
504    
505     sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h
506     }
507    
508     # @FUNCTION: apache-2_src_install
509     # @DESCRIPTION:
510 hollow 1.11 # This function runs `emake install' and generates, installs and adapts the gentoo
511 hollow 1.1 # specific configuration files found in the tarball
512     apache-2_src_install() {
513 flameeyes 1.29 emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install || die "make install failed"
514 hollow 1.1
515     # install our configuration files
516     keepdir /etc/apache2/vhosts.d
517     keepdir /etc/apache2/modules.d
518    
519     generate_load_module
520     insinto /etc/apache2
521     doins -r "${GENTOO_PATCHDIR}"/conf/*
522 hollow 1.20 use apache2_modules_mime_magic && doins docs/conf/magic
523 hollow 1.1
524     insinto /etc/logrotate.d
525     newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
526    
527     # generate a sane default APACHE2_OPTS
528 hollow 1.18 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
529 hollow 1.1 use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL"
530     use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST"
531     use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC"
532 ssuominen 1.25 if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
533 hollow 1.18 APACHE2_OPTS="${APACHE2_OPTS} -D LANGUAGE"
534     fi
535 hollow 1.1
536     sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
537     "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed"
538    
539     newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
540     newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
541    
542 hollow 1.13 # install apache2ctl wrapper for our init script if available
543     if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then
544     exeinto /usr/sbin
545     doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl
546     else
547     dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
548     fi
549 hollow 1.1
550 hollow 1.6 # provide legacy symlink for apxs, bug 177697
551 polynomial-c 1.36 dosym apxs /usr/sbin/apxs2
552 hollow 1.1
553     # install some documentation
554     dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
555     dodoc "${GENTOO_PATCHDIR}"/docs/*
556    
557     # drop in a convenient link to the manual
558     if use doc ; then
559     sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf"
560 polynomial-c 1.36 docompress -x /usr/share/doc/${PF}/manual # 503640
561 hollow 1.1 else
562     rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf"
563     rm -Rf "${D}/usr/share/doc/${PF}/manual"
564     fi
565    
566 hollow 1.18 # the default icons and error pages get stored in
567     # /usr/share/apache2/{error,icons}
568     dodir /usr/share/apache2
569     mv -f "${D}/var/www/localhost/error" "${D}/usr/share/apache2/error"
570     mv -f "${D}/var/www/localhost/icons" "${D}/usr/share/apache2/icons"
571     rm -rf "${D}/var/www/localhost/"
572 hollow 1.1 eend $?
573    
574     # set some sane permissions for suexec
575     if use suexec ; then
576 hollow 1.17 fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
577 hollow 1.1 fperms 4710 /usr/sbin/suexec
578 hollow 1.6 # provide legacy symlink for suexec, bug 177697
579     dosym /usr/sbin/suexec /usr/sbin/suexec2
580 hollow 1.1 fi
581    
582     # empty dirs
583     for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
584     keepdir ${i}
585     fowners apache:apache ${i}
586 patrick 1.28 fperms 0750 ${i}
587 hollow 1.1 done
588     }
589    
590     # @FUNCTION: apache-2_pkg_postinst
591     # @DESCRIPTION:
592     # This function creates test certificates if SSL is enabled and installs the
593 hollow 1.18 # default index.html to /var/www/localhost if it does not exist. We do this here
594 hollow 1.11 # because the default webroot is a copy of the files that exist elsewhere and we
595     # don't want them to be managed/removed by portage when apache is upgraded.
596 hollow 1.1 apache-2_pkg_postinst() {
597 hollow 1.18 if use ssl && [[ ! -e "${ROOT}/etc/ssl/apache2/server.pem" ]]; then
598     SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
599     install_cert /etc/ssl/apache2/server
600     ewarn
601     ewarn "The location of SSL certificates has changed. If you are"
602     ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
603     ewarn "*any* apache version), you might want to move your old"
604     ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
605     ewarn "update your config files."
606     ewarn
607 hollow 1.1 fi
608    
609 hollow 1.18 if [[ ! -e "${ROOT}/var/www/localhost" ]] ; then
610     mkdir -p "${ROOT}/var/www/localhost/htdocs"
611     echo "<html><body><h1>It works!</h1></body></html>" > "${ROOT}/var/www/localhost/htdocs/index.html"
612 hollow 1.1 fi
613 lxnay 1.21
614     echo
615     elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags"
616 zmedico 1.31 elog "in make.conf. Make sure to enable those in order to compile them."
617 hollow 1.24 elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise."
618 lxnay 1.21 echo
619    
620 hollow 1.1 }
621    
622 hollow 1.18 EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20