apache/apache.spec

changeset 684
f805be991d7f
child 685
d612d08c0455
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/apache/apache.spec	Mon Sep 17 19:01:16 2012 +0200
     1.3 @@ -0,0 +1,342 @@
     1.4 +##
     1.5 +##  apache.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +#   package information
    1.28 +Name:         apache
    1.29 +Summary:      Apache HTTP Server
    1.30 +URL:          http://httpd.apache.org/
    1.31 +Vendor:       Apache Software Foundation
    1.32 +Packager:     OpenPKG Foundation e.V.
    1.33 +Distribution: OpenPKG Community
    1.34 +Class:        BASE
    1.35 +Group:        Web
    1.36 +License:      ASF
    1.37 +Version:      2.2.22
    1.38 +Release:      20120205
    1.39 +
    1.40 +#   package options
    1.41 +%option       with_mpm_prefork          yes
    1.42 +%option       with_mpm_worker           no
    1.43 +%option       with_mpm_event            no
    1.44 +%option       with_suexec               yes
    1.45 +%option       with_suexec_caller        %{l_nusr}
    1.46 +%option       with_suexec_userdir       public_html
    1.47 +%option       with_mod_deflate          no
    1.48 +%option       with_mod_ext_filter       no
    1.49 +%option       with_mod_substitute       no
    1.50 +%option       with_mod_ssl              no
    1.51 +%option       with_mod_dav              no
    1.52 +%option       with_mod_ldap             no
    1.53 +%option       with_mod_dbd              no
    1.54 +%option       with_mod_proxy            no
    1.55 +%option       with_mod_cache            no
    1.56 +%option       with_mod_diskcache        no
    1.57 +%option       with_mod_memcache         no
    1.58 +%option       with_mod_filecache        no
    1.59 +%option       with_mod_authn_alias      no
    1.60 +
    1.61 +#   fixing implicit inter-module dependencies and correlations
    1.62 +%if "%{with_mpm_prefork}" == "yes"
    1.63 +%undefine     with_mpm_worker
    1.64 +%undefine     with_mpm_event
    1.65 +%endif
    1.66 +%if "%{with_mpm_worker}" == "yes"
    1.67 +%undefine     with_mpm_prefork
    1.68 +%undefine     with_mpm_event
    1.69 +%endif
    1.70 +%if "%{with_mpm_event}" == "yes"
    1.71 +%undefine     with_mpm_prefork
    1.72 +%undefine     with_mpm_worker
    1.73 +%endif
    1.74 +%if "%{with_mod_memcache}" == "yes" || "%{with_mod_diskcache}" == "yes"
    1.75 +%undefine     with_mod_cache
    1.76 +%define       with_mod_cache            yes
    1.77 +%endif
    1.78 +
    1.79 +#   list of sources
    1.80 +Source0:      http://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2
    1.81 +Source1:      rc.apache
    1.82 +Source2:      apache.base
    1.83 +Source3:      apache.conf
    1.84 +Source4:      apache.sh
    1.85 +Patch0:       apache.patch
    1.86 +
    1.87 +#   build information
    1.88 +BuildPreReq:  OpenPKG, openpkg >= 20100101, perl, make
    1.89 +PreReq:       OpenPKG, openpkg >= 20100101, perl
    1.90 +BuildPreReq:  apr, pcre
    1.91 +PreReq:       apr, pcre
    1.92 +%if "%{with_mpm_worker}" == "yes" || "%{with_mpm_event}" == "yes" || "%{with_mod_memcache}" == "yes"
    1.93 +BuildPreReq:  apr::with_threads = yes
    1.94 +PreReq:       apr::with_threads = yes
    1.95 +%endif
    1.96 +%if "%{with_mod_ldap}" == "yes"
    1.97 +BuildPreReq:  apr::with_ldap = yes
    1.98 +PreReq:       apr::with_ldap = yes
    1.99 +%endif
   1.100 +%if "%{with_mod_ssl}" == "yes"
   1.101 +BuildPreReq:  openssl >= 0.9.8
   1.102 +PreReq:       openssl >= 0.9.8
   1.103 +PreReq:       x509
   1.104 +%endif
   1.105 +%if "%{with_mod_deflate}" == "yes"
   1.106 +BuildPreReq:  zlib
   1.107 +PreReq:       zlib
   1.108 +%endif
   1.109 +
   1.110 +%description
   1.111 +    The Apache Project is a collaborative software development effort
   1.112 +    aimed at creating a robust, commercial-grade, featureful, and
   1.113 +    freely-available source code implementation of an HTTP (Web) server.
   1.114 +    The project is jointly managed by a group of volunteers located
   1.115 +    around the world, using the Internet and the Web to communicate,
   1.116 +    plan, and develop the server and its related documentation. These
   1.117 +    volunteers are known as the Apache Group. In addition, hundreds
   1.118 +    of users have contributed ideas, code, and documentation to the
   1.119 +    project.
   1.120 +
   1.121 +%track
   1.122 +    prog apache = {
   1.123 +        version   = %{version}
   1.124 +        url       = http://www.apache.org/dist/httpd/
   1.125 +        regex     = httpd-(2\.\d*[02468]\.\d+)\.tar\.(bz2|gz)
   1.126 +    }
   1.127 +
   1.128 +%prep
   1.129 +    #   unpack Apache distribution
   1.130 +    %setup -q -n httpd-%{version}
   1.131 +    %patch -p0
   1.132 +    %{l_shtool} subst \
   1.133 +        -e 's;(" PLATFORM ");(%{l_openpkg_release -F "OpenPKG/%%t"});g' \
   1.134 +        server/core.c
   1.135 +
   1.136 +%build
   1.137 +    #   configure package
   1.138 +    ( echo "ac_cv_func_uuid_create=no"
   1.139 +    ) >config.cache
   1.140 +    export CC="%{l_cc}"
   1.141 +    export CFLAGS="%{l_cflags -O}"
   1.142 +    export CPPFLAGS="%{l_cppflags}"
   1.143 +    export LDFLAGS="%{l_ldflags}"
   1.144 +    export LIBS=""
   1.145 +    case "%{l_platform -t}" in
   1.146 +        *-sunos* ) LIBS="$LIBS -lrt" ;;
   1.147 +    esac
   1.148 +%if "%{with_mod_ldap}" == "yes"
   1.149 +    LIBS="$LIBS -lssl -lcrypto"
   1.150 +%endif
   1.151 +    ./configure \
   1.152 +        --cache-file=./config.cache \
   1.153 +        --enable-layout=GNU \
   1.154 +        --prefix=%{l_prefix} \
   1.155 +        --with-program-name=apache \
   1.156 +        --sysconfdir=%{l_prefix}/etc/apache \
   1.157 +        --libexecdir=%{l_prefix}/libexec/apache \
   1.158 +        --includedir=%{l_prefix}/include/apache \
   1.159 +        --datadir=%{l_prefix}/share/apache \
   1.160 +        --localstatedir=%{l_prefix}/var/apache \
   1.161 +        --with-apr=%{l_prefix}/bin/apr-1-config \
   1.162 +        --with-apr-util=%{l_prefix}/bin/apu-1-config \
   1.163 +        --with-pcre=%{l_prefix} \
   1.164 +%if "%{with_mpm_prefork}" == "yes"
   1.165 +        --with-mpm="prefork" \
   1.166 +%endif
   1.167 +%if "%{with_mpm_worker}" == "yes"
   1.168 +        --with-mpm="worker" \
   1.169 +%endif
   1.170 +%if "%{with_mpm_event}" == "yes"
   1.171 +        --with-mpm="event" \
   1.172 +%endif
   1.173 +%if "%{with_mpm_worker}" == "yes" || "%{with_mpm_event}" == "yes" || "%{with_mod_memcache}" == "yes"
   1.174 +        --enable-threads \
   1.175 +%else
   1.176 +        --disable-threads \
   1.177 +%endif
   1.178 +%if "%{with_suexec}" == "yes"
   1.179 +        --enable-suexec \
   1.180 +        --with-suexec-bin=%{l_prefix}/sbin/suexec \
   1.181 +        --with-suexec-caller=%{with_suexec_caller} \
   1.182 +        --with-suexec-userdir=%{with_suexec_userdir} \
   1.183 +        --with-suexec-logfile=%{l_prefix}/var/apache/log/suexec.log \
   1.184 +%endif
   1.185 +%if "%{with_mod_deflate}" == "yes"
   1.186 +        --enable-deflate \
   1.187 +        --with-z=%{l_prefix} \
   1.188 +%endif
   1.189 +%if "%{with_mod_ext_filter}" == "yes"
   1.190 +        --enable-ext-filter \
   1.191 +%endif
   1.192 +%if "%{with_mod_substitute}" == "yes"
   1.193 +        --enable-substitute \
   1.194 +%endif
   1.195 +%if "%{with_mod_ssl}" == "yes"
   1.196 +        --enable-ssl \
   1.197 +        --with-ssl=%{l_prefix} \
   1.198 +%endif
   1.199 +%if "%{with_mod_dav}" == "yes"
   1.200 +        --enable-dav \
   1.201 +        --enable-dav-fs \
   1.202 +        --enable-dav-lock \
   1.203 +%endif
   1.204 +%if "%{with_mod_ldap}" == "yes"
   1.205 +        --enable-ldap \
   1.206 +        --enable-authnz-ldap \
   1.207 +%endif
   1.208 +%if "%{with_mod_dbd}" == "yes"
   1.209 +        --enable-dbd \
   1.210 +        --enable-authn-dbd \
   1.211 +%endif
   1.212 +%if "%{with_mod_proxy}" == "yes"
   1.213 +        --enable-proxy \
   1.214 +        --enable-proxy-connect \
   1.215 +        --enable-proxy-http \
   1.216 +        --enable-proxy-ftp \
   1.217 +        --enable-proxy-ajp \
   1.218 +        --enable-proxy-balancer \
   1.219 +%endif
   1.220 +%if "%{with_mod_cache}" == "yes"
   1.221 +        --enable-cache \
   1.222 +%if "%{with_mod_diskcache}" == "yes"
   1.223 +        --enable-disk-cache \
   1.224 +%endif
   1.225 +%if "%{with_mod_memcache}" == "yes"
   1.226 +        --enable-mem-cache \
   1.227 +%endif
   1.228 +%endif
   1.229 +%if "%{with_mod_filecache}" == "yes"
   1.230 +        --enable-file-cache \
   1.231 +%endif
   1.232 +%if "%{with_mod_authn_alias}" == "yes"
   1.233 +        --enable-authn-alias \
   1.234 +%endif
   1.235 +        --enable-filter \
   1.236 +        --enable-reqtimeout \
   1.237 +        --enable-usertrack \
   1.238 +        --enable-expires \
   1.239 +        --enable-so \
   1.240 +        --enable-speling \
   1.241 +        --enable-rewrite \
   1.242 +        --enable-headers \
   1.243 +        --enable-info \
   1.244 +        --enable-mime-magic \
   1.245 +        --enable-vhost-alias \
   1.246 +        --enable-auth-digest \
   1.247 +        --enable-auth-dbm \
   1.248 +        --enable-authz-dbm \
   1.249 +        --enable-authz-owner \
   1.250 +        --enable-unique-id \
   1.251 +        --enable-logio \
   1.252 +        --disable-shared
   1.253 +
   1.254 +    #   build package
   1.255 +    %{l_make} %{l_mflags}
   1.256 +
   1.257 +%install
   1.258 +    #   install package
   1.259 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.260 +
   1.261 +    #   create additional directories
   1.262 +    %{l_shtool} mkdir -f -p -m 755 \
   1.263 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   1.264 +        $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d \
   1.265 +        $RPM_BUILD_ROOT%{l_prefix}/var/apache/run/apache.dav \
   1.266 +        $RPM_BUILD_ROOT%{l_prefix}/var/apache/run/apache.cache
   1.267 +
   1.268 +    #   adjust GNU libtool configuration for apxs(1) runtime
   1.269 +    %{l_shtool} install -c -m 755 \
   1.270 +        -e 's;^build_libtool_libs=no;build_libtool_libs=yes;' \
   1.271 +        %{l_prefix}/share/apr/build-1/libtool \
   1.272 +        $RPM_BUILD_ROOT%{l_prefix}/share/apache/build/libtool
   1.273 +
   1.274 +    #   install shell environment script
   1.275 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.276 +         -e 's;@l_path@;%{l_build_path};' \
   1.277 +         -e 's;@l_ld_library_path@;%{l_build_ldlp};' \
   1.278 +         %{SOURCE apache.sh} \
   1.279 +         $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
   1.280 +
   1.281 +    #   create default configuration
   1.282 +    l_hostname=`%{l_shtool} echo -e %h`
   1.283 +    l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
   1.284 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   1.285 +        -e "s;@l_hostname@;$l_hostname;g" \
   1.286 +        -e "s;@l_domainname@;$l_domainname;g" \
   1.287 +        %{SOURCE apache.base} \
   1.288 +        %{SOURCE apache.conf} \
   1.289 +        $RPM_BUILD_ROOT%{l_prefix}/etc/apache/
   1.290 +    mv  $RPM_BUILD_ROOT%{l_prefix}/etc/apache/magic \
   1.291 +        $RPM_BUILD_ROOT%{l_prefix}/etc/apache/mime.magic
   1.292 +
   1.293 +    #   install run-command script
   1.294 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   1.295 +        -e 's;@with_mod_filecache@;%{with_mod_filecache};g' \
   1.296 +        %{SOURCE rc.apache} \
   1.297 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   1.298 +
   1.299 +    #   strip down installation
   1.300 +    find $RPM_BUILD_ROOT%{l_prefix}/share/apache -name "*.orig" -print | xargs rm -f
   1.301 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/share/apache/htdocs/apache_pb*
   1.302 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/apache/{extra,original}
   1.303 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/apache
   1.304 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/cgi/test-cgi
   1.305 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   1.306 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   1.307 +    ( cd $RPM_BUILD_ROOT%{l_prefix}/share/apache/manual
   1.308 +      find . -name "*.xml"   -print | xargs rm -f
   1.309 +      find . -name "*.xml.*" -print | xargs rm -f
   1.310 +      find . -name "*.xsl"   -print | xargs rm -f
   1.311 +      rm -rf style/xsl
   1.312 +      rm -rf style/latex
   1.313 +    ) || exit $?
   1.314 +
   1.315 +    #   determine installation files
   1.316 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   1.317 +        %{l_files_std} \
   1.318 +%if "%{with_suexec}" == "yes"
   1.319 +        '%attr(4755,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/suexec' \
   1.320 +%endif
   1.321 +        '%config %{l_prefix}/etc/apache/*' \
   1.322 +        '%config %attr(444,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/apache/apache.base' \
   1.323 +        '%dir %attr(750,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/apache/run/apache.dav' \
   1.324 +        '%dir %attr(750,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/apache/run/apache.cache'
   1.325 +
   1.326 +%files -f files
   1.327 +
   1.328 +%clean
   1.329 +
   1.330 +%post
   1.331 +    #   after upgrade, restart service
   1.332 +    [ $1 -eq 2 ] || exit 0
   1.333 +    eval `%{l_rc} apache status 2>/dev/null`
   1.334 +    [ ".$apache_active" = .yes ] && %{l_rc} apache restart
   1.335 +    exit 0
   1.336 +
   1.337 +%preun
   1.338 +    #   before erase, stop service and remove log files
   1.339 +    [ $1 -eq 0 ] || exit 0
   1.340 +    %{l_rc} apache stop 2>/dev/null
   1.341 +    rm -f $RPM_INSTALL_PREFIX/var/apache/log/*   >/dev/null 2>&1 || true
   1.342 +    rm -f $RPM_INSTALL_PREFIX/var/apache/run/*/* >/dev/null 2>&1 || true
   1.343 +    rm -f $RPM_INSTALL_PREFIX/var/apache/run/*   >/dev/null 2>&1 || true
   1.344 +    exit 0
   1.345 +

mercurial