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

Diff of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.11 Revision 1.37
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2014 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.11 2008/03/23 13:03:53 hollow Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.37 2014/07/30 19:01:02 robbat2 Exp $
4 4
5# @ECLASS: apache-2.eclass 5# @ECLASS: apache-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# apache-devs@gentoo.org 7# apache-devs@gentoo.org
8# @BLURB: Provides a common set of functions for apache-2.x ebuilds 8# @BLURB: Provides a common set of functions for apache-2.x ebuilds
9# @DESCRIPTION: 9# @DESCRIPTION:
10# This eclass handles apache-2.x ebuild functions such as LoadModule generation 10# This eclass handles apache-2.x ebuild functions such as LoadModule generation
11# and inter-module dependency checking. 11# and inter-module dependency checking.
12 12
13inherit autotools confutils eutils flag-o-matic multilib 13inherit 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
18case ${EAPI:-0} in
19 0|1|2|3)
20 die "This eclass requires >=EAPI-4"
21 ;;
22esac
23
24# settings which are version specific go in here:
25case $(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 ;;
34esac
14 35
15# ============================================================================== 36# ==============================================================================
16# INTERNAL VARIABLES 37# INTERNAL VARIABLES
17# ============================================================================== 38# ==============================================================================
18 39
19# @ECLASS-VARIABLE: GENTOO_PATCHNAME 40# @ECLASS-VARIABLE: GENTOO_PATCHNAME
20# @DESCRIPTION: 41# @DESCRIPTION:
21# This internal variable contains the prefix for the patch tarball 42# This internal variable contains the prefix for the patch tarball.
22GENTOO_PATCHNAME="gentoo-${PF}" 43# 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[[ -n "$GENTOO_PATCHNAME" ]] || GENTOO_PATCHNAME="gentoo-${PF}"
23 48
24# @ECLASS-VARIABLE: GENTOO_PATCHDIR 49# @ECLASS-VARIABLE: GENTOO_PATCHDIR
25# @DESCRIPTION: 50# @DESCRIPTION:
26# This internal variable contains the working directory where patches and config 51# This internal variable contains the working directory where patches and config
27# files are located 52# files are located.
53# Defaults to the patchset name appended to the working directory.
28GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}" 54[[ -n "$GENTOO_PATCHDIR" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}"
29 55
30# @VARIABLE: GENTOO_DEVELOPER 56# @VARIABLE: GENTOO_DEVELOPER
31# @DESCRIPTION: 57# @DESCRIPTION:
32# This variable needs to be set in the ebuild and contains the name of the 58# This variable needs to be set in the ebuild and contains the name of the
33# gentoo developer who created the patch tarball 59# gentoo developer who created the patch tarball
35# @VARIABLE: GENTOO_PATCHSTAMP 61# @VARIABLE: GENTOO_PATCHSTAMP
36# @DESCRIPTION: 62# @DESCRIPTION:
37# This variable needs to be set in the ebuild and contains the date the patch 63# This variable needs to be set in the ebuild and contains the date the patch
38# tarball was created at in YYYYMMDD format 64# tarball was created at in YYYYMMDD format
39 65
66# @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
40SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2 72SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2
41 http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2" 73 http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}"
42 74
43# @VARIABLE: IUSE_MPMS_FORK 75# @VARIABLE: IUSE_MPMS_FORK
44# @DESCRIPTION: 76# @DESCRIPTION:
45# This variable needs to be set in the ebuild and contains a list of forking 77# This variable needs to be set in the ebuild and contains a list of forking
46# (i.e. non-threaded) MPMs 78# (i.e. non-threaded) MPMs
66 IUSE="${IUSE} apache2_mpms_${mpm}" 98 IUSE="${IUSE} apache2_mpms_${mpm}"
67done 99done
68 100
69DEPEND="dev-lang/perl 101DEPEND="dev-lang/perl
70 =dev-libs/apr-1* 102 =dev-libs/apr-1*
71 =dev-libs/apr-util-1* 103 =dev-libs/apr-util-1*[ldap?]
72 dev-libs/libpcre 104 dev-libs/libpcre
105 apache2_modules_deflate? ( sys-libs/zlib )
106 apache2_modules_mime? ( app-misc/mime-types )
73 ldap? ( =net-nds/openldap-2* ) 107 ldap? ( =net-nds/openldap-2* )
74 selinux? ( sec-policy/selinux-apache ) 108 selinux? ( sec-policy/selinux-apache )
75 ssl? ( >=dev-libs/openssl-0.9.8f ) 109 ssl? ( >=dev-libs/openssl-0.9.8m )
76 !=www-servers/apache-1*" 110 !=www-servers/apache-1*"
77RDEPEND="${DEPEND}" 111RDEPEND+=" ${DEPEND}"
78PDEPEND="~app-admin/apache-tools-${PV}" 112PDEPEND="~app-admin/apache-tools-${PV}"
79 113
80S="${WORKDIR}/httpd-${PV}" 114S="${WORKDIR}/httpd-${PV}"
81 115
82# ============================================================================== 116# ==============================================================================
108 fi 142 fi
109 done 143 done
110 144
111 if [[ -z "${MY_MPM}" ]] ; then 145 if [[ -z "${MY_MPM}" ]] ; then
112 if use threads ; then 146 if use threads ; then
113 MY_MPM=worker 147 MY_MPM=${DEFAULT_MPM_THREADED}
114 elog 148 elog
115 elog "Selected default threaded MPM: ${MY_MPM}" 149 elog "Selected default threaded MPM: ${MY_MPM}"
116 elog 150 elog
117 else 151 else
118 MY_MPM=prefork 152 MY_MPM=prefork
158 ewarn "You have disabled one or more required modules" 192 ewarn "You have disabled one or more required modules"
159 ewarn "for the default apache configuration." 193 ewarn "for the default apache configuration."
160 ewarn "Although this is not an error, please be" 194 ewarn "Although this is not an error, please be"
161 ewarn "aware that this setup is UNSUPPORTED." 195 ewarn "aware that this setup is UNSUPPORTED."
162 ewarn 196 ewarn
163 ebeep 10
164 fi 197 fi
165} 198}
166 199
167# @VARIABLE: MODULE_DEPENDS 200# @VARIABLE: MODULE_DEPENDS
168# @DESCRIPTION: 201# @DESCRIPTION:
217 fi 250 fi
218 251
219 MY_CONF="--enable-so=static" 252 MY_CONF="--enable-so=static"
220 253
221 if use ldap ; then 254 if use ldap ; then
222 confutils_use_depend_built_with_all ldap dev-libs/apr-util ldap
223 MY_CONF="${MY_CONF} --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type}" 255 MY_CONF+=" --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type}"
224 MY_MODS="${MY_MODS} ldap authnz_ldap" 256 MY_MODS+=" ldap authnz_ldap"
225 else 257 else
226 MY_CONF="${MY_CONF} --disable-authnz_ldap --disable-ldap" 258 MY_CONF+=" --disable-authnz_ldap --disable-ldap"
227 fi 259 fi
228 260
229 if use ssl ; then 261 if use ssl ; then
230 MY_CONF="${MY_CONF} --with-ssl=/usr --enable-ssl=${mod_type}" 262 MY_CONF+=" --with-ssl=/usr --enable-ssl=${mod_type}"
231 MY_MODS="${MY_MODS} ssl" 263 MY_MODS+=" ssl"
232 else 264 else
233 MY_CONF="${MY_CONF} --without-ssl --disable-ssl" 265 MY_CONF+=" --without-ssl --disable-ssl"
234 fi
235
236 if use threads || has ${MY_MPM} ${IUSE_MPMS_THREAD} ; then
237 MY_CONF="${MY_CONF} --enable-cgid=${mod_type}"
238 MY_MODS="${MY_MODS} cgid"
239 else
240 MY_CONF="${MY_CONF} --enable-cgi=${mod_type}"
241 MY_MODS="${MY_MODS} cgi"
242 fi 266 fi
243 267
244 if use suexec ; then 268 if use suexec ; then
245 elog "You can manipulate several configure options of suexec" 269 elog "You can manipulate several configure options of suexec"
246 elog "through the following environment variables:" 270 elog "through the following environment variables:"
253 elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)" 277 elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)"
254 elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)" 278 elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)"
255 elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)" 279 elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
256 elog 280 elog
257 281
258 MY_CONF="${MY_CONF} --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}" 282 MY_CONF+=" --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}"
259 MY_CONF="${MY_CONF} --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}" 283 MY_CONF+=" --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}"
260 MY_CONF="${MY_CONF} --with-suexec-bin=/usr/sbin/suexec" 284 MY_CONF+=" --with-suexec-bin=/usr/sbin/suexec"
261 MY_CONF="${MY_CONF} --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}" 285 MY_CONF+=" --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}"
262 MY_CONF="${MY_CONF} --with-suexec-caller=${SUEXEC_CALLER:-apache}" 286 MY_CONF+=" --with-suexec-caller=${SUEXEC_CALLER:-apache}"
263 MY_CONF="${MY_CONF} --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}" 287 MY_CONF+=" --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}"
264 MY_CONF="${MY_CONF} --with-suexec-uidmin=${SUEXEC_MINUID:-1000}" 288 MY_CONF+=" --with-suexec-uidmin=${SUEXEC_MINUID:-1000}"
265 MY_CONF="${MY_CONF} --with-suexec-gidmin=${SUEXEC_MINGID:-100}" 289 MY_CONF+=" --with-suexec-gidmin=${SUEXEC_MINGID:-100}"
266 MY_CONF="${MY_CONF} --with-suexec-umask=${SUEXEC_UMASK:-077}" 290 MY_CONF+=" --with-suexec-umask=${SUEXEC_UMASK:-077}"
267 MY_CONF="${MY_CONF} --enable-suexec=${mod_type}" 291 MY_CONF+=" --enable-suexec=${mod_type}"
268 MY_MODS="${MY_MODS} suexec" 292 MY_MODS+=" suexec"
269 else 293 else
270 MY_CONF="${MY_CONF} --disable-suexec" 294 MY_CONF+=" --disable-suexec"
271 fi 295 fi
272 296
273 for x in ${IUSE_MODULES} ; do 297 for x in ${IUSE_MODULES} ; do
274 if use apache2_modules_${x} ; then 298 if use apache2_modules_${x} ; then
275 MY_CONF="${MY_CONF} --enable-${x}=${mod_type}" 299 MY_CONF+=" --enable-${x}=${mod_type}"
276 MY_MODS="${MY_MODS} ${x}" 300 MY_MODS+=" ${x}"
277 else 301 else
278 MY_CONF="${MY_CONF} --disable-${x}" 302 MY_CONF+=" --disable-${x}"
279 fi 303 fi
280 done 304 done
281 305
282 # sort and uniquify MY_MODS 306 # sort and uniquify MY_MODS
283 MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u) 307 MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u)
365 389
366 setup_mpm 390 setup_mpm
367 setup_modules 391 setup_modules
368 392
369 if use debug; then 393 if use debug; then
370 MY_CONF="${MY_CONF} --enable-maintainer-mode --enable-exception-hook" 394 MY_CONF+=" --enable-maintainer-mode --enable-exception-hook"
371 fi 395 fi
372 396
373 elog "Please note that you need SysV IPC support in your kernel." 397 elog "Please note that you need SysV IPC support in your kernel."
374 elog "Make sure CONFIG_SYSVIPC=y is set." 398 elog "Make sure CONFIG_SYSVIPC=y is set."
375 elog 399 elog
376}
377 400
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}
407
378# @FUNCTION: apache-2_src_unpack 408# @FUNCTION: apache-2_src_prepare
379# @DESCRIPTION: 409# @DESCRIPTION:
380# This function applies patches, configures a custom file-system layout and 410# This function applies patches, configures a custom file-system layout and
381# rebuilds the configure scripts. 411# rebuilds the configure scripts.
382apache-2_src_unpack() { 412apache-2_src_prepare() {
383 unpack ${A} 413 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
384 cd "${S}" 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
385 430
386 # Use correct multilib libdir in gentoo patches 431 # Use correct multilib libdir in gentoo patches
387 sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \ 432 sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \
388 "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \ 433 "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \
389 || die "libdir sed failed" 434 || die "libdir sed failed"
399 mv docs/man/{httpd,apache2}.8 444 mv docs/man/{httpd,apache2}.8
400 sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in 445 sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
401 446
402 # patched-in MPMs need the build environment rebuilt 447 # patched-in MPMs need the build environment rebuilt
403 sed -i -e '/sinclude/d' configure.in 448 sed -i -e '/sinclude/d' configure.in
404 AT_GNUCONF_UPDATE=yes AT_M4DIR=build eautoreconf 449 AT_M4DIR=build eautoreconf
405}
406 450
451 # ${T} must be not group-writable, else grsec TPE will block it
452 chmod g-w "${T}"
453
454 # 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}
462
407# @FUNCTION: apache-2_src_compile 463# @FUNCTION: apache-2_src_configure
408# @DESCRIPTION: 464# @DESCRIPTION:
409# This function adds compiler flags and runs econf and emake based on MY_MPM and 465# This function adds compiler flags and runs econf and emake based on MY_MPM and
410# MY_CONF 466# MY_CONF
411apache-2_src_compile() { 467apache-2_src_configure() {
468 tc-export PKG_CONFIG
469
470 # 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
412 # Instead of filtering --as-needed (bug #128505), append --no-as-needed 477 # Instead of filtering --as-needed (bug #128505), append --no-as-needed
413 # Thanks to Harald van Dijk 478 # Thanks to Harald van Dijk
414 append-ldflags -Wl,--no-as-needed 479 append-ldflags $(no-as-needed)
415 480
416 # peruser MPM debugging with -X is nearly impossible 481 # peruser MPM debugging with -X is nearly impossible
417 if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then 482 if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
418 use debug && append-flags -DMPM_PERUSER_DEBUG 483 use debug && append-flags -DMPM_PERUSER_DEBUG
419 fi 484 fi
420 485
421 # econf overwrites the stuff from config.layout, so we have to put them into 486 # econf overwrites the stuff from config.layout, so we have to put them into
422 # our myconf line too 487 # our myconf line too
488 ac_cv_path_PKGCONFIG=${PKG_CONFIG} \
423 econf \ 489 econf \
424 --includedir=/usr/include/apache2 \ 490 --includedir=/usr/include/apache2 \
425 --libexecdir=/usr/$(get_libdir)/apache2/modules \ 491 --libexecdir=/usr/$(get_libdir)/apache2/modules \
426 --datadir=/var/www/localhost \ 492 --datadir=/var/www/localhost \
427 --sysconfdir=/etc/apache2 \ 493 --sysconfdir=/etc/apache2 \
428 --localstatedir=/var \ 494 --localstatedir=/var \
429 --with-mpm=${MY_MPM} \ 495 --with-mpm=${MY_MPM} \
430 --with-perl=/usr/bin/perl \
431 --with-apr=/usr \ 496 --with-apr="${SYSROOT}"/usr \
432 --with-apr-util=/usr \ 497 --with-apr-util="${SYSROOT}"/usr \
433 --with-pcre=/usr \ 498 --with-pcre="${T}"/pcre-config \
434 --with-z=/usr \ 499 --with-z=/usr \
435 --with-port=80 \ 500 --with-port=80 \
436 --with-program-name=apache2 \ 501 --with-program-name=apache2 \
437 --enable-layout=Gentoo \ 502 --enable-layout=Gentoo \
438 ${MY_CONF} || die "econf failed!" 503 ${MY_CONF} || die "econf failed!"
439 504
440 sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h 505 sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h
441
442 emake || die "emake failed"
443} 506}
444 507
445# @FUNCTION: apache-2_src_install 508# @FUNCTION: apache-2_src_install
446# @DESCRIPTION: 509# @DESCRIPTION:
447# This function runs `emake install' and generates, installs and adapts the gentoo 510# This function runs `emake install' and generates, installs and adapts the gentoo
448# specific configuration files found in the tarball 511# specific configuration files found in the tarball
449apache-2_src_install() { 512apache-2_src_install() {
450 make DESTDIR="${D}" install || die "make install failed" 513 emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install || die "make install failed"
451 514
452 # install our configuration files 515 # install our configuration files
453 keepdir /etc/apache2/vhosts.d 516 keepdir /etc/apache2/vhosts.d
454 keepdir /etc/apache2/modules.d 517 keepdir /etc/apache2/modules.d
455 518
456 generate_load_module 519 generate_load_module
457 insinto /etc/apache2 520 insinto /etc/apache2
458 doins -r "${GENTOO_PATCHDIR}"/conf/* 521 doins -r "${GENTOO_PATCHDIR}"/conf/*
459 doins docs/conf/magic 522 use apache2_modules_mime_magic && doins docs/conf/magic
460 523
461 insinto /etc/logrotate.d 524 insinto /etc/logrotate.d
462 newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2 525 newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
463 526
464 # generate a sane default APACHE2_OPTS 527 # generate a sane default APACHE2_OPTS
465 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE" 528 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
466 use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL" 529 use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL"
467 use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST" 530 use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST"
468 use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC" 531 use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC"
532 if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
533 APACHE2_OPTS="${APACHE2_OPTS} -D LANGUAGE"
534 fi
469 535
470 sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \ 536 sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
471 "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed" 537 "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed"
472 538
473 newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2 539 newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
474 newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2 540 newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
475 541
476 # link apache2ctl to the init script 542 # 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
477 dosym /etc/init.d/apache2 /usr/sbin/apache2ctl 547 dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
548 fi
478 549
479 # provide legacy symlink for apxs, bug 177697 550 # provide legacy symlink for apxs, bug 177697
480 dosym /usr/sbin/apxs /usr/sbin/apxs2 551 dosym apxs /usr/sbin/apxs2
481
482 # install some thirdparty scripts
483 exeinto /usr/sbin
484 use ssl && doexe "${GENTOO_PATCHDIR}"/scripts/gentestcrt.sh
485 552
486 # install some documentation 553 # install some documentation
487 dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING 554 dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
488 dodoc "${GENTOO_PATCHDIR}"/docs/* 555 dodoc "${GENTOO_PATCHDIR}"/docs/*
489 556
490 # drop in a convenient link to the manual 557 # drop in a convenient link to the manual
491 if use doc ; then 558 if use doc ; then
492 sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf" 559 sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf"
560 docompress -x /usr/share/doc/${PF}/manual # 503640
493 else 561 else
494 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" 562 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf"
495 rm -Rf "${D}/usr/share/doc/${PF}/manual" 563 rm -Rf "${D}/usr/share/doc/${PF}/manual"
496 fi 564 fi
497 565
498 # the default webroot gets stored in /usr/share/${PF}/webroot 566 # the default icons and error pages get stored in
499 ebegin "Installing default webroot to /usr/share/${PF}/webroot" 567 # /usr/share/apache2/{error,icons}
500 dodir /usr/share/${PF} 568 dodir /usr/share/apache2
501 mv -f "${D}/var/www/localhost" "${D}/usr/share/${PF}/webroot" 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/"
502 eend $? 572 eend $?
503 573
504 # set some sane permissions for suexec 574 # set some sane permissions for suexec
505 if use suexec ; then 575 if use suexec ; then
506 fowners 0:apache /usr/sbin/suexec 576 fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
507 fperms 4710 /usr/sbin/suexec 577 fperms 4710 /usr/sbin/suexec
508 # provide legacy symlink for suexec, bug 177697 578 # provide legacy symlink for suexec, bug 177697
509 dosym /usr/sbin/suexec /usr/sbin/suexec2 579 dosym /usr/sbin/suexec /usr/sbin/suexec2
510 fi 580 fi
511 581
512 # empty dirs 582 # empty dirs
513 for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do 583 for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
514 keepdir ${i} 584 keepdir ${i}
515 fowners apache:apache ${i} 585 fowners apache:apache ${i}
516 fperms 0755 ${i} 586 fperms 0750 ${i}
517 done 587 done
518
519 # we need /etc/apache2/ssl if USE=ssl
520 use ssl && keepdir /etc/apache2/ssl
521} 588}
522 589
523# @FUNCTION: apache-2_pkg_postinst 590# @FUNCTION: apache-2_pkg_postinst
524# @DESCRIPTION: 591# @DESCRIPTION:
525# This function creates test certificates if SSL is enabled and installs the 592# This function creates test certificates if SSL is enabled and installs the
526# default webroot to /var/www/localhost if it does not exist. We do this here 593# default index.html to /var/www/localhost if it does not exist. We do this here
527# because the default webroot is a copy of the files that exist elsewhere and we 594# because the default webroot is a copy of the files that exist elsewhere and we
528# don't want them to be managed/removed by portage when apache is upgraded. 595# don't want them to be managed/removed by portage when apache is upgraded.
529apache-2_pkg_postinst() { 596apache-2_pkg_postinst() {
530 einfo
531
532 if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then 597 if use ssl && [[ ! -e "${ROOT}/etc/ssl/apache2/server.pem" ]]; then
533 cd "${ROOT}"/etc/apache2/ssl 598 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
534 einfo "Generating self-signed test certificate in ${ROOT}etc/apache2/ssl ..." 599 install_cert /etc/ssl/apache2/server
535 yes "" 2>/dev/null | \ 600 ewarn
536 "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \ 601 ewarn "The location of SSL certificates has changed. If you are"
537 die "gentestcrt.sh failed" 602 ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
538 einfo 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
539 fi 607 fi
540 608
541 if [[ -e "${ROOT}/var/www/localhost" ]] ; then 609 if [[ ! -e "${ROOT}/var/www/localhost" ]] ; then
542 elog "The default webroot has not been installed into"
543 elog "${ROOT}var/www/localhost because the directory already exists"
544 elog "and we do not want to overwrite any files you have put there."
545 elog
546 elog "If you would like to install the latest webroot, please run"
547 elog "emerge --config =${PF}"
548 elog
549 else
550 einfo "Installing default webroot to ${ROOT}var/www/localhost"
551 mkdir -p "${ROOT}"/var/www/localhost 610 mkdir -p "${ROOT}/var/www/localhost/htdocs"
552 cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/ 611 echo "<html><body><h1>It works!</h1></body></html>" > "${ROOT}/var/www/localhost/htdocs/index.html"
553 einfo
554 fi 612 fi
555}
556 613
557# @FUNCTION: apache-2_pkg_config 614 echo
558# @DESCRIPTION: 615 elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags"
559# This function installs -- and overwrites -- the default webroot to 616 elog "in make.conf. Make sure to enable those in order to compile them."
560# /var/www/localhost 617 elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise."
561apache-2_pkg_config() { 618 echo
562 einfo "Installing default webroot to ${ROOT}var/www/localhost"
563 mkdir -p "${ROOT}"/var/www/localhost
564 cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/
565}
566 619
620}
621
567EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_config 622EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.37

  ViewVC Help
Powered by ViewVC 1.1.20