1%bcond_with extstore 2%bcond_with seccomp 3%bcond_with sasl 4%bcond_with sasl_pwdb 5%bcond_with dtrace 6%bcond_with 64bit 7%bcond_without option_checking 8%bcond_without coverage 9%bcond_without docs 10 11# Set with_systemd on distros that use it, so we can install the service 12# file, otherwise the sysvinit script will be installed 13%if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210 14%global with_systemd 1 15BuildRequires: systemd-units 16 17# Disable some systemd safety features on OSes without a new enough systemd 18# (new enough is systemd >= 233) 19%if 0%{?fedora} < 26 || 0%{?rhel} > 0 20%global safer_systemd 0 21%else 22%global safer_systemd 1 23%endif 24 25%else 26%global with_systemd 0 27%endif 28 29Name: memcached 30Version: @VERSION@ 31Release: @RELEASE@%{?dist} 32Summary: High Performance, Distributed Memory Object Cache 33 34Group: System Environment/Daemons 35License: BSD 36URL: https://memcached.org 37Source0: https://memcached.org/files/%{name}-%{version}.tar.gz 38Source1: memcached.sysconfig 39Source2: memcached.service 40Source3: [email protected] 41BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 42 43BuildRequires: libevent-devel 44BuildRequires: perl(Test::More) 45BuildRequires: /usr/bin/prove 46Requires: initscripts 47%if %{with_systemd} 48Requires(post): systemd-units 49Requires(preun): systemd-units 50Requires(postun): systemd-units 51%else 52Requires(post): /sbin/chkconfig 53Requires(preun): /sbin/chkconfig, /sbin/service 54Requires(postun): /sbin/service 55%endif 56 57%description 58memcached is a high-performance, distributed memory object caching 59system, generic in nature, but intended for use in speeding up dynamic 60web applications by alleviating database load. 61 62%prep 63%setup -q -n %{name}-%{version} 64 65 66%build 67%configure \ 68 %{?with_extstore:--enable-extstore} \ 69 %{?with_seccomp:--enable-seccomp} \ 70 %{?with_sasl:--enable-sasl} \ 71 %{?with_sasl_pwdb:--enable-pwdb} \ 72 %{?with_dtrace:--enable-dtrace} \ 73 %{?with_64bit:--enable-64bit} \ 74 %{!?with_option_checking:--disable-option-checking} 75 %{!?with_coverage:--disable-coverage} \ 76 %{!?with_docs:--disable-docs} 77 78make %{?_smp_mflags} 79 80 81%check 82make test 83 84 85%install 86rm -rf %{buildroot} 87make install DESTDIR=%{buildroot} 88 89# remove memcached-debug 90rm -f %{buildroot}/%{_bindir}/%{name}-debug 91 92# Perl script for monitoring memcached 93install -Dp -m0755 scripts/memcached-tool %{buildroot}%{_bindir}/%{name}-tool 94 95# Init script 96%if %{with_systemd} 97install -Dp -m0755 scripts/memcached.service %{buildroot}%{_unitdir}/%{name}.service 98install -Dp -m0755 scripts/memcached@.service %{buildroot}%{_unitdir}/%{name}@.service 99 100if [ %{safer_systemd} -gt 0 ]; then 101 sed -e 's/^##safer##//g' -i %{buildroot}%{_unitdir}/%{name}.service %{buildroot}%{_unitdir}/%{name}@.service 102else 103 sed -e 's/^##safer##/#/g' -i %{buildroot}%{_unitdir}/%{name}.service %{buildroot}%{_unitdir}/%{name}@.service 104fi 105%else 106install -Dp -m0755 scripts/memcached.sysv %{buildroot}%{_initrddir}/%{name} 107%endif 108 109# Default configs 110install -Dp -m0644 scripts/memcached.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name} 111 112# pid directory 113mkdir -p %{buildroot}/%{_localstatedir}/run/%{name} 114 115 116%clean 117rm -rf %{buildroot} 118 119 120%post 121if [ $1 -eq 1 ]; then 122 # Initial install 123%if %{with_systemd} 124 /bin/systemctl daemon-reload >/dev/null 2>&1 || : 125%else 126 /sbin/chkconfig --add %{name} 127%endif 128fi 129 130 131%preun 132if [ "$1" = 0 ] ; then 133 # Removal, not upgrade 134%if %{with_systemd} 135 /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : 136 /bin/systemctl --no-reload disable %{name}@\*.service > /dev/null 2>&1 || : 137 /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : 138 /bin/systemctl stop %{name}@\*.service > /dev/null 2>&1 || : 139%else 140 /sbin/service %{name} stop > /dev/null 2>&1 || : 141 /sbin/chkconfig --del %{name} 142%endif 143fi 144 145exit 0 146 147 148%postun 149%if %{with_systemd} 150 /bin/systemctl daemon-reload >/dev/null 2>&1 || : 151%endif 152 153# Don't auto-restart memcached on upgrade -- let user control when cache flushes 154# if [ "$1" -ge 1 ]; then 155# # upgrade, not install 156# %if %{with_systemd} 157# /bin/systemctl try-restart %{name}.service 158# /bin/systemctl try-restart %{name}@\*.service 159# %else 160# /sbin/service %named condrestart 2>/dev/null || : 161# %endif 162#fi 163 164exit 0 165 166 167%files 168%defattr(-,root,root,-) 169%doc AUTHORS ChangeLog COPYING NEWS README.md doc/CONTRIBUTORS doc/*.txt 170%config(noreplace) %{_sysconfdir}/sysconfig/%{name} 171 172%dir %attr(750,nobody,nobody) %{_localstatedir}/run/%{name} 173%{_bindir}/%{name}-tool 174%{_bindir}/%{name} 175%{_mandir}/man1/%{name}.1* 176%{_includedir}/%{name} 177 178%if %{with_systemd} 179%{_unitdir}/%{name}.service 180%{_unitdir}/%{name}@.service 181%else 182%{_initrddir}/%{name} 183%endif 184 185%changelog 186* Wed Jul 5 2017 J. Grizzard <[email protected]> - 1.4.39 187- Add systemd-aware build 188- Add both static and instanced versions of memcached unit files 189 190* Mon Nov 2 2009 Dormando <[email protected]> - 1.4.3-1 191- Fix autogen more. 192 193* Sat Aug 29 2009 Dustin Sallings <[email protected]> - 1.4.1-1 194- Autogenerate the version number from tags. 195 196* Wed Jul 4 2007 Paul Lindner <[email protected]> - 1.2.2-5 197- Use /var/run/memcached/ directory to hold PID file 198 199* Sat May 12 2007 Paul Lindner <[email protected]> - 1.2.2-4 200- Remove tabs from spec file, rpmlint reports no more errors 201 202* Thu May 10 2007 Paul Lindner <[email protected]> - 1.2.2-3 203- Enable build-time regression tests 204- add dependency on initscripts 205- remove memcached-debug (not needed in dist) 206- above suggestions from Bernard Johnson 207 208* Mon May 7 2007 Paul Lindner <[email protected]> - 1.2.2-2 209- Tidiness improvements suggested by Ruben Kerkhof in bugzilla #238994 210 211* Fri May 4 2007 Paul Lindner <[email protected]> - 1.2.2-1 212- Initial spec file created via rpmdev-newspec 213