| 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.11 2008/03/23 13:03:53 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 | |
| 14 | inherit autotools confutils eutils flag-o-matic multilib |
13 | inherit 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). |
| 360 | apache-2_pkg_setup() { |
359 | apache-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 |
|
|
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 |
| 373 | |
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 |
| 377 | } |
376 | } |
| … | |
… | |
| 443 | emake || die "emake failed" |
442 | emake || die "emake failed" |
| 444 | } |
443 | } |
| 445 | |
444 | |
| 446 | # @FUNCTION: apache-2_src_install |
445 | # @FUNCTION: apache-2_src_install |
| 447 | # @DESCRIPTION: |
446 | # @DESCRIPTION: |
| 448 | # This function runs emake install and generates, installs and adapts the gentoo |
447 | # This function runs `emake install' and generates, installs and adapts the gentoo |
| 449 | # specific configuration files found in the tarball |
448 | # specific configuration files found in the tarball |
| 450 | apache-2_src_install() { |
449 | apache-2_src_install() { |
| 451 | make DESTDIR="${D}" install || die "make install failed" |
450 | make DESTDIR="${D}" install || die "make install failed" |
| 452 | |
451 | |
| 453 | # install our configuration files |
452 | # install our configuration files |
| … | |
… | |
| 494 | else |
493 | else |
| 495 | rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" |
494 | rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" |
| 496 | rm -Rf "${D}/usr/share/doc/${PF}/manual" |
495 | rm -Rf "${D}/usr/share/doc/${PF}/manual" |
| 497 | fi |
496 | fi |
| 498 | |
497 | |
| 499 | # the default webroot gets stored in /usr/share/doc |
498 | # the default webroot gets stored in /usr/share/${PF}/webroot |
| 500 | ebegin "Installing default webroot to /usr/share/doc/${PF}" |
499 | ebegin "Installing default webroot to /usr/share/${PF}/webroot" |
|
|
500 | dodir /usr/share/${PF} |
| 501 | mv -f "${D}/var/www/localhost" "${D}/usr/share/doc/${PF}/webroot" |
501 | mv -f "${D}/var/www/localhost" "${D}/usr/share/${PF}/webroot" |
| 502 | eend $? |
502 | eend $? |
| 503 | keepdir /var/www/localhost/htdocs |
|
|
| 504 | |
503 | |
| 505 | # set some sane permissions for suexec |
504 | # set some sane permissions for suexec |
| 506 | if use suexec ; then |
505 | if use suexec ; then |
| 507 | fowners 0:apache /usr/sbin/suexec |
506 | fowners 0:apache /usr/sbin/suexec |
| 508 | fperms 4710 /usr/sbin/suexec |
507 | fperms 4710 /usr/sbin/suexec |
| … | |
… | |
| 522 | } |
521 | } |
| 523 | |
522 | |
| 524 | # @FUNCTION: apache-2_pkg_postinst |
523 | # @FUNCTION: apache-2_pkg_postinst |
| 525 | # @DESCRIPTION: |
524 | # @DESCRIPTION: |
| 526 | # This function creates test certificates if SSL is enabled and installs the |
525 | # 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 |
526 | # 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 |
527 | # 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. |
528 | # don't want them to be managed/removed by portage when apache is upgraded. |
| 530 | apache-2_pkg_postinst() { |
529 | apache-2_pkg_postinst() { |
|
|
530 | einfo |
|
|
531 | |
| 531 | if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then |
532 | if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then |
| 532 | cd "${ROOT}"/etc/apache2/ssl |
533 | cd "${ROOT}"/etc/apache2/ssl |
| 533 | einfo |
|
|
| 534 | einfo "Generating self-signed test certificate in ${ROOT}etc/apache2/ssl ..." |
534 | einfo "Generating self-signed test certificate in ${ROOT}etc/apache2/ssl ..." |
| 535 | yes "" 2>/dev/null | \ |
535 | yes "" 2>/dev/null | \ |
| 536 | "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \ |
536 | "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \ |
| 537 | die "gentestcrt.sh failed" |
537 | die "gentestcrt.sh failed" |
| 538 | einfo |
538 | einfo |
| … | |
… | |
| 547 | elog "emerge --config =${PF}" |
547 | elog "emerge --config =${PF}" |
| 548 | elog |
548 | elog |
| 549 | else |
549 | else |
| 550 | einfo "Installing default webroot to ${ROOT}var/www/localhost" |
550 | einfo "Installing default webroot to ${ROOT}var/www/localhost" |
| 551 | mkdir -p "${ROOT}"/var/www/localhost |
551 | mkdir -p "${ROOT}"/var/www/localhost |
| 552 | cp -R "${ROOT}"/usr/share/doc/${PF}/webroot/* "${ROOT}"/var/www/localhost |
552 | cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/ |
| 553 | chown -R apache:0 "${ROOT}"/var/www/localhost |
553 | einfo |
| 554 | fi |
554 | fi |
| 555 | } |
555 | } |
| 556 | |
556 | |
| 557 | # @FUNCTION: apache-2_pkg_config |
557 | # @FUNCTION: apache-2_pkg_config |
| 558 | # @DESCRIPTION: |
558 | # @DESCRIPTION: |
| 559 | # This function installs -- and removes a previously existing -- default webroot |
559 | # This function installs -- and overwrites -- the default webroot to |
| 560 | # to /var/www/localhost |
560 | # /var/www/localhost |
| 561 | apache-2_pkg_config() { |
561 | apache-2_pkg_config() { |
| 562 | einfo "Installing default webroot to ${ROOT}var/www/localhost" |
562 | einfo "Installing default webroot to ${ROOT}var/www/localhost" |
| 563 | mkdir "${ROOT}"var{,/www{,/localhost}} |
563 | mkdir -p "${ROOT}"/var/www/localhost |
| 564 | cp -R "${ROOT}"usr/share/doc/${PF}/webroot/* "${ROOT}"var/www/localhost/ |
564 | cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/ |
| 565 | } |
565 | } |
| 566 | |
566 | |
| 567 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_config |
567 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_config |