##
## apache2.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2005 The OpenPKG Project
## Copyright (c) 2000-2005 Ralf S. Engelschall
## Copyright (c) 2000-2005 Cable & Wireless
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: apache2
Summary: Apache Webserver (V2)
URL: http://httpd.apache.org/
Vendor: Apache Software Foundation
Packager: The OpenPKG Project
Distribution: OpenPKG
Class: PLUS
Group: Web
License: ASF
Version: 2.0.53
Release: 20050324
# package options (suexec related)
%option with_suexec yes
%option with_suexec_caller %{l_nusr}
%option with_suexec_userdir public_html
# package options (additionally used Apache modules)
%option with_mod_deflate no
%option with_mod_ssl no
%option with_mod_dav no
%option with_mod_ldap no
%option with_mod_proxy no
%option with_mod_filecache no
%option with_shared_core no
# list of sources
Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.gz
Source1: rc.apache2
Patch0: apache2.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, perl, make
PreReq: OpenPKG, openpkg >= 20040130, perl
BuildPreReq: expat, libiconv, db
PreReq: expat, libiconv, db
%if "%{with_mod_deflate}" == "yes"
BuildPreReq: zlib
PreReq: zlib
%endif
%if "%{with_mod_ssl}" == "yes"
BuildPreReq: openssl
PreReq: openssl
%endif
%if "%{with_mod_ldap}" == "yes"
BuildPreReq: openldap, openssl
PreReq: openldap, openssl
%endif
AutoReq: no
AutoReqProv: no
Conflicts: apache
%description
The Apache Project is a collaborative software development effort
aimed at creating a robust, commercial-grade, featureful, and
freely-available source code implementation of an HTTP (Web) server.
The project is jointly managed by a group of volunteers located
around the world, using the Internet and the Web to communicate,
plan, and develop the server and its related documentation. These
volunteers are known as the Apache Group. In addition, hundreds
of users have contributed ideas, code, and documentation to the
project.
NOTICE: This is Apache 2.0, a complete work-off of the old Apache
1.3 code-base, now based on the Apache Portable Runtime (APR). It
is mostly configuration compatible to Apache 1.3, but the C API is
completely incompatible.
%track
prog apache2 = {
version = %{version}
url = http://www.apache.org/dist/httpd/
regex = httpd-(2.[02468]\.\d+)\.tar\.gz
}
%prep
%setup -q -n httpd-%{version}
%patch -p0
%build
# configure package
export CC="%{l_cc}"
export CFLAGS="%{l_cflags -O}"
export CPPFLAGS="%{l_cppflags}"
export LDFLAGS="%{l_ldflags}"
export LIBS=""
case "%{l_platform -t}" in
*-sunos* ) LIBS="$LIBS -lrt" ;;
esac
%if "%{with_mod_ldap}" == "yes"
LIBS="$LIBS -lssl -lcrypto"
%endif
./configure \
--enable-layout=GNU \
--prefix=%{l_prefix} \
--sysconfdir=%{l_prefix}/etc/apache2 \
--libexecdir=%{l_prefix}/libexec/apache2 \
--with-mpm=prefork \
%if "%{with_suexec}" == "yes"
--enable-suexec \
--with-suexec-bin=%{l_prefix}/sbin/suexec \
--with-suexec-caller=%{with_suexec_caller} \
--with-suexec-userdir=%{with_suexec_userdir} \
--with-suexec-logfile=%{l_prefix}/var/apache/log/suexec.log \
%endif
%if "%{with_mod_deflate}" == "yes"
--enable-deflate \
--with-z=%{l_prefix} \
%endif
%if "%{with_mod_ssl}" == "yes"
--enable-ssl \
--with-ssl=%{l_prefix} \
%endif
%if "%{with_mod_dav}" == "yes"
--enable-dav \
--enable-dav-fs \
%endif
%if "%{with_mod_ldap}" == "yes"
--enable-ldap \
--enable-auth-ldap \
--with-ldap \
--with-ldap-include=%{l_prefix}/include/ \
--with-ldap-lib=%{l_prefix}/lib \
%endif
%if "%{with_mod_proxy}" == "yes"
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-http \
--enable-proxy-ftp \
%endif
%if "%{with_mod_filecache}" == "yes"
--enable-file-cache \
%endif
%if "%{with_shared_core}" == "yes"
--enable-so \
%endif
--enable-speling \
--enable-rewrite \
--enable-headers \
--enable-info \
--enable-mime-magic \
--enable-vhost-alias \
--enable-auth-dbm \
--disable-shared \
--disable-threads \
--with-dbm=db42 \
--with-berkeley-db=%{l_prefix} \
--with-expat=%{l_prefix} \
--with-iconv=%{l_prefix}
# build package
%{l_make} %{l_mflags}
%install
# install package
rm -rf $RPM_BUILD_ROOT
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
# adjust configuration
%{l_shtool} subst \
-e 's;^\(Listen\).*;\1 127.0.0.1:80;' \
$RPM_BUILD_ROOT%{l_prefix}/etc/apache2/httpd.conf
%if "%{with_shared_core}" == "yes"
%{l_shtool} subst \
-e 's;^build_libtool_libs=no;build_libtool_libs=yes;' \
$RPM_BUILD_ROOT%{l_prefix}/share/apache2/build/libtool
%endif
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.apache2} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# strip down installation
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/apr*
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libapr*
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
( cd $RPM_BUILD_ROOT%{l_prefix}/share/apache2/manual
find . -name "*.xml" -print | xargs rm -f
find . -name "*.xml.*" -print | xargs rm -f
find . -name "*.xsl" -print | xargs rm -f
for html in `find . -name "*.html" -print`; do
if [ -f "$html.en" ]; then
mv $html.en $html
rm -f $html.*
fi
done
rm -rf style/xsl
rm -rf style/latex
) || exit $?
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
%if "%{with_suexec}" == "yes"
'%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/suexec' \
%endif
'%config %{l_prefix}/etc/apache2/*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} apache2 status 2>/dev/null`
[ ".$apache2_active" = .yes ] && %{l_rc} apache2 restart
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} apache2 stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/apache2/log/* >/dev/null 2>&1 || true
exit 0