diff -r 67e813202d53 -r 16cc9d2eceb2 memcached/memcached.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memcached/memcached.spec Wed Sep 21 14:10:37 2011 +0200 @@ -0,0 +1,181 @@ +## +## memcached.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2011 OpenPKG Foundation e.V. +## +## 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. +## + +# package versions +%define V_memcached 1.4.6 +%define V_libmemcached 0.48 +%define V_cache_memcached 1.28 + +# package information +Name: memcached +Summary: Memory Caching Daemon +URL: http://memcached.org/ +Vendor: Brad Fitzpatrick +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: System +License: GPL +Version: %{V_memcached} +Release: 20110716 + +# list of sources +Source0: http://memcached.googlecode.com/files/memcached-%{V_memcached}.tar.gz +Source1: http://download.tangent.org/libmemcached-%{V_libmemcached}.tar.gz +Source2: http://www.cpan.org/authors/id/B/BR/BRADFITZ/Cache-Memcached-%{V_cache_memcached}.tar.gz +Source3: rc.memcached +Patch0: memcached.patch + +# build information +BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, make, perl, perl-openpkg +PreReq: OpenPKG, openpkg >= 20100101 +BuildPreReq: libevent, sasl +PreReq: libevent, sasl + +%description + Memcached is a high-performance, distributed memory object caching + system, generic in nature, but intended for use in speeding up + dynamic web applications by alleviating database load. Additionally, + this package contains Perl and C client APIs to memcached. + +%track + prog memcached:memcached = { + version = %{V_memcached} + url = http://code.google.com/p/memcached/downloads/list + regex = memcached-(\d+(\.\d+)+)\.tar\.gz + } + prog memcached:cache-memcached = { + version = %{V_cache_memcached} + url = http://www.cpan.org/authors/id/B/BR/BRADFITZ/ + regex = Cache-Memcached-(__VER__)\.tar\.gz + } + prog memcached:libmemcached = { + version = %{V_libmemcached} + url = http://tangent.org/552/libmemcached.html + regex = libmemcached-(__VER__)\.tar\.gz + } + +%prep + %setup -q -c + %setup -q -T -D -a 1 + %setup -q -T -D -a 2 + %patch -p0 + +%build + # build daemon + ( cd memcached-%{V_memcached} + libs="" + case "%{l_platform -t}" in + *-linux* ) libs="$libs -lrt" ;; + esac + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags}" \ + LIBS="$libs" \ + ./configure \ + --prefix=%{l_prefix} \ + --with-libevent=%{l_prefix} \ + --enable-sasl \ + --enable-sasl-pwdb + %{l_make} %{l_mflags -O} + ) || exit $? + + # build C client API + ( cd libmemcached-%{V_libmemcached} + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags}" \ + ./configure \ + --prefix=%{l_prefix} \ + --mandir=%{l_prefix}/man \ + --without-memcached \ + --enable-libevent \ + --with-libevent-prefix=%{l_prefix} \ + --enable-sasl \ + --with-libsasl2-prefix=%{l_prefix} \ + --without-libinnodb-prefix \ + --disable-shared + %{l_make} %{l_mflags -O} + ) || exit $? + + # build Perl client API + %{l_prefix}/bin/perl-openpkg prepare + %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} configure build + +%install + + # install daemon + ( cd memcached-%{V_memcached} + %{l_shtool} mkdir -f -p -m 775 \ + $RPM_BUILD_ROOT%{l_prefix}/bin \ + $RPM_BUILD_ROOT%{l_prefix}/man/man1 + %{l_shtool} install -c -s -m 775 \ + memcached $RPM_BUILD_ROOT%{l_prefix}/bin/ + %{l_shtool} install -c -m 644 \ + doc/memcached.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ + ) || exit $? + + # install C client API + ( cd libmemcached-%{V_libmemcached} + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" + ) || exit $? + + # install Perl client API + %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} install + %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup + + # install daemon 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.memcached} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install daemon run-command script + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/var/memcached + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} `cat perl-openpkg-files` \ + '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/memcached' + +%files -f files + +%clean + +%post + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} memcached status 2>/dev/null` + [ ".$memcached_active" = .yes ] && %{l_rc} memcached restart + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} memcached stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/memcached/* >/dev/null 2>&1 || true + exit 0 +