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.

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

mercurial