Commit a66560f1 authored by Matt Smith's avatar Matt Smith Committed by Natanael Copa
Browse files

main/apache2: improved APKBUILD

parent 00780f57
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apache2
pkgver=2.2.17
pkgrel=3
pkgrel=4
pkgdesc="A high performance Unix-based HTTP server"
url="http://httpd.apache.org/"
arch="x86 x86_64"
......@@ -32,39 +32,29 @@ source="http://archive.apache.org/dist/httpd/httpd-$pkgver.tar.bz2
alpine.layout"
prepare() {
cd "$srcdir"
cat "$srcdir/alpine.layout" >> httpd-$pkgver/config.layout
cd "$srcdir"/httpd-$pkgver
cat "$srcdir/alpine.layout" >> config.layout
# 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
# create itk directory and apply itk patches
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
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
}
_buildmpm() {
local mpm=$1
shift
mkdir "$srcdir"/build-${mpm}
cd "$srcdir"/build-${mpm}
"$srcdir"/$mpm/configure --prefix=/usr \
build() {
local _apacheconfig="--prefix=/usr \
--enable-layout=Alpine \
--enable-so \
--enable-suexec \
......@@ -77,104 +67,172 @@ _buildmpm() {
--with-apr=/usr/bin/apr-1-config \
--with-apr-util=/usr/bin/apu-1-config \
--with-pcre=/usr \
--with-mpm=${mpm} \
$@ \
|| return 1
--enable-mods-shared=all \
--enable-ssl --with-ssl \
--enable-proxy \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-file-cache \
--enable-ldap --enable-authnz-ldap \
--enable-cgid \
--enable-authn-anon --enable-authn-alias \
--disable-imagemap \
--enable-proxy-connect \
--enable-proxy-http \
--enable-proxy-ftp \
--enable-deflate \
--enable-dbd \
--enable-exception-hook"
local _mpm
_mpm="prefork"
cd "$srcdir"/httpd-$pkgver
./configure ${_apacheconfig} --with-mpm=${_mpm} || return 1
make || return 1
}
build () {
local mpm
#build the mpms
for mpm in prefork worker itk; do
_buildmpm $mpm \
--enable-mods-shared=all \
--enable-ssl --with-ssl \
--enable-proxy \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-file-cache \
--enable-ldap --enable-authnz-ldap \
--enable-cgid \
--enable-authn-anon --enable-authn-alias \
--disable-imagemap \
--enable-proxy-connect \
--enable-proxy-http \
--enable-proxy-ftp \
--enable-deflate \
--enable-dbd \
|| return 1
done
_mpm="itk"
cp -a "$srcdir"/httpd-$pkgver "$srcdir"/httpd-${_mpm}
cd "$srcdir"/httpd-${_mpm}
./configure ${_apacheconfig} --with-mpm=${_mpm} || return 1
make || return 1
_mpm="worker"
cp -a "$srcdir"/httpd-$pkgver "$srcdir"/httpd-${_mpm}
cd "$srcdir"/httpd-${_mpm}
make clean
./configure ${_apacheconfig} --with-mpm=${_mpm} || return 1
make || return 1
}
package() {
cd "$srcdir"/build-prefork
local _mpm
# prefork
cd "$srcdir"/httpd-$pkgver
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
# itk and worker
for _mpm in itk worker; do
install -D -m755 "$srcdir"/httpd-${_mpm}/httpd \
"$pkgdir"/usr/sbin/httpd.${_mpm} || return 1
done
# config
rm -r "$pkgdir"/etc/apache2/httpd.conf \
"$pkgdir"/etc/apache2/extra
install -D -m644 "$srcdir"/httpd.conf "$pkgdir"/etc/apache2/httpd.conf
install -d "$pkgdir"/etc/apache2/conf.d
"$pkgdir"/etc/apache2/extra
install -D -m644 "$srcdir"/httpd.conf "$pkgdir"/etc/apache2/httpd.conf \
|| return 1
install -d "$pkgdir"/etc/apache2/conf.d || return 1
# init scripts and logrotate
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/apache2 "$pkgdir/var/www/logs"
ln -fs /var/run/apache2 "$pkgdir/var/www/run"
ln -fs /usr/lib/apache2 "$pkgdir/var/www/modules"
ln -fs /etc/apache2/conf.d "$pkgdir/var/www/conf.d"
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 || return 1
ln -fs /var/log/apache2 "$pkgdir"/var/www/logs
ln -fs /var/run/apache2 "$pkgdir"/var/www/run
ln -fs /usr/lib/apache2 "$pkgdir"/var/www/modules
ln -fs /etc/apache2/conf.d "$pkgdir"/var/www/conf.d
}
# include the builddir and apxs in -dev package
dev() {
local _mpm
local _file
default_dev
depends="$depends perl apr-util-dev"
arch="noarch"
install -d "$subpkgdir"/usr/share/apache2/ \
"$subpkgdir"/usr/sbin
mv "$pkgdir"/usr/sbin/apxs "$subpkgdir"/usr/sbin/ || return 1
mv "$pkgdir"/usr/share/apache2/build "$subpkgdir"/usr/share/apache2/
# install apxs utility
install -d "$subpkgdir"/usr/sbin || return 1
mv "$pkgdir"/usr/sbin/apxs \
"$subpkgdir"/usr/sbin/apxs || return 1
_mpm="prefork"
install -d "$subpkgdir"/usr/share/apache2/build-${_mpm} || return 1
mv "$pkgdir"/usr/share/apache2/build/* \
"$subpkgdir"/usr/share/apache2/build-${_mpm} || return 1
rm -rf "$pkgdir"/usr/share/apache2/build
ln -s /usr/share/apache2/build-${_mpm} \
"$pkgdir"/usr/share/apache2/build || return 1
_mpm="itk"
install -d "$subpkgdir"/usr/share/apache2/build-${_mpm} || return 1
for _file in `ls -1 "$subpkgdir"/usr/share/apache2/build-prefork | grep -v "config\.nice"`; do
mv "$srcdir"/httpd-${_mpm}/build/${_file} \
"$subpkgdir"/usr/share/apache2/build-${_mpm}/${_file} \
|| return 1
done
cp -a "$subpkgdir"/usr/share/apache2/build-prefork/config.nice \
"$subpkgdir"/usr/share/apache2/build-${_mpm}/config.nice \
|| return 1
sed -ri "s/prefork/${_mpm}/g" \
"$subpkgdir"/usr/share/apache2/build-${_mpm}/config.nice \
|| return 1
_mpm="worker"
install -d "$subpkgdir"/usr/share/apache2/build-${_mpm} || return 1
for _file in `ls -1 "$subpkgdir"/usr/share/apache2/build-prefork | grep -v "config\.nice"`; do
mv "$srcdir"/httpd-${_mpm}/build/${_file} \
"$subpkgdir"/usr/share/apache2/build-${_mpm}/${_file} \
|| return 1
done
cp -a "$subpkgdir"/usr/share/apache2/build-prefork/config.nice \
"$subpkgdir"/usr/share/apache2/build-${_mpm}/config.nice \
|| return 1
sed -ri "s/prefork/${_mpm}/g" \
"$subpkgdir"/usr/share/apache2/build-${_mpm}/config.nice \
|| return 1
}
utils() {
local _bin
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
install -d "$subpkgdir"/usr/bin || return 1
for _bin in ab dbmmanage htdbm htdigest htpasswd logresolve; do
mv "$pkgdir"/usr/sbin/${_bin} \
"$subpkgdir"/usr/bin/${_bin} || return 1
done
install -d "$subpkgdir"/usr/sbin || return 1
for _bin in checkgid htcacheclean rotatelogs; do
mv "$pkgdir"/usr/sbin/${_bin} \
"$subpkgdir"/usr/sbin/${_bin} || return 1
done
}
ssl() {
pkgdesc="SSL/TLS module for the Apache HTTP Server"
install="apache2-ssl.post-install"
depends="apache2 openssl"
install -d "$subpkgdir"/usr/lib/apache2 \
"$subpkgdir"/etc/ssl/apache2
mv "$pkgdir"/usr/lib/apache2/mod_ssl.so "$subpkgdir"/usr/lib/apache2/ \
|| return 1
install -m644 -D "$srcdir"/ssl.conf "$subpkgdir"/etc/apache2/conf.d/ssl.conf
install -d "$subpkgdir"/usr/lib/apache2 || return 1
mv "$pkgdir"/usr/lib/apache2/mod_ssl.so \
"$subpkgdir"/usr/lib/apache2/mod_ssl.so || return 1
install -D -m644 "$srcdir"/ssl.conf \
"$subpkgdir"/etc/apache2/conf.d/ssl.conf || return 1
install -d "$subpkgdir"/etc/ssl/apache2 || return 1
}
ldap() {
pkgdesc="LDAP authentication/authorization module for the Apache HTTP Server"
url="http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html"
depends="apache2"
install -d "$subpkgdir"/usr/lib/apache2
mv "$pkgdir"/usr/lib/apache2/mod_*ldap*.so "$subpkgdir"/usr/lib/apache2
install -m644 -D "$srcdir"/ldap.conf "$subpkgdir"/etc/apache2/conf.d/ldap.conf
install -d "$subpkgdir"/usr/lib/apache2 || return 1
mv "$pkgdir"/usr/lib/apache2/mod_ldap.so \
"$subpkgdir"/usr/lib/apache2/mod_ldap.so || return 1
install -D -m644 "$srcdir"/ldap.conf \
"$subpkgdir"/etc/apache2/conf.d/ldap.conf || return 1
}
md5sums="16eadc59ea6b38af33874d300973202e httpd-2.2.17.tar.bz2
......
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