## ## apache2.spec -- OpenPKG RPM Package Specification ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. ## Copyright (c) 2000-2006 Ralf S. Engelschall ## ## 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. ## # FIXME: with_mod_perl broken # package version %define V_apache 2.2.3 %define V_mod_perl 2.0.2 # package information Name: apache2 Summary: Apache HTTP Server (V2) URL: http://httpd.apache.org/ Vendor: Apache Software Foundation Packager: OpenPKG Foundation e.V. Distribution: OpenPKG Community Class: PLUS Group: Web License: ASF Version: %{V_apache} Release: 20061013 # package options (generic) %option with_mpm prefork # 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_cache no %option with_mod_diskcache no %option with_mod_memcache no %option with_mod_filecache no %option with_mod_expires no %option with_mod_perl no %option with_shared_core no # fixing implicit inter-module dependencies and correlations %if "%{with_mod_memcache}" == "yes" || "%{with_mod_diskcache}" == "yes" %undefine with_mod_cache %define with_mod_cache yes %endif # list of sources Source0: http://www.apache.org/dist/httpd/httpd-%{V_apache}.tar.gz Source1: http://perl.apache.org/dist/mod_perl-%{V_mod_perl}.tar.gz Source2: rc.apache2 Source3: apache2.base Source4: apache2.conf Source5: apache2.sh Patch0: apache2.patch # build information Prefix: %{l_prefix} BuildRoot: %{l_buildroot} BuildPreReq: OpenPKG, openpkg >= 20060823, perl, make PreReq: OpenPKG, openpkg >= 20060823, 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 >= 0.9.8 PreReq: openssl >= 0.9.8 %endif %if "%{with_mod_ldap}" == "yes" BuildPreReq: openldap, openssl >= 0.9.8 PreReq: openldap, openssl >= 0.9.8 %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.2, which is the sucessor of 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 = %{V_apache} url = http://www.apache.org/dist/httpd/ regex = httpd-(2.[02468]\.\d+)\.tar\.gz } prog apache2:mod_perl = { version = %{V_mod_perl} url = http://perl.apache.org/dist/ regex = mod_perl-(__VER__)\.tar\.gz } %prep # some pre-flight checks on options specified %if "%{with_mpm}" != "prefork" && "%{with_mpm}" != "worker" ( echo "Invalid value specified for option 'with_mpm'. Currently the" echo "only supported Multi-Processing Modules (MPMs) are ..." echo "- 'prefork' -- non-threaded, pre-forking web server (default)" echo "- 'worker' -- hybrid multi-threaded multi-process web server" ) | %{l_rpmtool} msg -b -t error exit 1 %endif # unpack Apache distribution %setup -q -c %patch -p0 -d httpd-%{V_apache} %{l_shtool} subst \ -e 's;(" PLATFORM ");(%{l_openpkg_release -F "OpenPKG/%%t"});g' \ httpd-%{V_apache}/server/core.c # unpack optional extension modules %if "%{with_mod_perl}" == "yes" %setup -q -T -D -a 1 %endif %build # optionally prepare mod_perl %if "%{with_mod_perl}" == "yes" ( cd mod_perl-%{V_mod_perl} eval `%{l_prefix}/bin/perl -V:archname` eval `%{l_prefix}/bin/perl -V:version` eval `%{l_prefix}/bin/perl -V:installarchlib -V:installprivlib -V:installsitearch -V:installsitelib` %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/bin perl=$RPM_BUILD_ROOT%{l_prefix}/bin/perl echo "#!/bin/sh" >$perl echo "exec %{l_prefix}/bin/perl \\" >>$perl echo " -I${RPM_BUILD_ROOT}${installarchlib} \\" >>$perl echo " -I${RPM_BUILD_ROOT}${installprivlib} \\" >>$perl echo " -I${RPM_BUILD_ROOT}${installsitearch} \\" >>$perl echo " -I${RPM_BUILD_ROOT}${installsitelib} \\" >>$perl echo " \"\$@\"" >>$perl chmod a+x $perl $perl Makefile.PL \ MP_AP_PREFIX="`pwd`/../httpd-%{V_apache}" \ MP_CCOPTS="%{l_cflags -O}" \ MP_INST_APACHE2=1 \ MP_USE_DSO=0 \ MP_USE_STATIC=1 \ MP_COMPAT_1X=1 %{l_make} %{l_mflags} %{l_make} %{l_mflags} install ) || exit $? %endif # configure package ( cd httpd-%{V_apache} ( echo "ac_cv_func_uuid_create=no" ) >config.cache 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_mpm}" == "worker" || "%{with_mod_memcache}" == "yes" THREADS="--enable-threads" %else THREADS="--disable-threads" %endif %if "%{with_mod_ldap}" == "yes" LIBS="$LIBS -lssl -lcrypto" %endif USE_BUNDLED_APR=YES \ ./configure \ --cache-file=./config.cache \ --enable-layout=GNU \ --prefix=%{l_prefix} \ --with-program-name=apache2 \ --sysconfdir=%{l_prefix}/etc/apache2 \ --libexecdir=%{l_prefix}/libexec/apache2 \ --with-mpm=%{with_mpm} \ $THREADS \ %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/apache2/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_cache}" == "yes" --enable-cache \ %if "%{with_mod_diskcache}" == "yes" --enable-disk-cache \ %endif %if "%{with_mod_memcache}" == "yes" --enable-mem-cache \ %endif %endif %if "%{with_mod_filecache}" == "yes" --enable-file-cache \ %endif %if "%{with_mod_expires}" == "yes" --enable-expires \ %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 \ --with-dbm=db42 \ --with-berkeley-db=%{l_prefix} \ --with-expat=%{l_prefix} \ --with-iconv=%{l_prefix} # check whether requested MPM '%{with_mpm}' has been actually selected # setting might affect package dependencies, therefore fallbacks # are not acceptable if ! grep '^MPM_NAME = %{with_mpm}$' build/config_vars.mk >/dev/null 2>&1; then ( echo "The Multi-Processing Module (MPM) '%{with_mpm}' requested using the 'with_mpm'" echo "option doesn't seem to be available on this particular platform." echo "Please check corresponding 'config.log' for details." ) | %{l_rpmtool} msg -b -t error exit 1 fi # build package %{l_make} %{l_mflags} ) || exit $? %install # install Apache rm -rf $RPM_BUILD_ROOT ( cd httpd-%{V_apache} %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/apache2.conf rm -fr $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/{extra,original} ) || exit $? %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 shell environment script %{l_shtool} install -c -m 644 %{l_value -s -a} \ -e 's;@l_path@;%{l_build_path};' \ -e 's;@l_ld_library_path@;%{l_build_ldlp};' \ %{SOURCE apache2.sh} \ $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/ # create default configuration l_hostname=`%{l_shtool} echo -e %h` l_domainname=`%{l_shtool} echo -e %d | cut -c2-` %{l_shtool} install -c -m 644 %{l_value -s -a} \ -e "s;@l_hostname@;$l_hostname;g" \ -e "s;@l_domainname@;$l_domainname;g" \ %{SOURCE apache2.base} \ %{SOURCE apache2.conf} \ $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/ mv $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/magic \ $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/mime.magic %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/apache2/apache2.d # 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/*' \ '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache2/apache2.base' %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