memcached/memcached.spec

Wed, 21 Sep 2011 14:10:37 +0200

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

Import package vendor original specs for necessary manipulations.

     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:      20110716
    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 BuildPreReq:  OpenPKG, openpkg >= 20100101, gcc, make, perl, perl-openpkg
    51 PreReq:       OpenPKG, openpkg >= 20100101
    52 BuildPreReq:  libevent, sasl
    53 PreReq:       libevent, sasl
    55 %description
    56     Memcached is a high-performance, distributed memory object caching
    57     system, generic in nature, but intended for use in speeding up
    58     dynamic web applications by alleviating database load. Additionally,
    59     this package contains Perl and C client APIs to memcached.
    61 %track
    62     prog memcached:memcached = {
    63         version   = %{V_memcached}
    64         url       = http://code.google.com/p/memcached/downloads/list
    65         regex     = memcached-(\d+(\.\d+)+)\.tar\.gz
    66     }
    67     prog memcached:cache-memcached = {
    68         version   = %{V_cache_memcached}
    69         url       = http://www.cpan.org/authors/id/B/BR/BRADFITZ/
    70         regex     = Cache-Memcached-(__VER__)\.tar\.gz
    71     }
    72     prog memcached:libmemcached = {
    73         version   = %{V_libmemcached}
    74         url       = http://tangent.org/552/libmemcached.html
    75         regex     = libmemcached-(__VER__)\.tar\.gz
    76     }
    78 %prep
    79     %setup -q -c
    80     %setup -q -T -D -a 1
    81     %setup -q -T -D -a 2
    82     %patch -p0
    84 %build
    85     #   build daemon
    86     ( cd memcached-%{V_memcached}
    87       libs=""
    88       case "%{l_platform -t}" in
    89           *-linux* ) libs="$libs -lrt" ;;
    90       esac
    91       CC="%{l_cc}" \
    92       CFLAGS="%{l_cflags -O}" \
    93       CPPFLAGS="%{l_cppflags}" \
    94       LDFLAGS="%{l_ldflags}" \
    95       LIBS="$libs" \
    96       ./configure \
    97           --prefix=%{l_prefix} \
    98           --with-libevent=%{l_prefix} \
    99           --enable-sasl \
   100           --enable-sasl-pwdb
   101       %{l_make} %{l_mflags -O}
   102     ) || exit $?
   104     #   build C client API
   105     ( cd libmemcached-%{V_libmemcached}
   106       CC="%{l_cc}" \
   107       CFLAGS="%{l_cflags -O}" \
   108       CPPFLAGS="%{l_cppflags}" \
   109       LDFLAGS="%{l_ldflags}" \
   110       ./configure \
   111           --prefix=%{l_prefix} \
   112           --mandir=%{l_prefix}/man \
   113           --without-memcached \
   114           --enable-libevent \
   115           --with-libevent-prefix=%{l_prefix} \
   116           --enable-sasl \
   117           --with-libsasl2-prefix=%{l_prefix} \
   118           --without-libinnodb-prefix \
   119           --disable-shared
   120       %{l_make} %{l_mflags -O}
   121     ) || exit $?
   123     #   build Perl client API
   124     %{l_prefix}/bin/perl-openpkg prepare
   125     %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} configure build
   127 %install
   129     #   install daemon
   130     ( cd memcached-%{V_memcached}
   131       %{l_shtool} mkdir -f -p -m 775 \
   132           $RPM_BUILD_ROOT%{l_prefix}/bin \
   133           $RPM_BUILD_ROOT%{l_prefix}/man/man1
   134       %{l_shtool} install -c -s -m 775 \
   135           memcached $RPM_BUILD_ROOT%{l_prefix}/bin/
   136       %{l_shtool} install -c -m 644 \
   137           doc/memcached.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
   138     ) || exit $?
   140     #   install C client API
   141     ( cd libmemcached-%{V_libmemcached}
   142       %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
   143     ) || exit $?
   145     #   install Perl client API
   146     %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} install
   147     %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
   149     #   install daemon run-command script
   150     %{l_shtool} mkdir -f -p -m 755 \
   151         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   152     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   153         %{SOURCE rc.memcached} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   155     #   install daemon run-command script
   156     %{l_shtool} mkdir -f -p -m 755 \
   157         $RPM_BUILD_ROOT%{l_prefix}/var/memcached
   159     #   determine installation files
   160     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   161         %{l_files_std} `cat perl-openpkg-files` \
   162         '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/memcached'
   164 %files -f files
   166 %clean
   168 %post
   169     #   after upgrade, restart service
   170     [ $1 -eq 2 ] || exit 0
   171     eval `%{l_rc} memcached status 2>/dev/null`
   172     [ ".$memcached_active" = .yes ] && %{l_rc} memcached restart
   173     exit 0
   175 %preun
   176     #   before erase, stop service and remove log files
   177     [ $1 -eq 0 ] || exit 0
   178     %{l_rc} memcached stop 2>/dev/null
   179     rm -f $RPM_INSTALL_PREFIX/var/memcached/* >/dev/null 2>&1 || true
   180     exit 0

mercurial