Commit 067aef21 authored by Natanael Copa's avatar Natanael Copa

testing/apache: new aport

A high performance Unix-based HTTP server
http://httpd.apache.org/
parent ee389ee8
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apache
pkgver=2.2.16
pkgrel=0
pkgdesc="A high performance Unix-based HTTP server"
url="http://httpd.apache.org/"
license="APACHE"
depends=""
pkgusers="apache"
pkggroups="apache"
makedepends="openssl-dev zlib-dev apr-util-dev apr-dev pcre-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-utils"
source="http://archive.apache.org/dist/httpd/httpd-$pkgver.tar.bz2
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/02-rename-prefork-to-itk.patch
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/03-add-mpm-to-build-system.patch
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/04-correct-output-makefile-location.patch
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/05-add-copyright.patch
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/06-hook-just-after-merging-perdir-config.patch
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/07-base-functionality.patch
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/08-max-clients-per-vhost.patch
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/09-capabilities.patch
http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.11-02/10-nice.patch
apache2.confd
apache2.logrotate
apache2.initd
alpine.layout"
prepare() {
cd "$srcdir"/httpd-$pkgver
sed -e 's#User daemon#User apache#' \
-e 's#Group daemon#Group apache#' \
-i docs/conf/httpd.conf.in || return 1
cat "$srcdir/alpine.layout" >> config.layout
cd "$srcdir"
# create symlinks to soruces for prefork and worker
ln -s httpd-$pkgver prefork
ln -s httpd-$pkgver worker
# make a patched clone of itk sources
cp -ra httpd-$pkgver itk
cd itk
mkdir -p server/mpm/experimental/itk
cp -r server/mpm/prefork/* \
server/mpm/experimental/itk/ || return 1
mv server/mpm/experimental/itk/prefork.c \
server/mpm/experimental/itk/itk.c || return 1
patch -Np1 -i "$srcdir/02-rename-prefork-to-itk.patch" || return 1
patch -Np1 -i "$srcdir/03-add-mpm-to-build-system.patch" || return 1
patch -Np1 -i "$srcdir/04-correct-output-makefile-location.patch" || return 1
patch -Np1 -i "$srcdir/05-add-copyright.patch" || return 1
patch -Np1 -i "$srcdir/06-hook-just-after-merging-perdir-config.patch" || return 1
patch -Np1 -i "$srcdir/07-base-functionality.patch" || return 1
patch -Np1 -i "$srcdir/08-max-clients-per-vhost.patch" || return 1
patch -Np1 -i "$srcdir/09-capabilities.patch" || return 1
patch -Np1 -i "$srcdir/10-nice.patch" || return 1
autoconf || return 1
}
build () {
local mpm
for mpm in prefork worker itk; do
mkdir "$srcdir"/build-${mpm}
cd "$srcdir"/build-${mpm}
"$srcdir"/$mpm/configure --prefix=/usr \
--enable-layout=Alpine \
--enable-modules=all \
--enable-mods-shared=all \
--enable-so \
--enable-suexec \
--with-suexec-caller=http \
--with-suexec-docroot=/var/www/localhost/htdocs \
--with-suexec-logfile=/var/log/httpd/suexec.log \
--with-suexec-bin=/usr/sbin/suexec \
--with-suexec-uidmin=99 \
--with-suexec-gidmin=99 \
--enable-ldap \
--enable-authnz-ldap \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-file-cache \
--enable-ssl \
--with-ssl \
--enable-deflate \
--enable-cgid \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-http \
--enable-proxy-ftp \
--enable-dbd \
--with-apr=/usr/bin/apr-1-config \
--with-apr-util=/usr/bin/apu-1-config \
--with-pcre=/usr \
--with-mpm=${mpm} \
|| return 1
make || return 1
done
}
package() {
cd "$srcdir"/build-prefork
make -j1 DESTDIR="$pkgdir" install || return 1
for mpm in worker itk; do
install -m755 "$srcdir"/build-$mpm/httpd \
"$pkgdir/usr/sbin/httpd.${mpm}" || return 1
done
install -D -m755 "$srcdir/apache2.initd" \
"$pkgdir/etc/init.d/apache2" || return 1
install -D -m644 "$srcdir/apache2.logrotate" \
"$pkgdir/etc/logrotate.d/apache2" || return 1
install -D -m644 "$srcdir/apache2.confd" \
"$pkgdir/etc/conf.d/apache2" || return 1
install -d "$pkgdir"/var/www
ln -fs /var/log/httpd "$pkgdir/var/www/logs"
ln -fs /var/run/httpd "$pkgdir/var/www/run"
ln -fs /usr/lib/httpd/modules "$pkgdir/var/www/modules"
sed -e 's#/usr/lib/httpd/modules/#modules/#' \
-e 's|#\(Include conf/extra/httpd-multilang-errordoc.conf\)|\1|'\
-e 's|#\(Include conf/extra/httpd-autoindex.conf\)|\1|' \
-e 's|#\(Include conf/extra/httpd-languages.conf\)|\1|' \
-e 's|#\(Include conf/extra/httpd-userdir.conf\)|\1|' \
-e 's|#\(Include conf/extra/httpd-default.conf\)|\1|' \
-e 's|/srv/http|/var/www/localhost|g' \
-i "$pkgdir/etc/apache2/httpd.conf" || return 1
}
utils() {
pkgdesc="Apache utility programs for webservers"
install -d "$subpkgdir"/usr/bin "$subpkgdir"/usr/sbin
cd "$pkgdir"/usr/sbin
mv ab dbmmanage htdbm htdigest htpasswd logresolve "$subpkgdir"/usr/bin
mv checkgid htcacheclean rotatelogs "$subpkgdir"/usr/sbin
}
md5sums="c8ff2a07c884300bc7766a2e7f662d33 httpd-2.2.16.tar.bz2
db42cfcc18ae1c32aaaff2347e35b79d 02-rename-prefork-to-itk.patch
131408ad4dc7b18547b4e062e7e495ab 03-add-mpm-to-build-system.patch
ee488f391054d528547c3a372faa2aa7 04-correct-output-makefile-location.patch
b202944761b2f0516196488b12504236 05-add-copyright.patch
78fa15f8ca3a284b7d71f942e24e47fb 06-hook-just-after-merging-perdir-config.patch
d33e39350e987721d50e6fb8e164ab6b 07-base-functionality.patch
9f7a8935f9cabc7b46d0052906634cef 08-max-clients-per-vhost.patch
1b28e3363e1b0d05b738a21e7ddd264f 09-capabilities.patch
d9667fcd2ffecc63e446edd4d6666731 10-nice.patch
f3e4f5eed88d97d1bbadd0597562bc28 apache2.confd
d91a9a7196b10ef0bc4ab5b98ea9ccd9 apache2.logrotate
0261136ff734c3ae8dcf878a46ed5830 apache2.initd
af943bf52cec8088974084639661ba34 alpine.layout"
<Layout Alpine>
prefix: /usr
exec_prefix: ${prefix}
bindir: ${prefix}/bin
sbindir: ${prefix}/sbin
libdir: ${prefix}/lib
libexecdir: ${prefix}/lib+
mandir: ${prefix}/share/man
sysconfdir: /etc+
datadir: ${usr}/share+
installbuilddir: ${datadir}/build
errordir: ${datadir}/error
iconsdir: ${datadir}/icons
htdocsdir: /var/www/localhost/htdocs
manualdir: /usr/share/doc/apache2/manual
cgidir: /var/www/cgi-bin
includedir: /usr/include+
localstatedir: /var
runtimedir: ${localstatedir}/run+
logfiledir: ${localstatedir}/log+
proxycachedir: ${localstatedir}/cache+
</Layout>
# /etc/conf.d/apache2: config file for /etc/init.d/apache2
#
# The default processing model (MPM) is the process-based
# 'prefork' model. A thread-based model, 'worker', is also
# available, but does not work with some modules (such as PHP).
#
#HTTPD=/usr/sbin/httpd.worker
HTTPD="/usr/sbin/httpd"
# When you install a module it is easy to activate or deactivate the modules
# and other features of apache using the HTTPD_OPTS line. Every module should
# install a configuration in /etc/apache2/modules.d. In that file will have an
# <IfDefine NNN> directive where NNN is the option to enable that module.
#
# Here are the options available in the default configuration:
#
# AUTH_DIGEST Enables mod_auth_digest
# AUTHNZ_LDAP Enables authentication through mod_ldap
# CACHE Enables mod_cache
# DAV Enables mod_dav
# ERRORDOCS Enables default error documents for many languages.
# INFO Enables mod_info, a useful module for debugging
# LANGUAGE Enables content-negotiation based on language and charset.
# LDAP Enables mod_ldap
# MANUAL Enables /manual/ to be the apache manual (needs apache-doc)
# MEM_CACHE Enables default configuration mod_mem_cache
# PROXY Enables mod_proxy
# SSL Enables SSL
# SUEXEC Enables running CGI scripts (in USERDIR) through suexec.
# USERDIR Enables /~username mapping to /home/username/public_html
#
#
# The following two options provide the default virtual host for the HTTP and
# HTTPS protocol. YOU NEED TO ENABLE AT LEAST ONE OF THEM, otherwise apache
# will not listen for incomming connections on the approriate port.
#
# DEFAULT_VHOST Enables name-based virtual hosts, with the default
# virtual host being in /var/www/localhost/htdocs
# SSL_DEFAULT_VHOST Enables default vhost for SSL (you should enable this
# when you enable SSL)
#
HTTPD_OPTS="-D DEFAULT_VHOST -D LANGUAGE -D INFO"
# Extended options for advanced uses of Apache ONLY
# You don't need to edit these unless you are doing crazy Apache stuff
# As not having them set correctly, or feeding in an incorrect configuration
# via them will result in Apache failing to start
# YOU HAVE BEEN WARNED.
# PID file
#PIDFILE=/var/run/apache2/httpd.pid
# timeout for startup/shutdown checks
#TIMEOUT=10
# ServerRoot setting
#SERVERROOT=/var/www
# Configuration file location
# - If this does NOT start with a '/', then it is treated relative to
# $SERVERROOT by Apache
#CONFIGFILE=/etc/apache2/httpd.conf
# Location to log startup errors to
# They are normally dumped to your terminal.
#STARTUPERRORLOG="/var/log/apache2/startuperror.log"
# A command that outputs a formatted text version of the HTML at the URL
# of the command line. Designed for lynx, however other programs may work.
#LYNX="lynx -dump"
# The URL to your server's mod_status status page.
# Required for status and fullstatus
#STATUSURL="http://localhost/server-status"
# Method to use when reloading the server
# Valid options are 'restart' and 'graceful'
# See http://httpd.apache.org/docs/2.2/stopping.html for information on
# what they do and how they differ.
#RELOAD_TYPE="graceful"
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="configdump configtest fullstatus graceful gracefulstop modules reload virtualhosts"
depend() {
need net
use mysql dns logger netmount postgresql
after sshd
}
configtest() {
ebegin "Checking ${SVCNAME} configuration"
checkconfig
eend $?
}
checkconfd() {
PIDFILE="${PIDFILE:-/var/run/apache2/httpd.pid}"
TIMEOUT=${TIMEOUT:-10}
SERVERROOT="${SERVERROOT:-/var/www}"
if [ ! -d ${SERVERROOT} ]; then
eerror "SERVERROOT does not exist: ${SERVERROOT}"
return 1
fi
CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}"
[ "${CONFIGFILE#/}" = "${CONFIGFILE}" ] && CONFIGFILE="${SERVERROOT}/${CONFIGFILE}"
if [ ! -r "${CONFIGFILE}" ]; then
eerror "Unable to read configuration file: ${CONFIGFILE}"
return 1
fi
HTTPD_OPTS="${HTTPD_OPTS} -d ${SERVERROOT}"
HTTPD_OPTS="${HTTPD_OPTS} -f ${CONFIGFILE}"
[ -n "${STARTUPERRORLOG}" ] && HTTPD_OPTS="${HTTPD_OPTS} -E ${STARTUPERRORLOG}"
return 0
}
checkconfig() {
checkconfd || return 1
${HTTPD} ${HTTPD_OPTS} -t 1>/dev/null 2>&1
ret=$?
if [ $ret -ne 0 ]; then
eerror "${SVCNAME} has detected an error in your setup:"
${HTTPD} ${HTTPD_OPTS} -t
fi
return $ret
}
start() {
checkconfig || return 1
[ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start \
--pidfile ${PIDFILE} \
--exec ${HTTPD} \
-- ${HTTPD_OPTS} -k start
eend $?
}
stop() {
checkconfd || return 1
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${HTTPD} \
--retry ${TIMEOUT}
eend $?
}
reload() {
RELOAD_TYPE="${RELOAD_TYPE:-graceful}"
checkconfig || return 1
service_started "${SVCNAME}" || return
if [ "${RELOAD_TYPE}" = "restart" ]; then
ebegin "Restarting ${SVCNAME}"
${HTTPD} ${HTTPD_OPTS} -k restart
eend $?
elif [ "${RELOAD_TYPE}" = "graceful" ]; then
ebegin "Gracefully restarting ${SVCNAME}"
${HTTPD} ${HTTPD_OPTS} -k graceful
eend $?
else
eerror "${RELOAD_TYPE} is not a valid RELOAD_TYPE. Please edit /etc/conf.d/${SVCNAME}"
fi
}
graceful() {
checkconfig || return 1
service_started "${SVCNAME}" || return
ebegin "Gracefully restarting ${SVCNAME}"
${HTTPD} ${HTTPD_OPTS} -k graceful
eend $?
}
gracefulstop() {
checkconfig || return 1
ebegin "Gracefully stopping ${SVCNAME}"
start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${HTTPD} \
--retry SIGWINCH/${TIMEOUT}
eend $?
}
modules() {
checkconfig || return 1
${HTTPD} ${HTTPD_OPTS} -M 2>&1
}
fullstatus() {
LYNX="${LYNX:-lynx -dump}"
STATUSURL="${STATUSURL:-http://localhost/server-status}"
if ! service_started "${SVCNAME}"; then
eerror "${SVCNAME} not started"
elif ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
eerror "lynx not found! you need to emerge www-client/lynx"
else
${LYNX} ${STATUSURL}
fi
}
virtualhosts() {
checkconfd || return 1
${HTTPD} ${HTTPD_OPTS} -S
}
configdump() {
LYNX="${LYNX:-lynx -dump}"
INFOURL="${INFOURL:-http://localhost/server-info}"
checkconfd || return 1
if ! service_started "${SVCNAME}"; then
eerror "${SVCNAME} not started"
elif ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
eerror "lynx not found! you need to emerge www-client/lynx"
else
echo "${HTTPD} started with '${HTTPD_OPTS}'"
for i in config server list; do
${LYNX} "${INFOURL}/?${i}" | sed '/Apache Server Information/d;/^[[:space:]]\+[_]\+$/Q'
done
fi
}
/var/log/apache2/*log {
postrotate
if /etc/init.d/apache2 status; then
/etc/init.d/apache2 reload --quiet || true
fi
endscript
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment