memcached/memcached.spec

Wed, 21 Sep 2011 14:13:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 21 Sep 2011 14:13:05 +0200
changeset 379
5974eb964eec
parent 378
16cc9d2eceb2
child 576
b3a1e74cc78b
permissions
-rw-r--r--

Backport RPM boilerplate logic required by legacy OpenPKG scripts,
and port build configuration to build correctly on SVR5.

     1 ##
     2 ##  memcached.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package versions
    25 %define       V_memcached       1.4.6
    26 %define       V_libmemcached    0.48
    27 %define       V_cache_memcached 1.28
    29 #   package information
    30 Name:         memcached
    31 Summary:      Memory Caching Daemon
    32 URL:          http://memcached.org/
    33 Vendor:       Brad Fitzpatrick
    34 Packager:     OpenPKG Foundation e.V.
    35 Distribution: OpenPKG Community
    36 Class:        EVAL
    37 Group:        System
    38 License:      GPL
    39 Version:      %{V_memcached}
    40 Release:      20110914
    42 #   list of sources
    43 Source0:      http://memcached.googlecode.com/files/memcached-%{V_memcached}.tar.gz
    44 Source1:      http://download.tangent.org/libmemcached-%{V_libmemcached}.tar.gz
    45 Source2:      http://www.cpan.org/authors/id/B/BR/BRADFITZ/Cache-Memcached-%{V_cache_memcached}.tar.gz
    46 Source3:      rc.memcached
    47 Patch0:       memcached.patch
    49 #   build information
    50 Prefix:       %{l_prefix}
    51 BuildRoot:    %{l_buildroot}
    52 BuildPreReq:  OpenPKG, openpkg >= 20060823, gcc, make, perl, perl-openpkg
    53 PreReq:       OpenPKG, openpkg >= 20060823
    54 BuildPreReq:  libevent, sasl
    55 PreReq:       libevent, sasl
    56 AutoReq:      no
    57 AutoReqProv:  no
    59 %description
    60     Memcached is a high-performance, distributed memory object caching
    61     system, generic in nature, but intended for use in speeding up
    62     dynamic web applications by alleviating database load. Additionally,
    63     this package contains Perl and C client APIs to memcached.
    65 %track
    66     prog memcached:memcached = {
    67         version   = %{V_memcached}
    68         url       = http://code.google.com/p/memcached/downloads/list
    69         regex     = memcached-(\d+(\.\d+)+)\.tar\.gz
    70     }
    71     prog memcached:cache-memcached = {
    72         version   = %{V_cache_memcached}
    73         url       = http://www.cpan.org/authors/id/B/BR/BRADFITZ/
    74         regex     = Cache-Memcached-(__VER__)\.tar\.gz
    75     }
    76     prog memcached:libmemcached = {
    77         version   = %{V_libmemcached}
    78         url       = http://tangent.org/552/libmemcached.html
    79         regex     = libmemcached-(__VER__)\.tar\.gz
    80     }
    82 %prep
    83     %setup -q -c
    84     %setup -q -T -D -a 1
    85     %setup -q -T -D -a 2
    86     %patch -p0
    87     %{l_shtool} subst \
    88         -e 's; *-Werror;;g' \
    89         memcached-%{V_memcached}/configure
    90     %{l_shtool} subst \
    91         -e 's;\(libdir="\${libdir}\)/\${isainfo_k};\1;g' \
    92         libmemcached-%{V_libmemcached}/configure
    94 %build
    95     #   build daemon
    96     ( cd memcached-%{V_memcached}
    97       libs=""
    98       case "%{l_platform -t}" in
    99           *-linux* ) libs="$libs -lrt" ;;
   100           *-sunos* ) libs="$libs -lsocket -lnsl" ;;
   101       esac
   102       CC="%{l_cc}" \
   103       CFLAGS="%{l_cflags -O}" \
   104       CPPFLAGS="%{l_cppflags}" \
   105       LDFLAGS="%{l_ldflags}" \
   106       LIBS="$libs" \
   107       ./configure \
   108           --prefix=%{l_prefix} \
   109           --with-libevent=%{l_prefix} \
   110           --enable-sasl \
   111           --enable-sasl-pwdb
   112       %{l_make} %{l_mflags -O}
   113     ) || exit $?
   115     #   build C client API
   116     ( cd libmemcached-%{V_libmemcached}
   117       CC="%{l_cc}" \
   118       CFLAGS="%{l_cflags -O}" \
   119       CPPFLAGS="%{l_cppflags}" \
   120       LDFLAGS="%{l_ldflags}" \
   121       ./configure \
   122           --prefix=%{l_prefix} \
   123           --mandir=%{l_prefix}/man \
   124           --without-memcached \
   125           --enable-libevent \
   126           --with-libevent-prefix=%{l_prefix} \
   127           --enable-sasl \
   128           --with-libsasl2-prefix=%{l_prefix} \
   129           --without-libinnodb-prefix \
   130           --disable-shared
   131       %{l_make} %{l_mflags -O}
   132     ) || exit $?
   134     #   build Perl client API
   135     %{l_prefix}/bin/perl-openpkg prepare
   136     %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} configure build
   138 %install
   139     #   remove build cruft
   140     rm -rf $RPM_BUILD_ROOT
   142     #   install daemon
   143     ( cd memcached-%{V_memcached}
   144       %{l_shtool} mkdir -f -p -m 775 \
   145           $RPM_BUILD_ROOT%{l_prefix}/bin \
   146           $RPM_BUILD_ROOT%{l_prefix}/man/man1
   147       %{l_shtool} install -c -s -m 775 \
   148           memcached $RPM_BUILD_ROOT%{l_prefix}/bin/
   149       %{l_shtool} install -c -m 644 \
   150           doc/memcached.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
   151     ) || exit $?
   153     #   install C client API
   154     ( cd libmemcached-%{V_libmemcached}
   155       %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
   156     ) || exit $?
   158     #   install Perl client API
   159     %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} install
   160     %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
   162     #   install daemon run-command script
   163     %{l_shtool} mkdir -f -p -m 755 \
   164         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   165     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   166         %{SOURCE rc.memcached} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   168     #   install daemon run-command script
   169     %{l_shtool} mkdir -f -p -m 755 \
   170         $RPM_BUILD_ROOT%{l_prefix}/var/memcached
   172     #   determine installation files
   173     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   174         %{l_files_std} `cat perl-openpkg-files` \
   175         '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/memcached'
   177 %files -f files
   179 %clean
   180     rm -rf $RPM_BUILD_ROOT
   182 %post
   183     #   after upgrade, restart service
   184     [ $1 -eq 2 ] || exit 0
   185     eval `%{l_rc} memcached status 2>/dev/null`
   186     [ ".$memcached_active" = .yes ] && %{l_rc} memcached restart
   187     exit 0
   189 %preun
   190     #   before erase, stop service and remove log files
   191     [ $1 -eq 0 ] || exit 0
   192     %{l_rc} memcached stop 2>/dev/null
   193     rm -f $RPM_INSTALL_PREFIX/var/memcached/* >/dev/null 2>&1 || true
   194     exit 0

mercurial