--- /Volumes/localhorst/usr/portage/www-servers/apache/apache-2.2.6.ebuild 2007-09-12 00:36:58 +0400 +++ www-servers/apache/apache-2.2.6.ebuild 2007-10-13 22:20:01 +0400 @@ -2,6 +2,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/www-servers/apache/apache-2.2.6.ebuild,v 1.10 2007/09/11 20:21:51 wolf31o2 Exp $ +EAPI="prefix" + inherit eutils flag-o-matic multilib autotools # latest gentoo apache files @@ -18,7 +20,7 @@ # some helper scripts are apache-1.1, thus both are here LICENSE="Apache-2.0 Apache-1.1" SLOT="2" -KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd" +KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd ~x86-macos" IUSE="debug doc ldap mpm-event mpm-itk mpm-peruser mpm-prefork mpm-worker no-suexec selinux ssl static-modules threads" DEPEND="dev-lang/perl @@ -81,7 +83,7 @@ # setup apache user and group enewgroup apache 81 - enewuser apache 81 -1 /var/www apache + enewuser apache 81 -1 $EPREFIX/var/www apache if ! use no-suexec ; then elog @@ -91,7 +93,7 @@ elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: /usr/local/bin:/usr/bin:/bin)" elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: /var/log/apache2/suexec_log)" elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)" - elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: /var/www)" + elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: $EPREFIX/var/www)" elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)" elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)" elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)" @@ -104,6 +106,21 @@ unpack ${A} cd "${S}" + # Prepend the prefix to the install locations + if ! test -z "$EPREFIX"; then + sed -i -e "s| /| $EPREFIX/|" \ + "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} + fi + # Prepend the prefix to the config files (unfortunally $EPREFIX is variable) + if test ! -z "$EPREFIX"; then + FILES=`find "${GENTOO_PATCHDIR}"/conf -type f` + for FILE in $FILES; do + mv $FILE $FILE.old + perl -ne "s%([^\w\.])(/var|/usr|/etc|/sbin)%\$1$EPREFIX\$2%; print" < $FILE.old > $FILE + rm $FILE.old + done + fi + # Use correct multilib libdir in gentoo patches sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \ "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \ @@ -117,6 +134,9 @@ # 80-99 Security patches (80_all_${PV}_cve-####-####.patch) epatch "${GENTOO_PATCHDIR}"/patches/*.patch + if use x86-macos; then + epatch ${FILESDIR}/${P}-macos-bindnow.patch + fi # setup the filesystem layout config cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \ @@ -134,7 +154,9 @@ # Instead of filtering --as-needed (bug #128505), append --no-as-needed # Thanks to Harald van Dijk + if ! use x86-macos; then append-ldflags -Wl,--no-as-needed + fi # peruser MPM debugging with -X is nearly impossible use mpm-peruser && use debug && append-flags -DMPM_PERUSER_DEBUG @@ -157,19 +179,19 @@ if use ssl; then mods="${mods} ssl" - myconf="${myconf} --with-ssl=/usr --enable-ssl=${modtype}" + myconf="${myconf} --with-ssl=$EPREFIX/usr --enable-ssl=${modtype}" fi # Only build suexec with USE=-no-suexec if use no-suexec ; then myconf="${myconf} --disable-suexec" else - myconf="${myconf} --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}" - myconf="${myconf} --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}" + myconf="${myconf} --with-suexec-safepath=${SUEXEC_SAFEPATH:-$EPREFIX/usr/local/bin:$EPREFIX/usr/bin:$EPREFIX/bin}" + myconf="${myconf} --with-suexec-logfile=${SUEXEC_LOGFILE:-$EPREFIX/var/log/apache2/suexec_log}" myconf="${myconf} --with-suexec-bin=/usr/sbin/suexec" myconf="${myconf} --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}" myconf="${myconf} --with-suexec-caller=${SUEXEC_CALLER:-apache}" - myconf="${myconf} --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}" + myconf="${myconf} --with-suexec-docroot=${SUEXEC_DOCROOT:-$EPREFIX/var/www}" myconf="${myconf} --with-suexec-uidmin=${SUEXEC_MINUID:-1000}" myconf="${myconf} --with-suexec-gidmin=${SUEXEC_MINGID:-100}" myconf="${myconf} --with-suexec-umask=${SUEXEC_UMASK:-077}" @@ -181,18 +203,18 @@ # our myconf line too econf \ - --includedir=/usr/include/apache2 \ - --libexecdir=/usr/$(get_libdir)/apache2/modules \ - --datadir=/var/www/localhost \ - --sysconfdir=/etc/apache2 \ - --localstatedir=/var \ + --includedir=$EPREFIX/usr/include/apache2 \ + --libexecdir=$EPREFIX/usr/$(get_libdir)/apache2/modules \ + --datadir=$EPREFIX/var/www/localhost \ + --sysconfdir=$EPREFIX/etc/apache2 \ + --localstatedir=$EPREFIX/var \ --with-mpm=${mpm} \ - --with-perl=/usr/bin/perl \ - --with-expat=/usr \ - --with-z=/usr \ - --with-apr=/usr \ - --with-apr-util=/usr \ - --with-pcre=/usr \ + --with-perl=$EPREFIX/usr/bin/perl \ + --with-expat=$EPREFIX/usr \ + --with-z=$EPREFIX/usr \ + --with-apr=$EPREFIX/usr \ + --with-apr-util=$EPREFIX/usr \ + --with-pcre=$EPREFIX/usr \ --with-port=80 \ --with-program-name=apache2 \ --enable-layout=Gentoo \ @@ -235,7 +257,7 @@ # create our LoadModule lines if ! use static-modules ; then load_module="" - moddir="${D}/usr/$(get_libdir)/apache2/modules" + moddir="${ED}/usr/$(get_libdir)/apache2/modules" for m in $(echo ${mods}|tr ' ' '\n'|sort -u) ; do endid="no" @@ -296,15 +318,15 @@ # drop in a convenient link to the manual if use doc ; then - sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf" + sed -i -e "s:VERSION:${PVR}:" "${ED}/etc/apache2/modules.d/00_apache_manual.conf" else - rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" - rm -Rf "${D}/usr/share/doc/${PF}/manual" + rm -f "${ED}/etc/apache2/modules.d/00_apache_manual.conf" + rm -Rf "${ED}/usr/share/doc/${PF}/manual" fi # the default webroot gets stored in /usr/share/doc ebegin "Installing default webroot to /usr/share/doc/${PF}" - mv -f "${D}/var/www/localhost" "${D}/usr/share/doc/${PF}/webroot" + mv -f "${ED}/var/www/localhost" "${ED}/usr/share/doc/${PF}/webroot" eend $? keepdir /var/www/localhost/htdocs @@ -330,12 +352,12 @@ pkg_postinst() { # Automatically generate test certificates if ssl USE flag is being set - if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then - cd "${ROOT}"/etc/apache2/ssl + if use ssl && [[ ! -e "${EROOT}/etc/apache2/ssl/server.crt" ]] ; then + cd "${EROOT}"/etc/apache2/ssl einfo - einfo "Generating self-signed test certificate in ${ROOT}/etc/apache2/ssl ..." + einfo "Generating self-signed test certificate in ${EROOT}/etc/apache2/ssl ..." yes "" 2>/dev/null | \ - "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \ + "${EROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \ die "gentestcrt.sh failed" einfo fi @@ -344,29 +366,29 @@ # that exist elsewhere and we don't want them managed/removed by portage # when apache is upgraded. - if [[ -e "${ROOT}/var/www/localhost" ]] ; then + if [[ -e "${EROOT}/var/www/localhost" ]] ; then elog "The default webroot has not been installed into" - elog "${ROOT}/var/www/localhost because the directory already exists" + elog "${EROOT}/var/www/localhost because the directory already exists" elog "and we do not want to overwrite any files you have put there." elog elog "If you would like to install the latest webroot, please run" elog "emerge --config =${PF}" else - einfo "Installing default webroot to ${ROOT}/var/www/localhost" - mkdir -p "${ROOT}"/var/www/localhost - cp -R "${ROOT}"/usr/share/doc/${PF}/webroot/* "${ROOT}"/var/www/localhost - chown -R apache:0 "${ROOT}"/var/www/localhost + einfo "Installing default webroot to ${EROOT}/var/www/localhost" + mkdir -p "${EROOT}"/var/www/localhost + cp -R "${EROOT}"/usr/share/doc/${PF}/webroot/* "${EROOT}"/var/www/localhost + chown -R apache:0 "${EROOT}"/var/www/localhost fi # Previous installations of apache-2.2 installed the upstream configuration # files, which shouldn't even have been installed! if has_version '>=www-servers/apache-2.2.4' ; then - [ -f "${ROOT}"/etc/apache2/apache2.conf ] && \ - rm -f "${ROOT}"/etc/apache2/apache2.conf >/dev/null 2>&1 + [ -f "${EROOT}"/etc/apache2/apache2.conf ] && \ + rm -f "${EROOT}"/etc/apache2/apache2.conf >/dev/null 2>&1 for i in extra original ; do - [ -d "${ROOT}"/etc/apache2/$i ] && \ - rm -rf "${ROOT}"/etc/apache2/$i >/dev/null 2>&1 + [ -d "${EROOT}"/etc/apache2/$i ] && \ + rm -rf "${EROOT}"/etc/apache2/$i >/dev/null 2>&1 done fi @@ -403,12 +425,12 @@ elog "to continue working correctly." elog elog "Also note that some configuration directives have been" - elog "split into their own files under ${ROOT}/etc/apache2/modules.d/" + elog "split into their own files under ${EROOT}/etc/apache2/modules.d/" elog "and that some modules, foremost the authentication related ones," elog "have been renamed." elog elog "Some examples:" - elog " - USERDIR is now configureable in ${ROOT}etc/apache2/modules.d/00_mod_userdir.conf." + elog " - USERDIR is now configureable in ${EROOT}etc/apache2/modules.d/00_mod_userdir.conf." elog elog "For more information on what you may need to change, please" elog "see the overview of changes at:" @@ -420,12 +442,12 @@ # Cleanup the vim backup files, placed in /etc/apache2 by the last # patchtarball (gentoo-apache-2.2.4-r7-20070615) - rm -f "${ROOT}/etc/apache2/modules.d/*.conf~" + rm -f "${EROOT}/etc/apache2/modules.d/*.conf~" } pkg_config() { - einfo "Installing default webroot to ${ROOT}/var/www/localhost" - cp -R "${ROOT}"/usr/share/doc/${PF}/webroot/* "${ROOT}"/var/www/localhost + einfo "Installing default webroot to ${EROOT}/var/www/localhost" + cp -R "${EROOT}"/usr/share/doc/${PF}/webroot/* "${EROOT}"/var/www/localhost } parse_modules_config() { @@ -475,7 +497,7 @@ } select_modules_config() { - parse_modules_config "${ROOT}"/etc/apache2/apache2-builtin-mods || \ + parse_modules_config "${EROOT}"/etc/apache2/apache2-builtin-mods || \ parse_modules_config "${GENTOO_PATCHDIR}"/conf/apache2-builtin-mods || \ return 1 }