2013-10-15 10:42:00 +02:00
|
|
|
#
|
|
|
|
# spec file for package haproxy
|
|
|
|
#
|
2014-05-06 17:38:15 +02:00
|
|
|
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
2013-10-15 10:42:00 +02:00
|
|
|
#
|
|
|
|
# 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/
|
2014-06-25 15:24:23 +02:00
|
|
|
%if 0%{?suse_version} >= 1230
|
|
|
|
%bcond_without tcp_fast_open
|
2018-09-20 14:51:25 +02:00
|
|
|
%bcond_without network_namespace
|
2014-06-25 15:24:23 +02:00
|
|
|
%else
|
|
|
|
%bcond_with tcp_fast_open
|
2018-09-20 14:51:25 +02:00
|
|
|
%bcond_with network_namespace
|
2014-06-25 15:24:23 +02:00
|
|
|
%endif
|
2013-12-18 16:53:39 +01:00
|
|
|
|
2015-10-15 11:38:17 +02:00
|
|
|
%if 0%{?suse_version} > 1320
|
|
|
|
%bcond_without lua
|
|
|
|
%else
|
2017-11-27 16:03:06 +01:00
|
|
|
%bcond_with lua
|
2015-10-15 11:38:17 +02:00
|
|
|
%endif
|
|
|
|
|
2014-06-25 15:24:23 +02:00
|
|
|
%if 0%{?suse_version} >= 1310
|
|
|
|
%bcond_without systemd
|
|
|
|
%else
|
|
|
|
%bcond_with systemd
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if 0%{?suse_version} > 1140
|
|
|
|
%bcond_without pcre_jit
|
|
|
|
%else
|
|
|
|
%bcond_with pcre_jit
|
|
|
|
%endif
|
2018-09-20 14:51:25 +02:00
|
|
|
|
2014-06-25 15:24:23 +02:00
|
|
|
%bcond_without apparmor
|
2018-09-20 14:51:25 +02:00
|
|
|
%if 0%{?suse_version} > 1320
|
|
|
|
%bcond_without apparmor_reload
|
|
|
|
%else
|
|
|
|
%bcond_with apparmor_reload
|
|
|
|
%endif
|
2013-10-15 10:42:00 +02:00
|
|
|
|
|
|
|
Name: haproxy
|
2019-05-06 13:18:23 +02:00
|
|
|
Version: 1.8.20~git0.6fb9fadc
|
2013-10-15 10:42:00 +02:00
|
|
|
Release: 0
|
|
|
|
#
|
|
|
|
#
|
2013-12-18 16:53:39 +01:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2015-11-21 02:15:34 +01:00
|
|
|
%if %{with apparmor}
|
2018-08-22 05:07:29 +02:00
|
|
|
%if 0%{?suse_version} <= 1315
|
2015-11-21 02:15:34 +01:00
|
|
|
BuildRequires: apparmor-profiles
|
2018-02-08 14:29:47 +01:00
|
|
|
Requires: apparmor-profiles
|
2018-08-22 05:07:29 +02:00
|
|
|
%else
|
|
|
|
BuildRequires: apparmor-abstractions
|
|
|
|
Requires: apparmor-abstractions
|
|
|
|
%endif
|
2018-09-20 14:51:25 +02:00
|
|
|
%if %{with apparmor_reload}
|
2017-11-27 16:03:06 +01:00
|
|
|
BuildRequires: apparmor-rpm-macros
|
|
|
|
%endif
|
2015-11-21 02:15:34 +01:00
|
|
|
%endif
|
2013-10-29 09:25:21 +01:00
|
|
|
BuildRequires: libgcrypt-devel
|
2015-10-15 11:38:17 +02:00
|
|
|
%if %{with lua}
|
|
|
|
BuildRequires: lua-devel >= 5.3
|
|
|
|
%endif
|
2013-12-18 16:53:39 +01:00
|
|
|
BuildRequires: pcre-devel
|
2014-06-25 15:24:23 +02:00
|
|
|
BuildRequires: zlib-devel
|
|
|
|
BuildRequires: openssl-devel
|
|
|
|
BuildRequires: pkg-config
|
2013-10-15 10:42:00 +02:00
|
|
|
BuildRequires: udev
|
2014-06-25 15:24:23 +02:00
|
|
|
%if %{with systemd}
|
|
|
|
BuildRequires: pkgconfig(systemd)
|
2017-11-27 16:03:06 +01:00
|
|
|
BuildRequires: pkgconfig(libsystemd)
|
2014-06-25 15:24:23 +02:00
|
|
|
%endif
|
|
|
|
BuildRequires: vim
|
2013-10-15 10:42:00 +02:00
|
|
|
%define pkg_name haproxy
|
|
|
|
%define pkg_home /var/lib/%{pkg_name}
|
|
|
|
#
|
2014-07-21 21:40:10 +02:00
|
|
|
Url: http://www.haproxy.org/
|
2018-02-08 14:29:47 +01:00
|
|
|
# source URL in _service file
|
|
|
|
Source: haproxy-%{version}.tar.gz
|
2013-12-18 16:53:39 +01:00
|
|
|
Source1: %{pkg_name}.init
|
2015-10-15 11:38:17 +02:00
|
|
|
Source2: usr.sbin.haproxy.apparmor
|
|
|
|
Source3: local.usr.sbin.haproxy.apparmor
|
|
|
|
Source4: haproxy.cfg
|
|
|
|
Patch1: haproxy-1.6.0_config_haproxy_user.patch
|
|
|
|
Patch2: haproxy-1.6.0-makefile_lib.patch
|
|
|
|
Patch3: haproxy-1.6.0-sec-options.patch
|
2015-01-08 23:02:32 +01:00
|
|
|
#
|
2013-10-15 10:42:00 +02:00
|
|
|
Source99: haproxy-rpmlintrc
|
|
|
|
#
|
|
|
|
Summary: The Reliable, High Performance TCP/HTTP Load Balancer
|
2017-11-28 14:55:11 +01:00
|
|
|
License: GPL-3.0+ and LGPL-2.1+
|
2013-12-18 16:53:39 +01:00
|
|
|
Group: Productivity/Networking/Web/Proxy
|
2013-10-15 10:42:00 +02:00
|
|
|
Provides: %{name}-doc = %{version}
|
|
|
|
Obsoletes: %{name}-doc < %{version}
|
2014-06-25 15:24:23 +02:00
|
|
|
Provides: haproxy-1.5 = %{version}
|
|
|
|
Obsoletes: haproxy-1.5 < %{version}
|
|
|
|
# this requires is not strictly needed. we only need it for the ownership of the vim data dir
|
|
|
|
Requires: vim
|
|
|
|
%if %{with systemd}
|
2013-10-29 09:25:21 +01:00
|
|
|
%{?systemd_requires}
|
2013-12-18 16:53:39 +01:00
|
|
|
%endif
|
2014-06-25 15:24:23 +02:00
|
|
|
%{!?vim_data_dir:%global vim_data_dir /usr/share/vim/%(readlink /usr/share/vim/current)}
|
2013-10-15 10:42:00 +02:00
|
|
|
|
|
|
|
%description
|
|
|
|
HAProxy implements an event-driven, mono-process model which enables support
|
|
|
|
for very high number of simultaneous connections at very high speeds.
|
|
|
|
Multi-process or multi-threaded models can rarely cope with thousands of
|
|
|
|
connections because of memory limits, system scheduler limits, and lock
|
|
|
|
contention everywhere. Event-driven models do not have these problems because
|
|
|
|
implementing all the tasks in user-space allows a finer resource and time
|
|
|
|
management. The down side is that those programs generally don't scale well on
|
|
|
|
multi-processor systems. That's the reason why they must be optimized to get
|
|
|
|
the most work done from every CPU cycle.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q
|
2015-10-15 11:38:17 +02:00
|
|
|
%patch1 -p1
|
2014-06-25 15:24:23 +02:00
|
|
|
%patch2
|
|
|
|
%patch3
|
2013-10-15 10:42:00 +02:00
|
|
|
|
|
|
|
%build
|
2018-03-07 06:58:33 +01:00
|
|
|
make \
|
2017-11-27 16:03:06 +01:00
|
|
|
TARGET=linux2628 \
|
2013-10-15 10:42:00 +02:00
|
|
|
CPU="%{_target_cpu}" \
|
|
|
|
USE_PCRE=1 \
|
2014-06-25 15:24:23 +02:00
|
|
|
%if %{with pcre_jit}
|
|
|
|
USE_PCRE_JIT=1 \
|
|
|
|
%endif
|
2017-11-27 16:03:06 +01:00
|
|
|
USE_PTHREAD_PSHARED=1 \
|
2014-06-25 15:24:23 +02:00
|
|
|
%ifarch %ix86
|
|
|
|
USE_REGPARM=1 \
|
|
|
|
%endif
|
2017-11-27 16:03:06 +01:00
|
|
|
USE_GETADDRINFO=1 \
|
|
|
|
USE_OPENSSL=1 \
|
2015-10-15 11:38:17 +02:00
|
|
|
%if %{with lua}
|
|
|
|
USE_LUA=1 \
|
|
|
|
%endif
|
2017-11-27 16:03:06 +01:00
|
|
|
USE_ZLIB=1 \
|
2015-10-15 11:38:17 +02:00
|
|
|
%if %{with tcp_fast_open}
|
2014-06-25 15:24:23 +02:00
|
|
|
USE_TFO=1 \
|
2015-10-15 11:38:17 +02:00
|
|
|
%endif
|
2015-10-16 01:25:07 +02:00
|
|
|
%if %{with network_namespace}
|
2015-10-15 11:38:17 +02:00
|
|
|
USE_NS=1 \
|
2015-10-16 01:25:07 +02:00
|
|
|
%endif
|
2018-09-20 14:51:25 +02:00
|
|
|
%if %{with systemd}
|
2017-11-27 16:03:06 +01:00
|
|
|
USE_SYSTEMD=1 \
|
2018-09-20 14:51:25 +02:00
|
|
|
%endif
|
2017-11-27 16:03:06 +01:00
|
|
|
USE_PIE=1 \
|
|
|
|
USE_STACKPROTECTOR=1 \
|
|
|
|
USE_RELRO_NOW=1 \
|
2013-10-15 10:42:00 +02:00
|
|
|
LIB="%{_lib}" \
|
2014-06-25 15:24:23 +02:00
|
|
|
PREFIX="%{_prefix}" \
|
|
|
|
DEBUG_CFLAGS="%{optflags}"
|
2018-09-20 14:51:25 +02:00
|
|
|
%if %{with systemd}
|
2014-06-25 15:24:23 +02:00
|
|
|
make -C contrib/systemd PREFIX="%{_prefix}"
|
2018-09-20 14:51:25 +02:00
|
|
|
%endif
|
2014-06-25 15:24:23 +02:00
|
|
|
make -C contrib/halog PREFIX="%{_prefix}" \
|
|
|
|
DEFINE="%{optflags} -pie -fpie -fstack-protector -Wl,-z,relro,-z,now"
|
2013-12-18 16:53:39 +01:00
|
|
|
|
2013-10-15 10:42:00 +02:00
|
|
|
%install
|
2015-10-15 11:38:17 +02:00
|
|
|
install -D -m 0755 %{pkg_name} %{buildroot}%{_sbindir}/%{pkg_name}
|
|
|
|
install -d -m 0750 %{buildroot}%{_sysconfdir}/%{pkg_name}/
|
|
|
|
install -m 0640 %{S:4} %{buildroot}%{_sysconfdir}/%{pkg_name}/%{pkg_name}.cfg
|
|
|
|
|
|
|
|
install -D -m 0755 contrib/halog/halog %{buildroot}%{_sbindir}/haproxy-halog
|
2013-12-18 16:53:39 +01:00
|
|
|
|
2014-06-25 15:24:23 +02:00
|
|
|
%if %{with systemd}
|
2015-10-15 11:38:17 +02:00
|
|
|
install -D -m 0644 contrib/systemd/%{pkg_name}.service %{buildroot}%{_unitdir}/%{pkg_name}.service
|
2013-10-29 09:25:21 +01:00
|
|
|
ln -sf /sbin/service %{buildroot}%{_sbindir}/rc%{pkg_name}
|
2013-12-18 16:53:39 +01:00
|
|
|
%else
|
2015-10-15 11:38:17 +02:00
|
|
|
install -D -m 0755 %{S:1} %{buildroot}%{_sysconfdir}/init.d/%{pkg_name}
|
2018-03-07 06:58:33 +01:00
|
|
|
ln -fs %{_sysconfdir}/init.d/%{pkg_name} %{buildroot}%{_sbindir}/rc%{pkg_name}
|
2013-12-18 16:53:39 +01:00
|
|
|
%endif
|
|
|
|
|
2018-03-04 08:09:23 +01:00
|
|
|
install -d -m 0750 %{buildroot}%{pkg_home}
|
2015-10-15 11:38:17 +02:00
|
|
|
install -D -m 0644 examples/haproxy.vim %{buildroot}%{vim_data_dir}/syntax/%{pkg_name}.vim
|
|
|
|
install -D -m 0644 doc/%{pkg_name}.1 %{buildroot}%{_mandir}/man1/%{pkg_name}.1
|
2014-06-25 15:24:23 +02:00
|
|
|
%if %{with apparmor}
|
2015-10-15 11:38:17 +02:00
|
|
|
install -D -m 0644 %{S:2} %{buildroot}/etc/apparmor.d/usr.sbin.haproxy
|
|
|
|
install -D -m 0644 %{S:3} %{buildroot}/etc/apparmor.d/local/usr.sbin.haproxy
|
2014-06-25 15:24:23 +02:00
|
|
|
%endif
|
|
|
|
|
2015-10-15 11:38:17 +02:00
|
|
|
rm examples/haproxy.spec examples/*init* examples/haproxy.vim
|
2013-10-15 10:42:00 +02:00
|
|
|
|
|
|
|
%pre
|
2018-03-07 06:58:33 +01:00
|
|
|
getent group %{pkg_name} >/dev/null || /usr/sbin/groupadd -r %{pkg_name}
|
|
|
|
getent passwd %{pkg_name} >/dev/null || \
|
|
|
|
/usr/sbin/useradd -g %{pkg_name} -s /bin/false -r \
|
|
|
|
-c "user for %{pkg_name}" -d %{pkg_home} %{pkg_name}
|
2013-10-15 10:42:00 +02:00
|
|
|
|
2014-06-25 15:24:23 +02:00
|
|
|
%if %{with systemd}
|
|
|
|
%service_add_pre %{pkg_name}.service
|
2013-12-18 16:53:39 +01:00
|
|
|
|
2013-10-15 10:42:00 +02:00
|
|
|
%post
|
2018-09-20 15:06:28 +02:00
|
|
|
%if %{with apparmor} && %{with apparmor_reload}
|
2017-11-27 16:03:06 +01:00
|
|
|
%apparmor_reload /etc/apparmor.d/usr.sbin.haproxy
|
|
|
|
%endif
|
2013-10-29 09:25:21 +01:00
|
|
|
%service_add_post %{pkg_name}.service
|
2013-10-15 10:42:00 +02:00
|
|
|
|
|
|
|
%preun
|
2013-10-29 09:25:21 +01:00
|
|
|
%service_del_preun %{pkg_name}.service
|
2013-10-15 10:42:00 +02:00
|
|
|
|
|
|
|
%postun
|
2013-10-29 09:25:21 +01:00
|
|
|
%service_del_postun %{pkg_name}.service
|
2013-10-15 10:42:00 +02:00
|
|
|
|
2013-12-18 16:53:39 +01:00
|
|
|
%else
|
|
|
|
|
|
|
|
%post
|
|
|
|
%fillup_and_insserv %{pkg_name}
|
2018-09-20 14:51:25 +02:00
|
|
|
%if %{with apparmor} && %{with apparmor_reload}
|
2017-11-27 16:03:06 +01:00
|
|
|
%apparmor_reload /etc/apparmor.d/usr.sbin.haproxy
|
|
|
|
%endif
|
2013-12-18 16:53:39 +01:00
|
|
|
|
|
|
|
%preun
|
|
|
|
%stop_on_removal %{pkg_name}
|
|
|
|
|
|
|
|
%postun
|
|
|
|
%restart_on_update %{pkg_name}
|
|
|
|
%{insserv_cleanup}
|
|
|
|
|
|
|
|
%endif
|
|
|
|
|
2013-10-15 10:42:00 +02:00
|
|
|
%files
|
|
|
|
%defattr(-,root,root,-)
|
|
|
|
%doc CHANGELOG README LICENSE
|
2014-06-25 15:24:23 +02:00
|
|
|
%doc ROADMAP doc/* examples/
|
|
|
|
%doc contrib/netsnmp-perl/ contrib/selinux/
|
2015-10-15 11:38:17 +02:00
|
|
|
%dir %attr(-,root,haproxy) %{_sysconfdir}/%{pkg_name}
|
|
|
|
%config(noreplace) %attr(-,root,haproxy) %{_sysconfdir}/%{pkg_name}/*
|
2014-06-25 15:24:23 +02:00
|
|
|
%if %{with systemd}
|
2013-10-29 09:25:21 +01:00
|
|
|
%{_unitdir}/%{pkg_name}.service
|
2013-12-18 16:53:39 +01:00
|
|
|
%else
|
|
|
|
%config(noreplace) %{_sysconfdir}/init.d/%{pkg_name}
|
|
|
|
%endif
|
2013-10-15 10:42:00 +02:00
|
|
|
%{_sbindir}/haproxy
|
2014-06-25 15:24:23 +02:00
|
|
|
%{_sbindir}/haproxy-halog
|
2013-10-15 10:42:00 +02:00
|
|
|
%{_sbindir}/rchaproxy
|
2018-03-08 20:19:41 +01:00
|
|
|
%dir %attr(-,root,haproxy) %{pkg_home}
|
2014-06-25 15:24:23 +02:00
|
|
|
%{_mandir}/man1/%{pkg_name}.1.gz
|
|
|
|
%{vim_data_dir}/syntax/%{pkg_name}.vim
|
|
|
|
%if %{with apparmor}
|
2015-11-21 02:36:28 +01:00
|
|
|
%if 0%{?suse_version} == 1110
|
|
|
|
%dir /etc/apparmor.d/local/
|
|
|
|
%endif
|
2014-06-25 15:24:23 +02:00
|
|
|
%config(noreplace) /etc/apparmor.d/usr.sbin.haproxy
|
|
|
|
%config(noreplace) /etc/apparmor.d/local/usr.sbin.haproxy
|
|
|
|
%endif
|
2013-10-15 10:42:00 +02:00
|
|
|
|
|
|
|
%changelog
|