1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/memcached/memcached.spec Wed Sep 21 14:10:37 2011 +0200 1.3 @@ -0,0 +1,181 @@ 1.4 +## 1.5 +## memcached.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2011 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 versions 1.28 +%define V_memcached 1.4.6 1.29 +%define V_libmemcached 0.48 1.30 +%define V_cache_memcached 1.28 1.31 + 1.32 +# package information 1.33 +Name: memcached 1.34 +Summary: Memory Caching Daemon 1.35 +URL: http://memcached.org/ 1.36 +Vendor: Brad Fitzpatrick 1.37 +Packager: OpenPKG Foundation e.V. 1.38 +Distribution: OpenPKG Community 1.39 +Class: EVAL 1.40 +Group: System 1.41 +License: GPL 1.42 +Version: %{V_memcached} 1.43 +Release: 20110716 1.44 + 1.45 +# list of sources 1.46 +Source0: http://memcached.googlecode.com/files/memcached-%{V_memcached}.tar.gz 1.47 +Source1: http://download.tangent.org/libmemcached-%{V_libmemcached}.tar.gz 1.48 +Source2: http://www.cpan.org/authors/id/B/BR/BRADFITZ/Cache-Memcached-%{V_cache_memcached}.tar.gz 1.49 +Source3: rc.memcached 1.50 +Patch0: memcached.patch 1.51 + 1.52 +# build information 1.53 +BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, make, perl, perl-openpkg 1.54 +PreReq: OpenPKG, openpkg >= 20100101 1.55 +BuildPreReq: libevent, sasl 1.56 +PreReq: libevent, sasl 1.57 + 1.58 +%description 1.59 + Memcached is a high-performance, distributed memory object caching 1.60 + system, generic in nature, but intended for use in speeding up 1.61 + dynamic web applications by alleviating database load. Additionally, 1.62 + this package contains Perl and C client APIs to memcached. 1.63 + 1.64 +%track 1.65 + prog memcached:memcached = { 1.66 + version = %{V_memcached} 1.67 + url = http://code.google.com/p/memcached/downloads/list 1.68 + regex = memcached-(\d+(\.\d+)+)\.tar\.gz 1.69 + } 1.70 + prog memcached:cache-memcached = { 1.71 + version = %{V_cache_memcached} 1.72 + url = http://www.cpan.org/authors/id/B/BR/BRADFITZ/ 1.73 + regex = Cache-Memcached-(__VER__)\.tar\.gz 1.74 + } 1.75 + prog memcached:libmemcached = { 1.76 + version = %{V_libmemcached} 1.77 + url = http://tangent.org/552/libmemcached.html 1.78 + regex = libmemcached-(__VER__)\.tar\.gz 1.79 + } 1.80 + 1.81 +%prep 1.82 + %setup -q -c 1.83 + %setup -q -T -D -a 1 1.84 + %setup -q -T -D -a 2 1.85 + %patch -p0 1.86 + 1.87 +%build 1.88 + # build daemon 1.89 + ( cd memcached-%{V_memcached} 1.90 + libs="" 1.91 + case "%{l_platform -t}" in 1.92 + *-linux* ) libs="$libs -lrt" ;; 1.93 + esac 1.94 + CC="%{l_cc}" \ 1.95 + CFLAGS="%{l_cflags -O}" \ 1.96 + CPPFLAGS="%{l_cppflags}" \ 1.97 + LDFLAGS="%{l_ldflags}" \ 1.98 + LIBS="$libs" \ 1.99 + ./configure \ 1.100 + --prefix=%{l_prefix} \ 1.101 + --with-libevent=%{l_prefix} \ 1.102 + --enable-sasl \ 1.103 + --enable-sasl-pwdb 1.104 + %{l_make} %{l_mflags -O} 1.105 + ) || exit $? 1.106 + 1.107 + # build C client API 1.108 + ( cd libmemcached-%{V_libmemcached} 1.109 + CC="%{l_cc}" \ 1.110 + CFLAGS="%{l_cflags -O}" \ 1.111 + CPPFLAGS="%{l_cppflags}" \ 1.112 + LDFLAGS="%{l_ldflags}" \ 1.113 + ./configure \ 1.114 + --prefix=%{l_prefix} \ 1.115 + --mandir=%{l_prefix}/man \ 1.116 + --without-memcached \ 1.117 + --enable-libevent \ 1.118 + --with-libevent-prefix=%{l_prefix} \ 1.119 + --enable-sasl \ 1.120 + --with-libsasl2-prefix=%{l_prefix} \ 1.121 + --without-libinnodb-prefix \ 1.122 + --disable-shared 1.123 + %{l_make} %{l_mflags -O} 1.124 + ) || exit $? 1.125 + 1.126 + # build Perl client API 1.127 + %{l_prefix}/bin/perl-openpkg prepare 1.128 + %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} configure build 1.129 + 1.130 +%install 1.131 + 1.132 + # install daemon 1.133 + ( cd memcached-%{V_memcached} 1.134 + %{l_shtool} mkdir -f -p -m 775 \ 1.135 + $RPM_BUILD_ROOT%{l_prefix}/bin \ 1.136 + $RPM_BUILD_ROOT%{l_prefix}/man/man1 1.137 + %{l_shtool} install -c -s -m 775 \ 1.138 + memcached $RPM_BUILD_ROOT%{l_prefix}/bin/ 1.139 + %{l_shtool} install -c -m 644 \ 1.140 + doc/memcached.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ 1.141 + ) || exit $? 1.142 + 1.143 + # install C client API 1.144 + ( cd libmemcached-%{V_libmemcached} 1.145 + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" 1.146 + ) || exit $? 1.147 + 1.148 + # install Perl client API 1.149 + %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} install 1.150 + %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup 1.151 + 1.152 + # install daemon run-command script 1.153 + %{l_shtool} mkdir -f -p -m 755 \ 1.154 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.155 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.156 + %{SOURCE rc.memcached} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.157 + 1.158 + # install daemon run-command script 1.159 + %{l_shtool} mkdir -f -p -m 755 \ 1.160 + $RPM_BUILD_ROOT%{l_prefix}/var/memcached 1.161 + 1.162 + # determine installation files 1.163 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.164 + %{l_files_std} `cat perl-openpkg-files` \ 1.165 + '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/memcached' 1.166 + 1.167 +%files -f files 1.168 + 1.169 +%clean 1.170 + 1.171 +%post 1.172 + # after upgrade, restart service 1.173 + [ $1 -eq 2 ] || exit 0 1.174 + eval `%{l_rc} memcached status 2>/dev/null` 1.175 + [ ".$memcached_active" = .yes ] && %{l_rc} memcached restart 1.176 + exit 0 1.177 + 1.178 +%preun 1.179 + # before erase, stop service and remove log files 1.180 + [ $1 -eq 0 ] || exit 0 1.181 + %{l_rc} memcached stop 2>/dev/null 1.182 + rm -f $RPM_INSTALL_PREFIX/var/memcached/* >/dev/null 2>&1 || true 1.183 + exit 0 1.184 +