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

Contents of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.39 - (hide annotations) (download)
Thu Aug 7 07:37:54 2014 UTC (2 months, 2 weeks ago) by polynomial-c
Branch: MAIN
CVS Tags: HEAD
Changes since 1.38: +34 -33 lines
Fixed numerous misquotings by introducing arrays

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 polynomial-c 1.39 # $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.38 2014/08/05 14:19:19 ottxor 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 polynomial-c 1.39 if ! has ${m} ${MY_MODS[@]} ; then
185 hollow 1.3 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 polynomial-c 1.39 for m in ${MY_MODS[@]} ; do
214 hollow 1.1 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 polynomial-c 1.39 MY_CONF=( --enable-so=static )
253     MY_MODS=()
254 hollow 1.1
255     if use ldap ; then
256 polynomial-c 1.39 MY_CONF+=( --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type} )
257     MY_MODS+=( ldap authnz_ldap )
258 hollow 1.1 else
259 polynomial-c 1.39 MY_CONF+=( --disable-authnz_ldap --disable-ldap )
260 hollow 1.1 fi
261    
262     if use ssl ; then
263 polynomial-c 1.39 MY_CONF+=( --with-ssl="${EPREFIX}"/usr --enable-ssl=${mod_type} )
264     MY_MODS+=( ssl )
265 hollow 1.1 else
266 polynomial-c 1.39 MY_CONF+=( --without-ssl --disable-ssl )
267 hollow 1.1 fi
268    
269     if use suexec ; then
270     elog "You can manipulate several configure options of suexec"
271     elog "through the following environment variables:"
272     elog
273 polynomial-c 1.39 elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: '${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin')"
274     elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: '${EPREFIX}/var/log/apache2/suexec_log')"
275 hollow 1.1 elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)"
276 polynomial-c 1.39 elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: '${EPREFIX}/var/www')"
277 hollow 1.1 elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)"
278     elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)"
279     elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)"
280     elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
281     elog
282    
283 polynomial-c 1.39 MY_CONF+=( --with-suexec-safepath="${SUEXEC_SAFEPATH:-${EPREFIX}/usr/local/bin:${EPREFIX}/usr/bin:${EPREFIX}/bin}" )
284     MY_CONF+=( --with-suexec-logfile="${SUEXEC_LOGFILE:-${EPREFIX}/var/log/apache2/suexec_log}" )
285     MY_CONF+=( --with-suexec-bin="${EPREFIX}/usr/sbin/suexec" )
286     MY_CONF+=( --with-suexec-userdir=${SUEXEC_USERDIR:-public_html} )
287     MY_CONF+=( --with-suexec-caller=${SUEXEC_CALLER:-apache} )
288     MY_CONF+=( --with-suexec-docroot="${SUEXEC_DOCROOT:-${EPREFIX}/var/www}" )
289     MY_CONF+=( --with-suexec-uidmin=${SUEXEC_MINUID:-1000} )
290     MY_CONF+=( --with-suexec-gidmin=${SUEXEC_MINGID:-100} )
291     MY_CONF+=( --with-suexec-umask=${SUEXEC_UMASK:-077} )
292     MY_CONF+=( --enable-suexec=${mod_type} )
293     MY_MODS+=( suexec )
294 hollow 1.1 else
295 polynomial-c 1.39 MY_CONF+=( --disable-suexec )
296 hollow 1.1 fi
297    
298     for x in ${IUSE_MODULES} ; do
299     if use apache2_modules_${x} ; then
300 polynomial-c 1.39 MY_CONF+=( --enable-${x}=${mod_type} )
301     MY_MODS+=( ${x} )
302 hollow 1.1 else
303 polynomial-c 1.39 MY_CONF+=( --disable-${x} )
304 hollow 1.1 fi
305     done
306    
307     # sort and uniquify MY_MODS
308 polynomial-c 1.39 MY_MODS=( $(echo ${MY_MODS[@]} | tr ' ' '\n' | sort -u) )
309 hollow 1.1 check_module_depends
310 hollow 1.3 check_module_critical
311 hollow 1.1 }
312    
313 hollow 1.9 # @VARIABLE: MODULE_DEFINES
314 hollow 1.1 # @DESCRIPTION:
315     # This variable needs to be set in the ebuild and contains a space-separated
316     # list of tokens each mapping a module to a runtime define which can be
317     # specified in APACHE2_OPTS in /etc/conf.d/apache2 to enable this particular
318     # module.
319    
320     # @FUNCTION: generate_load_module
321     # @DESCRIPTION:
322     # This internal function generates the LoadModule lines for httpd.conf based on
323     # the current module selection and MODULE_DEFINES
324     generate_load_module() {
325 ottxor 1.38 local endit=0 mod_lines= mod_dir="${ED}/usr/$(get_libdir)/apache2/modules"
326 hollow 1.1
327     if use static; then
328     sed -i -e "/%%LOAD_MODULE%%/d" \
329     "${GENTOO_PATCHDIR}"/conf/httpd.conf
330     return
331     fi
332    
333 polynomial-c 1.39 for m in ${MY_MODS[@]} ; do
334 hollow 1.1 if [[ -e "${mod_dir}/mod_${m}.so" ]] ; then
335     for def in ${MODULE_DEFINES} ; do
336     if [[ "${m}" == "${def%:*}" ]] ; then
337     mod_lines="${mod_lines}\n<IfDefine ${def#*:}>"
338     endit=1
339     fi
340     done
341    
342     mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_${m}.so"
343    
344     if [[ ${endit} -ne 0 ]] ; then
345     mod_lines="${mod_lines}\n</IfDefine>"
346     endit=0
347     fi
348     fi
349     done
350    
351     sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \
352     "${GENTOO_PATCHDIR}"/conf/httpd.conf
353     }
354    
355     # @FUNCTION: check_upgrade
356     # @DESCRIPTION:
357     # This internal function checks if the previous configuration file for built-in
358     # modules exists in ROOT and prevents upgrade in this case. Users are supposed
359     # to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove
360     # it afterwards.
361     check_upgrade() {
362 ottxor 1.38 if [[ -e "${EROOT}"etc/apache2/apache2-builtin-mods ]]; then
363 hollow 1.1 eerror "The previous configuration file for built-in modules"
364 ottxor 1.38 eerror "(${EROOT}etc/apache2/apache2-builtin-mods) exists on your"
365 hollow 1.1 eerror "system."
366     eerror
367 hollow 1.2 eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml"
368 hollow 1.1 eerror "for detailed information how to convert this file to the new"
369     eerror "APACHE2_MODULES USE_EXPAND variable."
370     eerror
371     die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods"
372     fi
373     }
374    
375     # ==============================================================================
376     # EXPORTED FUNCTIONS
377     # ==============================================================================
378    
379     # @FUNCTION: apache-2_pkg_setup
380     # @DESCRIPTION:
381     # This function selects built-in modules, the MPM and other configure options,
382     # creates the apache user and group and informs about CONFIG_SYSVIPC being
383     # needed (we don't depend on kernel sources and therefore cannot check).
384     apache-2_pkg_setup() {
385     check_upgrade
386    
387 hollow 1.11 # setup apache user and group
388     enewgroup apache 81
389     enewuser apache 81 -1 /var/www apache
390    
391 hollow 1.1 setup_mpm
392     setup_modules
393    
394     if use debug; then
395 polynomial-c 1.39 MY_CONF+=( --enable-maintainer-mode --enable-exception-hook )
396 hollow 1.1 fi
397    
398     elog "Please note that you need SysV IPC support in your kernel."
399     elog "Make sure CONFIG_SYSVIPC=y is set."
400     elog
401 hollow 1.12
402     if use userland_BSD; then
403     elog "On BSD systems you need to add the following line to /boot/loader.conf:"
404     elog " accf_http_load=\"YES\""
405     elog
406     fi
407 hollow 1.1 }
408    
409 hollow 1.18 # @FUNCTION: apache-2_src_prepare
410 hollow 1.1 # @DESCRIPTION:
411     # This function applies patches, configures a custom file-system layout and
412 hollow 1.3 # rebuilds the configure scripts.
413 hollow 1.18 apache-2_src_prepare() {
414 ottxor 1.38 #fix prefix in conf files etc (bug #433736)
415     use !prefix || sed -e "s@/\(usr\|var\|etc\|run\)/@${EPREFIX}&@g" \
416     -i "${GENTOO_PATCHDIR}"/conf/httpd.conf "${GENTOO_PATCHDIR}"/scripts/* \
417     "${GENTOO_PATCHDIR}"/docs/*.example "${GENTOO_PATCHDIR}"/patches/*.layout \
418     "${GENTOO_PATCHDIR}"/init/* "${GENTOO_PATCHDIR}"/conf/vhosts.d/* \
419     "${GENTOO_PATCHDIR}"/conf/modules.d/* || die
420    
421 grobian 1.16 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
422     # idea for everyone
423     case ${CHOST} in
424     *-linux-gnu|*-solaris*|*-freebsd*)
425     # do nothing, these use GNU binutils
426     :
427     ;;
428     *-darwin*)
429     sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \
430     "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
431     ;;
432     *)
433     # patch it out to be like upstream
434     sed -i -e 's/-Wl,-z,now//g' \
435     "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
436     ;;
437     esac
438    
439 hollow 1.1 # Use correct multilib libdir in gentoo patches
440     sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \
441     "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \
442     || die "libdir sed failed"
443    
444     epatch "${GENTOO_PATCHDIR}"/patches/*.patch
445    
446     # setup the filesystem layout config
447     cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \
448     die "Failed preparing config.layout!"
449     sed -i -e "s:version:${PF}:g" "${S}"/config.layout
450    
451 hollow 1.3 # apache2.8 instead of httpd.8 (bug #194828)
452     mv docs/man/{httpd,apache2}.8
453     sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
454    
455 hollow 1.1 # patched-in MPMs need the build environment rebuilt
456     sed -i -e '/sinclude/d' configure.in
457 vapier 1.22 AT_M4DIR=build eautoreconf
458 vapier 1.34
459 robbat2 1.37 # ${T} must be not group-writable, else grsec TPE will block it
460     chmod g-w "${T}"
461    
462 vapier 1.34 # This package really should upgrade to using pcre's .pc file.
463     cat <<-\EOF >"${T}"/pcre-config
464     #!/bin/sh
465     [ "${flag}" = "--version" ] && set -- --modversion
466     exec ${PKG_CONFIG} libpcre "$@"
467     EOF
468     chmod a+x "${T}"/pcre-config
469 hollow 1.1 }
470    
471 hollow 1.18 # @FUNCTION: apache-2_src_configure
472 hollow 1.1 # @DESCRIPTION:
473     # This function adds compiler flags and runs econf and emake based on MY_MPM and
474     # MY_CONF
475 hollow 1.18 apache-2_src_configure() {
476 vapier 1.34 tc-export PKG_CONFIG
477    
478 vapier 1.35 # Sanity check in case people have bad mounts/TPE settings. #500928
479     if ! "${T}"/pcre-config --help >/dev/null ; then
480     eerror "Could not execute ${T}/pcre-config; do you have bad mount"
481     eerror "permissions in ${T} or have TPE turned on in your kernel?"
482     die "check your runtime settings #500928"
483     fi
484    
485 hollow 1.1 # Instead of filtering --as-needed (bug #128505), append --no-as-needed
486     # Thanks to Harald van Dijk
487 ssuominen 1.19 append-ldflags $(no-as-needed)
488 hollow 1.1
489     # peruser MPM debugging with -X is nearly impossible
490     if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
491     use debug && append-flags -DMPM_PERUSER_DEBUG
492     fi
493    
494     # econf overwrites the stuff from config.layout, so we have to put them into
495     # our myconf line too
496 vapier 1.34 ac_cv_path_PKGCONFIG=${PKG_CONFIG} \
497 hollow 1.1 econf \
498 ottxor 1.38 --includedir="${EPREFIX}"/usr/include/apache2 \
499     --libexecdir="${EPREFIX}"/usr/$(get_libdir)/apache2/modules \
500     --datadir="${EPREFIX}"/var/www/localhost \
501     --sysconfdir="${EPREFIX}"/etc/apache2 \
502     --localstatedir="${EPREFIX}"/var \
503 hollow 1.1 --with-mpm=${MY_MPM} \
504 ottxor 1.38 --with-apr="${SYSROOT}${EPREFIX}"/usr \
505     --with-apr-util="${SYSROOT}${EPREFIX}"/usr \
506 vapier 1.34 --with-pcre="${T}"/pcre-config \
507 ottxor 1.38 --with-z="${EPREFIX}"/usr \
508 hollow 1.1 --with-port=80 \
509     --with-program-name=apache2 \
510     --enable-layout=Gentoo \
511 polynomial-c 1.39 "${MY_CONF[@]}"
512 hollow 1.1
513     sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h
514     }
515    
516     # @FUNCTION: apache-2_src_install
517     # @DESCRIPTION:
518 hollow 1.11 # This function runs `emake install' and generates, installs and adapts the gentoo
519 hollow 1.1 # specific configuration files found in the tarball
520     apache-2_src_install() {
521 polynomial-c 1.39 emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install
522 hollow 1.1
523     # install our configuration files
524     keepdir /etc/apache2/vhosts.d
525     keepdir /etc/apache2/modules.d
526    
527     generate_load_module
528     insinto /etc/apache2
529     doins -r "${GENTOO_PATCHDIR}"/conf/*
530 hollow 1.20 use apache2_modules_mime_magic && doins docs/conf/magic
531 hollow 1.1
532     insinto /etc/logrotate.d
533     newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
534    
535     # generate a sane default APACHE2_OPTS
536 hollow 1.18 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
537 hollow 1.1 use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL"
538     use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST"
539     use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC"
540 ssuominen 1.25 if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
541 hollow 1.18 APACHE2_OPTS="${APACHE2_OPTS} -D LANGUAGE"
542     fi
543 hollow 1.1
544     sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
545     "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed"
546    
547     newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
548     newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
549    
550 hollow 1.13 # install apache2ctl wrapper for our init script if available
551     if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then
552     exeinto /usr/sbin
553     doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl
554     else
555     dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
556     fi
557 hollow 1.1
558 hollow 1.6 # provide legacy symlink for apxs, bug 177697
559 polynomial-c 1.36 dosym apxs /usr/sbin/apxs2
560 hollow 1.1
561     # install some documentation
562     dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
563     dodoc "${GENTOO_PATCHDIR}"/docs/*
564    
565     # drop in a convenient link to the manual
566     if use doc ; then
567 ottxor 1.38 sed -i -e "s:VERSION:${PVR}:" "${ED}/etc/apache2/modules.d/00_apache_manual.conf"
568 polynomial-c 1.36 docompress -x /usr/share/doc/${PF}/manual # 503640
569 hollow 1.1 else
570 ottxor 1.38 rm -f "${ED}/etc/apache2/modules.d/00_apache_manual.conf"
571     rm -Rf "${ED}/usr/share/doc/${PF}/manual"
572 hollow 1.1 fi
573    
574 hollow 1.18 # the default icons and error pages get stored in
575     # /usr/share/apache2/{error,icons}
576     dodir /usr/share/apache2
577 ottxor 1.38 mv -f "${ED}/var/www/localhost/error" "${ED}/usr/share/apache2/error"
578     mv -f "${ED}/var/www/localhost/icons" "${ED}/usr/share/apache2/icons"
579     rm -rf "${ED}/var/www/localhost/"
580 hollow 1.1 eend $?
581    
582     # set some sane permissions for suexec
583     if use suexec ; then
584 hollow 1.17 fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
585 hollow 1.1 fperms 4710 /usr/sbin/suexec
586 hollow 1.6 # provide legacy symlink for suexec, bug 177697
587     dosym /usr/sbin/suexec /usr/sbin/suexec2
588 hollow 1.1 fi
589    
590     # empty dirs
591     for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
592     keepdir ${i}
593     fowners apache:apache ${i}
594 patrick 1.28 fperms 0750 ${i}
595 hollow 1.1 done
596     }
597    
598     # @FUNCTION: apache-2_pkg_postinst
599     # @DESCRIPTION:
600     # This function creates test certificates if SSL is enabled and installs the
601 hollow 1.18 # default index.html to /var/www/localhost if it does not exist. We do this here
602 hollow 1.11 # because the default webroot is a copy of the files that exist elsewhere and we
603     # don't want them to be managed/removed by portage when apache is upgraded.
604 hollow 1.1 apache-2_pkg_postinst() {
605 ottxor 1.38 if use ssl && [[ ! -e "${EROOT}/etc/ssl/apache2/server.pem" ]]; then
606 hollow 1.18 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
607     install_cert /etc/ssl/apache2/server
608     ewarn
609     ewarn "The location of SSL certificates has changed. If you are"
610     ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
611     ewarn "*any* apache version), you might want to move your old"
612     ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
613     ewarn "update your config files."
614     ewarn
615 hollow 1.1 fi
616    
617 ottxor 1.38 if [[ ! -e "${EROOT}/var/www/localhost" ]] ; then
618     mkdir -p "${EROOT}/var/www/localhost/htdocs"
619     echo "<html><body><h1>It works!</h1></body></html>" > "${EROOT}/var/www/localhost/htdocs/index.html"
620 hollow 1.1 fi
621 lxnay 1.21
622     echo
623     elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags"
624 zmedico 1.31 elog "in make.conf. Make sure to enable those in order to compile them."
625 hollow 1.24 elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise."
626 lxnay 1.21 echo
627    
628 hollow 1.1 }
629    
630 hollow 1.18 EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20