/[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.10 Revision 1.12
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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.10 2008/03/23 10:28:45 hollow Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.12 2008/08/29 13:22:21 hollow 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.2* ebuilds 8# @BLURB: Provides a common set of functions for apache-2.x ebuilds
9# @DESCRIPTION: 9# @DESCRIPTION:
10# This eclass handles common apache ebuild functions in a sane way and providing 10# This eclass handles apache-2.x ebuild functions such as LoadModule generation
11# information about where certain interfaces are located such as LoadModule
12# generation and inter-module dependency checking. 11# and inter-module dependency checking.
13 12
14inherit autotools confutils eutils flag-o-matic multilib 13inherit autotools confutils eutils flag-o-matic multilib
15 14
16# ============================================================================== 15# ==============================================================================
17# INTERNAL VARIABLES 16# INTERNAL VARIABLES
42 http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2" 41 http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2"
43 42
44# @VARIABLE: IUSE_MPMS_FORK 43# @VARIABLE: IUSE_MPMS_FORK
45# @DESCRIPTION: 44# @DESCRIPTION:
46# This variable needs to be set in the ebuild and contains a list of forking 45# This variable needs to be set in the ebuild and contains a list of forking
47# (i.e. non-threaded) MPMS 46# (i.e. non-threaded) MPMs
48 47
49# @VARIABLE: IUSE_MPMS_THREAD 48# @VARIABLE: IUSE_MPMS_THREAD
50# @DESCRIPTION: 49# @DESCRIPTION:
51# This variable needs to be set in the ebuild and contains a list of threaded 50# This variable needs to be set in the ebuild and contains a list of threaded
52# MPMS 51# MPMs
53 52
54# @VARIABLE: IUSE_MODULES 53# @VARIABLE: IUSE_MODULES
55# @DESCRIPTION: 54# @DESCRIPTION:
56# This variable needs to be set in the ebuild and contains a list of available 55# This variable needs to be set in the ebuild and contains a list of available
57# built-in modules 56# built-in modules
358# creates the apache user and group and informs about CONFIG_SYSVIPC being 357# creates the apache user and group and informs about CONFIG_SYSVIPC being
359# needed (we don't depend on kernel sources and therefore cannot check). 358# needed (we don't depend on kernel sources and therefore cannot check).
360apache-2_pkg_setup() { 359apache-2_pkg_setup() {
361 check_upgrade 360 check_upgrade
362 361
363 setup_mpm
364 setup_modules
365
366 if use debug; then
367 MY_CONF="${MY_CONF} --enable-maintainer-mode --enable-exception-hook"
368 fi
369
370 # setup apache user and group 362 # setup apache user and group
371 enewgroup apache 81 363 enewgroup apache 81
372 enewuser apache 81 -1 /var/www apache 364 enewuser apache 81 -1 /var/www apache
373 365
366 setup_mpm
367 setup_modules
368
369 if use debug; then
370 MY_CONF="${MY_CONF} --enable-maintainer-mode --enable-exception-hook"
371 fi
372
374 elog "Please note that you need SysV IPC support in your kernel." 373 elog "Please note that you need SysV IPC support in your kernel."
375 elog "Make sure CONFIG_SYSVIPC=y is set." 374 elog "Make sure CONFIG_SYSVIPC=y is set."
376 elog 375 elog
376
377 if use userland_BSD; then
378 elog "On BSD systems you need to add the following line to /boot/loader.conf:"
379 elog " accf_http_load=\"YES\""
380 elog
381 fi
377} 382}
378 383
379# @FUNCTION: apache-2_src_unpack 384# @FUNCTION: apache-2_src_unpack
380# @DESCRIPTION: 385# @DESCRIPTION:
381# This function applies patches, configures a custom file-system layout and 386# This function applies patches, configures a custom file-system layout and
426 --libexecdir=/usr/$(get_libdir)/apache2/modules \ 431 --libexecdir=/usr/$(get_libdir)/apache2/modules \
427 --datadir=/var/www/localhost \ 432 --datadir=/var/www/localhost \
428 --sysconfdir=/etc/apache2 \ 433 --sysconfdir=/etc/apache2 \
429 --localstatedir=/var \ 434 --localstatedir=/var \
430 --with-mpm=${MY_MPM} \ 435 --with-mpm=${MY_MPM} \
431 --with-perl=/usr/bin/perl \
432 --with-apr=/usr \ 436 --with-apr=/usr \
433 --with-apr-util=/usr \ 437 --with-apr-util=/usr \
434 --with-pcre=/usr \ 438 --with-pcre=/usr \
435 --with-z=/usr \ 439 --with-z=/usr \
436 --with-port=80 \ 440 --with-port=80 \
443 emake || die "emake failed" 447 emake || die "emake failed"
444} 448}
445 449
446# @FUNCTION: apache-2_src_install 450# @FUNCTION: apache-2_src_install
447# @DESCRIPTION: 451# @DESCRIPTION:
448# This function runs emake install and generates, installs and adapts the gentoo 452# This function runs `emake install' and generates, installs and adapts the gentoo
449# specific configuration files found in the tarball 453# specific configuration files found in the tarball
450apache-2_src_install() { 454apache-2_src_install() {
451 make DESTDIR="${D}" install || die "make install failed" 455 make DESTDIR="${D}" install || die "make install failed"
452 456
453 # install our configuration files 457 # install our configuration files
494 else 498 else
495 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" 499 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf"
496 rm -Rf "${D}/usr/share/doc/${PF}/manual" 500 rm -Rf "${D}/usr/share/doc/${PF}/manual"
497 fi 501 fi
498 502
499 # the default webroot gets stored in /usr/share/doc 503 # the default webroot gets stored in /usr/share/${PF}/webroot
500 ebegin "Installing default webroot to /usr/share/doc/${PF}" 504 ebegin "Installing default webroot to /usr/share/${PF}/webroot"
505 dodir /usr/share/${PF}
501 mv -f "${D}/var/www/localhost" "${D}/usr/share/doc/${PF}/webroot" 506 mv -f "${D}/var/www/localhost" "${D}/usr/share/${PF}/webroot"
502 eend $? 507 eend $?
503 keepdir /var/www/localhost/htdocs
504 508
505 # set some sane permissions for suexec 509 # set some sane permissions for suexec
506 if use suexec ; then 510 if use suexec ; then
507 fowners 0:apache /usr/sbin/suexec 511 fowners 0:apache /usr/sbin/suexec
508 fperms 4710 /usr/sbin/suexec 512 fperms 4710 /usr/sbin/suexec
522} 526}
523 527
524# @FUNCTION: apache-2_pkg_postinst 528# @FUNCTION: apache-2_pkg_postinst
525# @DESCRIPTION: 529# @DESCRIPTION:
526# This function creates test certificates if SSL is enabled and installs the 530# This function creates test certificates if SSL is enabled and installs the
527# default webroot if /var/www/localhost does not exist. We do this here because 531# default webroot to /var/www/localhost if it does not exist. We do this here
528# the default webroot is a copy of the files that exist elsewhere and we don't 532# because the default webroot is a copy of the files that exist elsewhere and we
529# want them to be managed/removed by portage when apache is upgraded. 533# don't want them to be managed/removed by portage when apache is upgraded.
530apache-2_pkg_postinst() { 534apache-2_pkg_postinst() {
535 einfo
536
531 if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then 537 if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then
532 cd "${ROOT}"/etc/apache2/ssl 538 cd "${ROOT}"/etc/apache2/ssl
533 einfo
534 einfo "Generating self-signed test certificate in ${ROOT}etc/apache2/ssl ..." 539 einfo "Generating self-signed test certificate in ${ROOT}etc/apache2/ssl ..."
535 yes "" 2>/dev/null | \ 540 yes "" 2>/dev/null | \
536 "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \ 541 "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \
537 die "gentestcrt.sh failed" 542 die "gentestcrt.sh failed"
538 einfo 543 einfo
547 elog "emerge --config =${PF}" 552 elog "emerge --config =${PF}"
548 elog 553 elog
549 else 554 else
550 einfo "Installing default webroot to ${ROOT}var/www/localhost" 555 einfo "Installing default webroot to ${ROOT}var/www/localhost"
551 mkdir -p "${ROOT}"/var/www/localhost 556 mkdir -p "${ROOT}"/var/www/localhost
552 cp -R "${ROOT}"/usr/share/doc/${PF}/webroot/* "${ROOT}"/var/www/localhost 557 cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/
553 chown -R apache:0 "${ROOT}"/var/www/localhost 558 einfo
554 fi 559 fi
555} 560}
556 561
557# @FUNCTION: apache-2_pkg_config 562# @FUNCTION: apache-2_pkg_config
558# @DESCRIPTION: 563# @DESCRIPTION:
559# This function installs -- and removes a previously existing -- default webroot 564# This function installs -- and overwrites -- the default webroot to
560# to /var/www/localhost 565# /var/www/localhost
561apache-2_pkg_config() { 566apache-2_pkg_config() {
562 einfo "Installing default webroot to ${ROOT}var/www/localhost" 567 einfo "Installing default webroot to ${ROOT}var/www/localhost"
563 mkdir "${ROOT}"var{,/www{,/localhost}} 568 mkdir -p "${ROOT}"/var/www/localhost
564 cp -R "${ROOT}"usr/share/doc/${PF}/webroot/* "${ROOT}"var/www/localhost/ 569 cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/
565} 570}
566 571
567EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_config 572EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_config

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20