/[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.9 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.9 2008/03/23 00:14:13 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 5# @ECLASS: apache-2.eclass
6# @MAINTAINER:
6# @MAINTAINER: apache-devs@gentoo.org 7# apache-devs@gentoo.org
7# @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
8# @DESCRIPTION: 9# @DESCRIPTION:
9# 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
10# information about where certain interfaces are located such as LoadModule
11# generation and inter-module dependency checking. 11# and inter-module dependency checking.
12 12
13inherit autotools confutils eutils flag-o-matic multilib 13inherit autotools confutils eutils flag-o-matic multilib
14 14
15# ============================================================================== 15# ==============================================================================
16# INTERNAL VARIABLES 16# INTERNAL VARIABLES
41 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"
42 42
43# @VARIABLE: IUSE_MPMS_FORK 43# @VARIABLE: IUSE_MPMS_FORK
44# @DESCRIPTION: 44# @DESCRIPTION:
45# 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
46# (i.e. non-threaded) MPMS 46# (i.e. non-threaded) MPMs
47 47
48# @VARIABLE: IUSE_MPMS_THREAD 48# @VARIABLE: IUSE_MPMS_THREAD
49# @DESCRIPTION: 49# @DESCRIPTION:
50# 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
51# MPMS 51# MPMs
52 52
53# @VARIABLE: IUSE_MODULES 53# @VARIABLE: IUSE_MODULES
54# @DESCRIPTION: 54# @DESCRIPTION:
55# 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
56# built-in modules 56# built-in modules
357# 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
358# 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).
359apache-2_pkg_setup() { 359apache-2_pkg_setup() {
360 check_upgrade 360 check_upgrade
361 361
362 setup_mpm
363 setup_modules
364
365 if use debug; then
366 MY_CONF="${MY_CONF} --enable-maintainer-mode --enable-exception-hook"
367 fi
368
369 # setup apache user and group 362 # setup apache user and group
370 enewgroup apache 81 363 enewgroup apache 81
371 enewuser apache 81 -1 /var/www apache 364 enewuser apache 81 -1 /var/www apache
372 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
373 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."
374 elog "Make sure CONFIG_SYSVIPC=y is set." 374 elog "Make sure CONFIG_SYSVIPC=y is set."
375 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
376} 382}
377 383
378# @FUNCTION: apache-2_src_unpack 384# @FUNCTION: apache-2_src_unpack
379# @DESCRIPTION: 385# @DESCRIPTION:
380# This function applies patches, configures a custom file-system layout and 386# This function applies patches, configures a custom file-system layout and
425 --libexecdir=/usr/$(get_libdir)/apache2/modules \ 431 --libexecdir=/usr/$(get_libdir)/apache2/modules \
426 --datadir=/var/www/localhost \ 432 --datadir=/var/www/localhost \
427 --sysconfdir=/etc/apache2 \ 433 --sysconfdir=/etc/apache2 \
428 --localstatedir=/var \ 434 --localstatedir=/var \
429 --with-mpm=${MY_MPM} \ 435 --with-mpm=${MY_MPM} \
430 --with-perl=/usr/bin/perl \
431 --with-apr=/usr \ 436 --with-apr=/usr \
432 --with-apr-util=/usr \ 437 --with-apr-util=/usr \
433 --with-pcre=/usr \ 438 --with-pcre=/usr \
434 --with-z=/usr \ 439 --with-z=/usr \
435 --with-port=80 \ 440 --with-port=80 \
442 emake || die "emake failed" 447 emake || die "emake failed"
443} 448}
444 449
445# @FUNCTION: apache-2_src_install 450# @FUNCTION: apache-2_src_install
446# @DESCRIPTION: 451# @DESCRIPTION:
447# 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
448# specific configuration files found in the tarball 453# specific configuration files found in the tarball
449apache-2_src_install() { 454apache-2_src_install() {
450 make DESTDIR="${D}" install || die "make install failed" 455 make DESTDIR="${D}" install || die "make install failed"
451 456
452 # install our configuration files 457 # install our configuration files
493 else 498 else
494 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" 499 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf"
495 rm -Rf "${D}/usr/share/doc/${PF}/manual" 500 rm -Rf "${D}/usr/share/doc/${PF}/manual"
496 fi 501 fi
497 502
498 # the default webroot gets stored in /usr/share/doc 503 # the default webroot gets stored in /usr/share/${PF}/webroot
499 ebegin "Installing default webroot to /usr/share/doc/${PF}" 504 ebegin "Installing default webroot to /usr/share/${PF}/webroot"
505 dodir /usr/share/${PF}
500 mv -f "${D}/var/www/localhost" "${D}/usr/share/doc/${PF}/webroot" 506 mv -f "${D}/var/www/localhost" "${D}/usr/share/${PF}/webroot"
501 eend $? 507 eend $?
502 keepdir /var/www/localhost/htdocs
503 508
504 # set some sane permissions for suexec 509 # set some sane permissions for suexec
505 if use suexec ; then 510 if use suexec ; then
506 fowners 0:apache /usr/sbin/suexec 511 fowners 0:apache /usr/sbin/suexec
507 fperms 4710 /usr/sbin/suexec 512 fperms 4710 /usr/sbin/suexec
521} 526}
522 527
523# @FUNCTION: apache-2_pkg_postinst 528# @FUNCTION: apache-2_pkg_postinst
524# @DESCRIPTION: 529# @DESCRIPTION:
525# 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
526# 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
527# 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
528# 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.
529apache-2_pkg_postinst() { 534apache-2_pkg_postinst() {
535 einfo
536
530 if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then 537 if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then
531 cd "${ROOT}"/etc/apache2/ssl 538 cd "${ROOT}"/etc/apache2/ssl
532 einfo
533 einfo "Generating self-signed test certificate in ${ROOT}etc/apache2/ssl ..." 539 einfo "Generating self-signed test certificate in ${ROOT}etc/apache2/ssl ..."
534 yes "" 2>/dev/null | \ 540 yes "" 2>/dev/null | \
535 "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \ 541 "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \
536 die "gentestcrt.sh failed" 542 die "gentestcrt.sh failed"
537 einfo 543 einfo
546 elog "emerge --config =${PF}" 552 elog "emerge --config =${PF}"
547 elog 553 elog
548 else 554 else
549 einfo "Installing default webroot to ${ROOT}var/www/localhost" 555 einfo "Installing default webroot to ${ROOT}var/www/localhost"
550 mkdir -p "${ROOT}"/var/www/localhost 556 mkdir -p "${ROOT}"/var/www/localhost
551 cp -R "${ROOT}"/usr/share/doc/${PF}/webroot/* "${ROOT}"/var/www/localhost 557 cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/
552 chown -R apache:0 "${ROOT}"/var/www/localhost 558 einfo
553 fi 559 fi
554} 560}
555 561
556# @FUNCTION: apache-2_pkg_config 562# @FUNCTION: apache-2_pkg_config
557# @DESCRIPTION: 563# @DESCRIPTION:
558# This function installs -- and removes a previously existing -- default webroot 564# This function installs -- and overwrites -- the default webroot to
559# to /var/www/localhost 565# /var/www/localhost
560apache-2_pkg_config() { 566apache-2_pkg_config() {
561 einfo "Installing default webroot to ${ROOT}var/www/localhost" 567 einfo "Installing default webroot to ${ROOT}var/www/localhost"
562 mkdir "${ROOT}"var{,/www{,/localhost}} 568 mkdir -p "${ROOT}"/var/www/localhost
563 cp -R "${ROOT}"usr/share/doc/${PF}/webroot/* "${ROOT}"var/www/localhost/ 569 cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/
564} 570}
565 571
566EXPORT_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.9  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20