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