/[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.37 Revision 1.38
1# Copyright 1999-2014 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.37 2014/07/30 19:01:02 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.38 2014/08/05 14:19:19 ottxor 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
257 else 257 else
258 MY_CONF+=" --disable-authnz_ldap --disable-ldap" 258 MY_CONF+=" --disable-authnz_ldap --disable-ldap"
259 fi 259 fi
260 260
261 if use ssl ; then 261 if use ssl ; then
262 MY_CONF+=" --with-ssl=/usr --enable-ssl=${mod_type}" 262 MY_CONF+=" --with-ssl="${EPREFIX}"/usr --enable-ssl=${mod_type}"
263 MY_MODS+=" ssl" 263 MY_MODS+=" ssl"
264 else 264 else
265 MY_CONF+=" --without-ssl --disable-ssl" 265 MY_CONF+=" --without-ssl --disable-ssl"
266 fi 266 fi
267 267
268 if use suexec ; then 268 if use suexec ; then
269 elog "You can manipulate several configure options of suexec" 269 elog "You can manipulate several configure options of suexec"
270 elog "through the following environment variables:" 270 elog "through the following environment variables:"
271 elog 271 elog
272 elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: /usr/local/bin:/usr/bin:/bin)" 272 elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: "${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/bin)"
273 elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: /var/log/apache2/suexec_log)" 273 elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: "${EPREFIX}"/var/log/apache2/suexec_log)"
274 elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)" 274 elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)"
275 elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: /var/www)" 275 elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: "${EPREFIX}"/var/www)"
276 elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)" 276 elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)"
277 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)"
278 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)"
279 elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)" 279 elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
280 elog 280 elog
281 281
282 MY_CONF+=" --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}" 282 MY_CONF+=" --with-suexec-safepath=${SUEXEC_SAFEPATH:-"${EPREFIX}"/usr/local/bin:"${EPREFIX}"/usr/bin:"${EPREFIX}"/bin}"
283 MY_CONF+=" --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}" 283 MY_CONF+=" --with-suexec-logfile=${SUEXEC_LOGFILE:-"${EPREFIX}"/var/log/apache2/suexec_log}"
284 MY_CONF+=" --with-suexec-bin=/usr/sbin/suexec" 284 MY_CONF+=" --with-suexec-bin="${EPREFIX}"/usr/sbin/suexec"
285 MY_CONF+=" --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}" 285 MY_CONF+=" --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}"
286 MY_CONF+=" --with-suexec-caller=${SUEXEC_CALLER:-apache}" 286 MY_CONF+=" --with-suexec-caller=${SUEXEC_CALLER:-apache}"
287 MY_CONF+=" --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}" 287 MY_CONF+=" --with-suexec-docroot=${SUEXEC_DOCROOT:-"${EPREFIX}"/var/www}"
288 MY_CONF+=" --with-suexec-uidmin=${SUEXEC_MINUID:-1000}" 288 MY_CONF+=" --with-suexec-uidmin=${SUEXEC_MINUID:-1000}"
289 MY_CONF+=" --with-suexec-gidmin=${SUEXEC_MINGID:-100}" 289 MY_CONF+=" --with-suexec-gidmin=${SUEXEC_MINGID:-100}"
290 MY_CONF+=" --with-suexec-umask=${SUEXEC_UMASK:-077}" 290 MY_CONF+=" --with-suexec-umask=${SUEXEC_UMASK:-077}"
291 MY_CONF+=" --enable-suexec=${mod_type}" 291 MY_CONF+=" --enable-suexec=${mod_type}"
292 MY_MODS+=" suexec" 292 MY_MODS+=" suexec"
319# @FUNCTION: generate_load_module 319# @FUNCTION: generate_load_module
320# @DESCRIPTION: 320# @DESCRIPTION:
321# This internal function generates the LoadModule lines for httpd.conf based on 321# This internal function generates the LoadModule lines for httpd.conf based on
322# the current module selection and MODULE_DEFINES 322# the current module selection and MODULE_DEFINES
323generate_load_module() { 323generate_load_module() {
324 local endit=0 mod_lines= mod_dir="${D}/usr/$(get_libdir)/apache2/modules" 324 local endit=0 mod_lines= mod_dir="${ED}/usr/$(get_libdir)/apache2/modules"
325 325
326 if use static; then 326 if use static; then
327 sed -i -e "/%%LOAD_MODULE%%/d" \ 327 sed -i -e "/%%LOAD_MODULE%%/d" \
328 "${GENTOO_PATCHDIR}"/conf/httpd.conf 328 "${GENTOO_PATCHDIR}"/conf/httpd.conf
329 return 329 return
356# This internal function checks if the previous configuration file for built-in 356# This internal function checks if the previous configuration file for built-in
357# modules exists in ROOT and prevents upgrade in this case. Users are supposed 357# modules exists in ROOT and prevents upgrade in this case. Users are supposed
358# to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove 358# to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove
359# it afterwards. 359# it afterwards.
360check_upgrade() { 360check_upgrade() {
361 if [[ -e "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then 361 if [[ -e "${EROOT}"etc/apache2/apache2-builtin-mods ]]; then
362 eerror "The previous configuration file for built-in modules" 362 eerror "The previous configuration file for built-in modules"
363 eerror "(${ROOT}etc/apache2/apache2-builtin-mods) exists on your" 363 eerror "(${EROOT}etc/apache2/apache2-builtin-mods) exists on your"
364 eerror "system." 364 eerror "system."
365 eerror 365 eerror
366 eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml" 366 eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml"
367 eerror "for detailed information how to convert this file to the new" 367 eerror "for detailed information how to convert this file to the new"
368 eerror "APACHE2_MODULES USE_EXPAND variable." 368 eerror "APACHE2_MODULES USE_EXPAND variable."
408# @FUNCTION: apache-2_src_prepare 408# @FUNCTION: apache-2_src_prepare
409# @DESCRIPTION: 409# @DESCRIPTION:
410# This function applies patches, configures a custom file-system layout and 410# This function applies patches, configures a custom file-system layout and
411# rebuilds the configure scripts. 411# rebuilds the configure scripts.
412apache-2_src_prepare() { 412apache-2_src_prepare() {
413 #fix prefix in conf files etc (bug #433736)
414 use !prefix || sed -e "s@/\(usr\|var\|etc\|run\)/@${EPREFIX}&@g" \
415 -i "${GENTOO_PATCHDIR}"/conf/httpd.conf "${GENTOO_PATCHDIR}"/scripts/* \
416 "${GENTOO_PATCHDIR}"/docs/*.example "${GENTOO_PATCHDIR}"/patches/*.layout \
417 "${GENTOO_PATCHDIR}"/init/* "${GENTOO_PATCHDIR}"/conf/vhosts.d/* \
418 "${GENTOO_PATCHDIR}"/conf/modules.d/* || die
419
413 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good 420 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
414 # idea for everyone 421 # idea for everyone
415 case ${CHOST} in 422 case ${CHOST} in
416 *-linux-gnu|*-solaris*|*-freebsd*) 423 *-linux-gnu|*-solaris*|*-freebsd*)
417 # do nothing, these use GNU binutils 424 # do nothing, these use GNU binutils
485 492
486 # econf overwrites the stuff from config.layout, so we have to put them into 493 # econf overwrites the stuff from config.layout, so we have to put them into
487 # our myconf line too 494 # our myconf line too
488 ac_cv_path_PKGCONFIG=${PKG_CONFIG} \ 495 ac_cv_path_PKGCONFIG=${PKG_CONFIG} \
489 econf \ 496 econf \
490 --includedir=/usr/include/apache2 \ 497 --includedir="${EPREFIX}"/usr/include/apache2 \
491 --libexecdir=/usr/$(get_libdir)/apache2/modules \ 498 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/apache2/modules \
492 --datadir=/var/www/localhost \ 499 --datadir="${EPREFIX}"/var/www/localhost \
493 --sysconfdir=/etc/apache2 \ 500 --sysconfdir="${EPREFIX}"/etc/apache2 \
494 --localstatedir=/var \ 501 --localstatedir="${EPREFIX}"/var \
495 --with-mpm=${MY_MPM} \ 502 --with-mpm=${MY_MPM} \
496 --with-apr="${SYSROOT}"/usr \ 503 --with-apr="${SYSROOT}${EPREFIX}"/usr \
497 --with-apr-util="${SYSROOT}"/usr \ 504 --with-apr-util="${SYSROOT}${EPREFIX}"/usr \
498 --with-pcre="${T}"/pcre-config \ 505 --with-pcre="${T}"/pcre-config \
499 --with-z=/usr \ 506 --with-z="${EPREFIX}"/usr \
500 --with-port=80 \ 507 --with-port=80 \
501 --with-program-name=apache2 \ 508 --with-program-name=apache2 \
502 --enable-layout=Gentoo \ 509 --enable-layout=Gentoo \
503 ${MY_CONF} || die "econf failed!" 510 ${MY_CONF} || die "econf failed!"
504 511
554 dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING 561 dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
555 dodoc "${GENTOO_PATCHDIR}"/docs/* 562 dodoc "${GENTOO_PATCHDIR}"/docs/*
556 563
557 # drop in a convenient link to the manual 564 # drop in a convenient link to the manual
558 if use doc ; then 565 if use doc ; then
559 sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf" 566 sed -i -e "s:VERSION:${PVR}:" "${ED}/etc/apache2/modules.d/00_apache_manual.conf"
560 docompress -x /usr/share/doc/${PF}/manual # 503640 567 docompress -x /usr/share/doc/${PF}/manual # 503640
561 else 568 else
562 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" 569 rm -f "${ED}/etc/apache2/modules.d/00_apache_manual.conf"
563 rm -Rf "${D}/usr/share/doc/${PF}/manual" 570 rm -Rf "${ED}/usr/share/doc/${PF}/manual"
564 fi 571 fi
565 572
566 # the default icons and error pages get stored in 573 # the default icons and error pages get stored in
567 # /usr/share/apache2/{error,icons} 574 # /usr/share/apache2/{error,icons}
568 dodir /usr/share/apache2 575 dodir /usr/share/apache2
569 mv -f "${D}/var/www/localhost/error" "${D}/usr/share/apache2/error" 576 mv -f "${ED}/var/www/localhost/error" "${ED}/usr/share/apache2/error"
570 mv -f "${D}/var/www/localhost/icons" "${D}/usr/share/apache2/icons" 577 mv -f "${ED}/var/www/localhost/icons" "${ED}/usr/share/apache2/icons"
571 rm -rf "${D}/var/www/localhost/" 578 rm -rf "${ED}/var/www/localhost/"
572 eend $? 579 eend $?
573 580
574 # set some sane permissions for suexec 581 # set some sane permissions for suexec
575 if use suexec ; then 582 if use suexec ; then
576 fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec 583 fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
592# This function creates test certificates if SSL is enabled and installs the 599# This function creates test certificates if SSL is enabled and installs the
593# default index.html to /var/www/localhost if it does not exist. We do this here 600# default index.html to /var/www/localhost if it does not exist. We do this here
594# because the default webroot is a copy of the files that exist elsewhere and we 601# because the default webroot is a copy of the files that exist elsewhere and we
595# don't want them to be managed/removed by portage when apache is upgraded. 602# don't want them to be managed/removed by portage when apache is upgraded.
596apache-2_pkg_postinst() { 603apache-2_pkg_postinst() {
597 if use ssl && [[ ! -e "${ROOT}/etc/ssl/apache2/server.pem" ]]; then 604 if use ssl && [[ ! -e "${EROOT}/etc/ssl/apache2/server.pem" ]]; then
598 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}" 605 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
599 install_cert /etc/ssl/apache2/server 606 install_cert /etc/ssl/apache2/server
600 ewarn 607 ewarn
601 ewarn "The location of SSL certificates has changed. If you are" 608 ewarn "The location of SSL certificates has changed. If you are"
602 ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged" 609 ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
604 ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and" 611 ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
605 ewarn "update your config files." 612 ewarn "update your config files."
606 ewarn 613 ewarn
607 fi 614 fi
608 615
609 if [[ ! -e "${ROOT}/var/www/localhost" ]] ; then 616 if [[ ! -e "${EROOT}/var/www/localhost" ]] ; then
610 mkdir -p "${ROOT}/var/www/localhost/htdocs" 617 mkdir -p "${EROOT}/var/www/localhost/htdocs"
611 echo "<html><body><h1>It works!</h1></body></html>" > "${ROOT}/var/www/localhost/htdocs/index.html" 618 echo "<html><body><h1>It works!</h1></body></html>" > "${EROOT}/var/www/localhost/htdocs/index.html"
612 fi 619 fi
613 620
614 echo 621 echo
615 elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags" 622 elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags"
616 elog "in make.conf. Make sure to enable those in order to compile them." 623 elog "in make.conf. Make sure to enable those in order to compile them."

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

  ViewVC Help
Powered by ViewVC 1.1.20