LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File memcached.spec of Package memcached (Project network:utilities)

#
# spec file for package memcached
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%if 0%{?suse_version} > 1210
%bcond_without systemd
%endif

Name:           memcached
Version:        1.4.15
Release:        0
%define pkg_name memcached
%define pkg_version %{version}
#
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1100
BuildRequires:  libevent-devel
%else
BuildRequires:  libevent
%endif
BuildRequires:  automake
BuildRequires:  cyrus-sasl-devel
BuildRequires:  pkgconfig
%if %{with systemd}
BuildRequires:  systemd
%endif
PreReq:         %insserv_prereq %fillup_prereq /usr/sbin/groupadd /usr/sbin/useradd
Conflicts:      memcached-unstable
%define home_dir /var/lib/%{pkg_name}
Url:            http://memcached.org/
Source:         http://memcached.googlecode.com/files/%{name}-%{version}.tar.gz
Source1:        %{pkg_name}.init
Source2:        %{pkg_name}.sysconfig
Source3:        memcached-rpmlintrc
Source4:        memcached.service
#
Patch0:         memcached-1.4.5.dif
Patch1:         memcached-autofoo.patch
Patch2:         memcached-use-endian_h.patch
#
Summary:        A high-performance, distributed memory object caching system
License:        BSD-3-Clause
Group:          Productivity/Networking/Other
%if %{with systemd}
%{?systemd_requires}
%endif
%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.

Danga Interactive developed memcached to enhance the speed of
LiveJournal.com, a site which was already doing 20 million+ dynamic
page views per day for 1 million users with a bunch of webservers and a
bunch of database servers. memcached dropped the database load to
almost nothing, yielding faster page load times for users, better
resource utilization, and faster access to the databases on a memcache
miss.

%prep
%setup -q -n %{pkg_name}-%{pkg_version}
%patch0
%patch1
%patch2

%build
autoreconf -fiv
%if 0%{?suse_version} <= 1140
export LIBEVENT_CFLAGS="-I%{_includedir}"
export LIBEVENT_LIBS="-levent"
%endif
%configure --enable-sasl --disable-coverage --bindir=%{_sbindir}

make %{?_smp_mflags}

%check
%{__make} test

%install
%makeinstall
%{__install} -D  -m 0755 scripts/memcached-tool %{buildroot}%{_sbindir}/memcached-tool
%{__install} -Dd -m 0755 %{buildroot}%{home_dir}
%{__install} -D  -m 0755 %{S:1} %{buildroot}%{_sysconfdir}/init.d/%{pkg_name}
%{__ln_s} -f ../..%{_sysconfdir}/init.d/%{pkg_name} %{buildroot}%{_sbindir}/rc%{pkg_name}
%{__install} -D  -m 0644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.%{pkg_name}
%if %{with systemd}
%{__install} -D  -m 0644 %{S:4} %{buildroot}%{_unitdir}/%{pkg_name}.service
%endif

%clean
%{__rm} -rf %{buildroot};

%pre
/usr/sbin/groupadd -r %{pkg_name} &>/dev/null || :
/usr/sbin/useradd -o -g %{pkg_name} -s /bin/false -r -c "user for %{pkg_name}" -d %{home_dir} %{pkg_name} &>/dev/null || :
%if %{with systemd}
%service_add_pre %{pkg_name}.service
%endif

%post
%fillup_and_insserv %{pkg_name}
%if %{with systemd}
%service_add_post %{pkg_name}.service
%endif

%preun
%stop_on_removal %{pkg_name}
%if %{with systemd}
%service_del_preun %{pkg_name}.service
%endif

%postun
%restart_on_update %{pkg_name}
%{insserv_cleanup}
%if %{with systemd}
%service_del_postun %{pkg_name}.service
%endif

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING NEWS doc/*.txt
%{_sbindir}/%{pkg_name}
# %{_sbindir}/%{pkg_name}-debug
%{_sbindir}/memcached-tool
%{_sbindir}/rc%{pkg_name}
%{_mandir}/man1/%{pkg_name}.*
%{_sysconfdir}/init.d/%{pkg_name}
%{_includedir}/%{pkg_name}
/var/adm/fillup-templates/sysconfig.%{pkg_name}
%dir %attr(755,root,root) %{home_dir}
%if %{with systemd}
%{_unitdir}/%{pkg_name}.service
%endif

%changelog