File memcached.spec of Package memcached
%define realname memcached
%define realver 1.6.12
%define srcext tar.gz
%bcond_without systemd
%if ! 0%{?_fillupdir:1}
%global _fillupdir /var/adm/fillup-templates
%endif
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}
Version: %{realver}%{?extraver:~%{extraver}}
Release: wiz1%{?dist}
License: MIT or GPL-2.0
Group: Productivity/Databases/Tools
URL: https://memcached.org/
Summary: A high-performance, distributed memory object caching system
# SystemD dependencies
%if %{with systemd}
Requires: systemd
BuildRequires: systemd-devel
%endif
# Build-time parameters
BuildRequires: cyrus-sasl-devel
BuildRequires: libevent-devel
BuildRequires: libxslt%{?suse_version:-tools}
BuildRoot: %{_tmppath}/%{name}-root
Source: http://www.memcached.org/files/%{realname}-%{version}%{?extraver}.%{srcext}
%description
Free & open source, high-performance, distributed memory object caching system,
generic in nature, but intended for use in speeding up dynamic web applications
by alleviating database load.
Memcached is an in-memory key-value store for small chunks of arbitrary
data (strings, objects) from results of database calls, API calls,
or page rendering.
%package devel
Group: Development/Languages/C and C++
Summary: Development stuff for %{name}
Requires: %{name} = %{version}-%{release}
%description devel
Stuff required to develop software using %{name}.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
# Build step
%build
_CFLAGS='-fPIE %{optflags} %{?gcc_lto} -UNDEBUG'
_LDFLAGS='-fPIE -Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%configure \
--disable-static \
--enable-sasl \
--enable-sasl-pwdb \
%if %{__isa_bits} == 64
--enable-64bit \
%endif
--with-libevent \
CFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
# Install built stuff
%install
%{__make} install DESTDIR=%{buildroot}
%{__install} -m0755 scripts/memcached-tool %{buildroot}%{_bindir}/memcached-tool
%{__install} -m0644 scripts/memcached-tool.1 %{buildroot}%{_mandir}/man1/memcached-tool.1
%{__install} -D -m0755 scripts/start-memcached %{buildroot}/usr/share/memcached/scripts/start-memcached
%if 0%{?_unitdir:1}
%{__install} -D -m0644 scripts/memcached.service %{buildroot}%{_unitdir}/memcached.service
%{__install} -D -m0644 scripts/memcached@.service %{buildroot}%{_unitdir}/memcached@.service
%else
%if 0%{?rhel} == 6
%{__install} -D -m0644 scripts/memcached.upstart %{buildroot}/etc/init/memcached.conf
%{__install} -D -m0644 scripts/memcached-server.upstart %{buildroot}/etc/init/memcached-server.conf
%else
%if "%{expand:%_vendor}" == "suse"
%{__install} -D -m0644 scripts/memcached-init %{buildroot}%{_initrddir}/memcached
%else
%{__install} -D -m0644 scripts/memcached.sysv %{buildroot}%{_initrddir}/memcached
%endif
%endif
%endif
%if "%{expand:%_vendor}" == "suse"
%{__install} -D -m0644 scripts/memcached.sysconfig %{buildroot}%{_fillupdir}/sysconfig.memcached
%else
%{__install} -D -m0644 scripts/memcached.sysconfig %{buildroot}/etc/sysconfig/memcached
%endif
# Cleanup
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
# Files list
%files
%defattr(-,root,root)
%license COPYING
%doc AUTHORS README.md
%{_bindir}/*
/usr/share/memcached/
%if 0%{?_unitdir:1}
%{_unitdir}/*
%else
%if 0%{?rhel} == 6
/etc/init/*
%else
%{_initrddir}/memcached
%endif
%endif
%if "%{expand:%_vendor}" == "suse"
%{_fillupdir}/sysconfig.memcached
%else
/etc/sysconfig/memcached
%endif
%doc %{_mandir}/man1/*
%files devel
%defattr(-,root,root)
%license COPYING
%doc AUTHORS README.md
%{_includedir}/*
%changelog