varnish/varnish.spec

216 lines
6.8 KiB
RPMSpec
Raw Normal View History

#
# spec file for package varnish
#
# Copyright (c) 2009 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/
#
Name: varnish
%define library_name libvarnishapi1
Version: 3.0.3
Release: 0
Summary: Varnish is a high-performance HTTP accelerator
License: BSD-2-Clause
Group: Productivity/Networking/Web/Proxy
URL: http://varnish-cache.org/
#DL-URL: http://downloads.sf.net/varnish/%name-%version.tar.bz2
Source0: http://repo.varnish-cache.org/source/%{name}-%{version}.tar.gz
Source2: varnish.init
Source3: varnish.sysconfig
Source4: vcl.conf
Source5: varnish.logrotate
Source6: varnishlog.init
Source7: varnish.service
Source8: varnishlog.service
BuildRoot: %_tmppath/%name-%version-build
BuildRequires: libxslt, ncurses-devel, pcre-devel
BuildRequires: pkgconfig, xz
Prereq(post): %_sbindir/useradd %_sbindir/groupadd
%if 0%{?suse_version} >= 1010
Recommends: logrotate
%endif
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%endif
%define pkg_home %_localstatedir/lib/%name
%define pkg_logdir %_localstatedir/log/%name
%define pkg_cachedir %_localstatedir/cache/%name
Requires: c_compiler
%description
Varnish is an HTTP accelerator. An HTTP accelerator (often called Reverse
Proxy) is an application that stores (caches) documents that have been
requested over the HTTP protocol.
Based on certain criteria the next client requesting the document is either
given the cached document, or a "fresh" document requested from a backend
server. The purpose of this is to minimize the requests going to the backend
server(s) by serving the same document to potentially many users.
%package -n %library_name
Group: Productivity/Networking/Web/Proxy
Summary: Shared libraries for Varnish
%description -n %library_name
Varnish is an HTTP accelerator. An HTTP accelerator (often called Reverse
Proxy) is an application that stores (caches) documents that have been
requested over the HTTP protocol.
Based on certain criteria the next client requesting the document is either
given the cached document, or a "fresh" document requested from a backend
server. The purpose of this is to minimize the requests going to the backend
server(s) by serving the same document to potentially many users.
This package holds the shared libraries for varnish.
%package devel
Group: Development/Libraries/C and C++
Requires: %name = %version
Summary: Development files for Varnish
%description devel
Varnish is an HTTP accelerator. An HTTP accelerator (often called Reverse
Proxy) is an application that stores (caches) documents that have been
requested over the HTTP protocol.
Based on certain criteria the next client requesting the document is either
given the cached document, or a "fresh" document requested from a backend
server. The purpose of this is to minimize the requests going to the backend
server(s) by serving the same document to potentially many users.
This package holds the development files for varnish.
%prep
%setup -q
%build
%if 0%{?suse_version} > 1000
export CFLAGS="%optflags -fstack-protector"
%endif
%configure --disable-static \
--localstatedir=%_localstatedir/cache/ \
--enable-developer-warnings
make %{?_smp_mflags}
%install
b="%buildroot";
%makeinstall
# There is no use for them to normal users
mv "$b/%_bindir"/* "$b/%_sbindir/";
#
##missing directories
install -dm 0755 "$b"/{%pkg_logdir,%pkg_home};
install -Dpm 0644 "%{S:5}" "$b/%_sysconfdir/logrotate.d/varnish";
#
##init scripts
install -Dpm 0644 "%{S:3}" "$b/var/adm/fillup-templates/sysconfig.%name";
install -Dpm 0755 "%{S:2}" "$b/%_initddir/varnish";
install -Dpm 0755 "%{S:6}" "$b/%_initddir/varnishlog";
%if 0%{?_unitdir:1}
install -Dpm 0644 "%{S:7}" "$b/%_unitdir/varnish.service";
install -Dpm 0644 "%{S:8}" "$b/%_unitdir/varnishlog.service";
%endif
mkdir -p "$b/%_sbindir";
ln -s "%_initddir/varnish" "$b/%_sbindir/rcvarnish";
ln -s "%_initddir/varnishlog" "$b/%_sbindir/rcvarnishlog";
#
##config files
install -Dpm 0644 %{S:4} "$b/%_sysconfdir/%name/vcl.conf";
install -Dpm 0644 %{S:4} "$b/%_sysconfdir/%name/vcl.conf.example";
find "$b" -type f -name "*.la" -delete
mkdir -p "$b/%pkg_logdir"
%pre
%_bindir/getent group varnish >/dev/null || \
%_sbindir/groupadd -r varnish || :
%_bindir/getent passwd varnish >/dev/null || \
%_sbindir/useradd -g varnish -s /bin/false -r -c "user for Varnish" \
-d %pkg_home varnish || :
%if 0%{?_unitdir:1}
%service_add_pre varnish.service
%service_add_pre varnishlog.service
%endif
%post
%fillup_and_insserv varnish
%fillup_and_insserv varnishlog
%if 0%{?_unitdir:1}
%service_add_post varnish.service
%service_add_post varnishlog.service
%endif
%preun
%stop_on_removal varnish
%stop_on_removal varnishlog
%if 0%{?_unitdir:1}
%service_del_preun varnish.service
%service_del_preun varnishlog.service
%endif
%postun
# Does not sysv+systemd very much conflict? But rpmlint wants to have it...
%restart_on_update varnish
%restart_on_update varnishlog
%if 0%{?_unitdir:1}
%service_del_postun varnish.service
%service_del_postun varnishlog.service
%endif
%insserv_cleanup
%post -n %library_name -p /sbin/ldconfig
%postun -n %library_name -p /sbin/ldconfig
%files
%defattr(-,root,root)
%_initddir/varnish
%_initddir/varnishlog
%if 0%{?_unitdir:1}
%_unitdir
%endif
%config(noreplace) %_sysconfdir/logrotate.d/varnish
%dir %attr(0750,root,varnish) %_sysconfdir/%name/
%config(noreplace) %attr(0640,root,varnish) %_sysconfdir/%name/vcl.conf
%config %attr(0640,root,varnish) %_sysconfdir/%name/vcl.conf.example
%config(noreplace) %attr(0640,root,varnish) %_sysconfdir/%name/default.vcl
%_libdir/varnish
%_sbindir/varnish*
%_sbindir/rcvarnish*
%_mandir/man*/*
%doc ChangeLog LICENSE README
%dir %attr(0750,varnish,varnish) %pkg_home
%dir %attr(0750,varnish,varnish) %pkg_cachedir
%dir %attr(0750,varnish,varnish) %pkg_logdir
%if 0%{?suse_version}
%_localstatedir/adm/fillup-templates/sysconfig.%name
%else
%config(noreplace) %_sysconfdir/sysconfig/%name
%doc redhat/README.redhat
%endif
%files -n %library_name
%defattr(-,root,root,-)
%_libdir/libvarnishapi.so.1*
%files devel
%defattr(-,root,root,-)
%_includedir/varnish
%_libdir/pkgconfig/*
%_libdir/libvarnishapi.so
%changelog