memcached/memcached.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 379
5974eb964eec
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

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@576 25 %define V_memcached 1.4.14
michael@576 26 %define V_libmemcached 1.0.10
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@576 40 Release: 20120800
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@576 50 BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, make, perl, perl-openpkg
michael@576 51 PreReq: OpenPKG, openpkg >= 20100101
michael@576 52 BuildPreReq: libevent, sasl, libexecinfo
michael@576 53 PreReq: libevent, sasl, libexecinfo
michael@378 54
michael@378 55 %description
michael@576 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@379 83 %{l_shtool} subst \
michael@576 84 -e 's/b = \(__sync_sub_and_fetch(\&a, 2);\)/return \1/' \
michael@576 85 memcached-%{V_memcached}/configure
michael@576 86 %{l_shtool} subst \
michael@379 87 -e 's; *-Werror;;g' \
michael@379 88 memcached-%{V_memcached}/configure
michael@379 89 %{l_shtool} subst \
michael@379 90 -e 's;\(libdir="\${libdir}\)/\${isainfo_k};\1;g' \
michael@379 91 libmemcached-%{V_libmemcached}/configure
michael@378 92
michael@378 93 %build
michael@378 94 # build daemon
michael@378 95 ( cd memcached-%{V_memcached}
michael@378 96 libs=""
michael@378 97 case "%{l_platform -t}" in
michael@378 98 *-linux* ) libs="$libs -lrt" ;;
michael@379 99 *-sunos* ) libs="$libs -lsocket -lnsl" ;;
michael@378 100 esac
michael@378 101 CC="%{l_cc}" \
michael@378 102 CFLAGS="%{l_cflags -O}" \
michael@378 103 CPPFLAGS="%{l_cppflags}" \
michael@378 104 LDFLAGS="%{l_ldflags}" \
michael@378 105 LIBS="$libs" \
michael@378 106 ./configure \
michael@378 107 --prefix=%{l_prefix} \
michael@378 108 --with-libevent=%{l_prefix} \
michael@378 109 --enable-sasl \
michael@378 110 --enable-sasl-pwdb
michael@378 111 %{l_make} %{l_mflags -O}
michael@378 112 ) || exit $?
michael@378 113
michael@378 114 # build C client API
michael@378 115 ( cd libmemcached-%{V_libmemcached}
michael@576 116 ( echo "ac_cv_func_malloc_0_nonnull=yes"
michael@576 117 echo "ac_cv_func_realloc_0_nonnull=yes"
michael@576 118 echo "ac_cv_env_CXXFLAGS_set=barf"
michael@576 119 echo "ac_cv_env_CFLAGS_set=barf"
michael@576 120 echo "ac_cv_header_priv_h=no"
michael@576 121 echo "ac_cv_header_umem_h=no"
michael@576 122 ) >config.cache
michael@378 123 CC="%{l_cc}" \
michael@378 124 CFLAGS="%{l_cflags -O}" \
michael@378 125 CPPFLAGS="%{l_cppflags}" \
michael@378 126 LDFLAGS="%{l_ldflags}" \
michael@378 127 ./configure \
michael@576 128 --cache-file=./config.cache \
michael@378 129 --prefix=%{l_prefix} \
michael@378 130 --mandir=%{l_prefix}/man \
michael@378 131 --without-memcached \
michael@378 132 --enable-libevent \
michael@378 133 --with-libevent-prefix=%{l_prefix} \
michael@378 134 --enable-sasl \
michael@378 135 --with-libsasl2-prefix=%{l_prefix} \
michael@378 136 --without-libinnodb-prefix \
michael@378 137 --disable-shared
michael@378 138 %{l_make} %{l_mflags -O}
michael@378 139 ) || exit $?
michael@378 140
michael@378 141 # build Perl client API
michael@378 142 %{l_prefix}/bin/perl-openpkg prepare
michael@378 143 %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} configure build
michael@378 144
michael@378 145 %install
michael@378 146 # install daemon
michael@378 147 ( cd memcached-%{V_memcached}
michael@378 148 %{l_shtool} mkdir -f -p -m 775 \
michael@378 149 $RPM_BUILD_ROOT%{l_prefix}/bin \
michael@378 150 $RPM_BUILD_ROOT%{l_prefix}/man/man1
michael@378 151 %{l_shtool} install -c -s -m 775 \
michael@378 152 memcached $RPM_BUILD_ROOT%{l_prefix}/bin/
michael@378 153 %{l_shtool} install -c -m 644 \
michael@378 154 doc/memcached.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
michael@378 155 ) || exit $?
michael@378 156
michael@378 157 # install C client API
michael@378 158 ( cd libmemcached-%{V_libmemcached}
michael@576 159 %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
michael@576 160 ) || exit $?
michael@576 161
michael@576 162 # correct header names and references
michael@576 163 ( cd $RPM_BUILD_ROOT%{l_prefix}/include
michael@576 164 mv libmemcachedutil-[0-9]* libmemcachedutil
michael@576 165 mv libmemcachedprotocol-[0-9]* libmemcachedprotocol
michael@576 166 rm -rf libhashkit && mv libhashkit-[0-9]* libhashkit
michael@576 167 rm -rf libmemcached && mv libmemcached-[0-9]* libmemcached
michael@576 168 find . -type f -print | xargs %{l_shtool} subst \
michael@576 169 -e 's;\(#include <lib[^\-][^\-]*\)-[0-9\.][0-9\.]*;\1;g'
michael@378 170 ) || exit $?
michael@378 171
michael@378 172 # install Perl client API
michael@378 173 %{l_prefix}/bin/perl-openpkg -d Cache-Memcached-%{V_cache_memcached} install
michael@378 174 %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
michael@378 175
michael@576 176 # install daemon runcommand script
michael@378 177 %{l_shtool} mkdir -f -p -m 755 \
michael@378 178 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@378 179 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@378 180 %{SOURCE rc.memcached} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@378 181
michael@576 182 # create directory hierarchy for daemon
michael@378 183 %{l_shtool} mkdir -f -p -m 755 \
michael@378 184 $RPM_BUILD_ROOT%{l_prefix}/var/memcached
michael@378 185
michael@378 186 # determine installation files
michael@378 187 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@378 188 %{l_files_std} `cat perl-openpkg-files` \
michael@378 189 '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/memcached'
michael@378 190
michael@378 191 %files -f files
michael@378 192
michael@378 193 %clean
michael@378 194
michael@378 195 %post
michael@378 196 # after upgrade, restart service
michael@378 197 [ $1 -eq 2 ] || exit 0
michael@378 198 eval `%{l_rc} memcached status 2>/dev/null`
michael@378 199 [ ".$memcached_active" = .yes ] && %{l_rc} memcached restart
michael@378 200 exit 0
michael@378 201
michael@378 202 %preun
michael@378 203 # before erase, stop service and remove log files
michael@378 204 [ $1 -eq 0 ] || exit 0
michael@378 205 %{l_rc} memcached stop 2>/dev/null
michael@378 206 rm -f $RPM_INSTALL_PREFIX/var/memcached/* >/dev/null 2>&1 || true
michael@378 207 exit 0
michael@378 208

mercurial