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

Contents of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.42 - (hide annotations) (download)
Thu Jul 16 06:06:59 2015 UTC (14 months, 2 weeks ago) by polynomial-c
Branch: MAIN
CVS Tags: HEAD
Changes since 1.41: +4 -4 lines
Added slot dependency for openssl. Raised minimum required EAPI version to 5.

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

  ViewVC Help
Powered by ViewVC 1.1.20