%define version %(echo ${PROJECT_VERSION:=1.7.7}) %define projectmain %(echo ${PROJECT_MAIN:=1.7}) %define release %(echo ${RELEASE:=2_prozorro}) %define target %(echo ${TARGET:=linux2628}) %define haproxy_user haproxy %define haproxy_uid 188 %define haproxy_group haproxy %define haproxy_gid 188 %define haproxy_home %{_localstatedir}/lib/haproxy %define haproxy_confdir %{_sysconfdir}/haproxy %define haproxy_datadir %{_datadir}/haproxy Name: haproxy Summary: HA-Proxy is a TCP/HTTP reverse proxy for high availability environments Version: %{version} Release: %{release}%{?dist} License: GPLv2+ URL: http://www.haproxy.org/ Group: System Environment/Daemons Source0: http://www.haproxy.org/download/%{projectmain}/src/haproxy-%{version}.tar.gz Source1: haproxy.init Source2: haproxy.cfg Source3: haproxy.logrotate Source4: haproxy.rsyslog Requires(pre): %{_sbindir}/groupadd Requires(pre): %{_sbindir}/useradd %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?amzn} >= 1 BuildRequires: systemd-units Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %else Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Requires(preun): /sbin/service Requires(postun): /sbin/service %endif BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: pcre-devel pcre-static lua53 lua53-devel zlib-devel BuildRequires: openssl-devel >= 1.0.2 BuildRequires: setup >= 2.5 Requires: pcre pcre-static openssl lua53 zlib %description HAProxy is a free, fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing. Supporting tens of thousands of connections is clearly realistic with modern hardware. Its mode of operation makes integration with existing architectures very easy and riskless, while still offering the possibility not to expose fragile web servers to the net. %prep %setup -q -n %{name}-%{version} # We don't want any perl dependecies in this RPM: %define __perl_requires /bin/true %build %ifarch %ix86 x86_64 use_regparm="USE_REGPARM=1" %endif %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?amzn} >= 1 use_tfo="USE_TFO=1" use_ns="USE_NS=1" %endif make %{?_smp_mflags} CPU="generic" TARGET="%{target}" USE_ZLIB=1 USE_OPENSSL=1 USE_PCRE=1 USE_LUA=1 LUA_LIB=/opt/lua-5.3/lib64 \ LUA_INC=/opt/lua-5.3/include USE_STATIC_PCRE=1 ${use_tfo} USE_PRIVATE_CACHE=1 ${use_regparm} ${use_ns} pushd contrib/halog make halog popd %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?amzn} >= 1 pushd contrib/systemd make haproxy.service SBINDIR=%{_sbindir} %if 0%{?fedora} >= 22 %else %{__sed} -i 's/KillMode=mixed/KillMode=control-group/' haproxy.service %endif popd %endif %install [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} make install-bin DESTDIR=%{buildroot} PREFIX=%{_prefix} make install-man DESTDIR=%{buildroot} PREFIX=%{_prefix} %{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name} %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{haproxy_confdir}/%{name}.cfg %{__install} -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} %{__install} -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/rsyslog.d/%{name}.conf %{__install} -d -m 0755 %{buildroot}%{haproxy_home} %{__install} -d -m 0755 %{buildroot}%{haproxy_datadir} %{__install} -d -m 0755 %{buildroot}%{_bindir} %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?amzn} >= 1 %{__install} -p -m 0755 ./%{name}-systemd-wrapper %{buildroot}%{_sbindir}/%{name}-systemd-wrapper %{__install} -p -D -m 0644 ./contrib/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service %endif %{__install} -p -m 0755 ./contrib/halog/halog %{buildroot}%{_bindir}/halog %{__install} -p -m 0644 ./examples/errorfiles/* %{buildroot}%{haproxy_datadir} for file in $(find . -type f -name '*.txt') ; do iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \ touch -r $file $file.new && \ mv $file.new $file done %clean [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} %pre %{_sbindir}/groupadd -g %{haproxy_gid} -r %{haproxy_group} 2>/dev/null || : %{_sbindir}/useradd -u %{haproxy_uid} -g %{haproxy_group} -d %{haproxy_home} -s /sbin/nologin -r %{haproxy_user} 2>/dev/null || : %post %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?amzn} >= 1 %{systemd_post} /bin/systemctl restart rsyslog.service %else if [ "$1" -eq 1 ]; then /sbin/chkconfig --add %{name} service rsyslog restart >/dev/null 2>&1 || : fi %endif %preun %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?amzn} >= 1 %systemd_preun %{name}.service %else # $1 = if [ "$1" -eq 0 ]; then /sbin/service %{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} fi %endif %postun if [ "$1" -ge 1 ]; then /sbin/service %{name} condrestart >/dev/null 2>&1 || : fi %files %defattr(-,root,root,-) %doc CHANGELOG LICENSE README doc/* %doc examples/* %{haproxy_datadir} %dir %{haproxy_confdir} %config(noreplace) %{haproxy_confdir}/%{name}.cfg %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %config(noreplace) %{_sysconfdir}/rsyslog.d/%{name}.conf %{_initrddir}/%{name} %{_sbindir}/%{name} %{_bindir}/halog %{_mandir}/man1/%{name}.1.gz %attr(-,%{haproxy_user},%{haproxy_group}) %dir %{haproxy_home} %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?amzn} >= 1 %{_sbindir}/haproxy-systemd-wrapper %config %{_unitdir}/haproxy.service %endif %changelog * Thu Mar 16 2017 Marcus Berglof - 1.7.3-1 - Update to haproxy 1.7.3 - Compile with LUA 5.3 support * Mon Jul 11 2016 Marcus Berglof - 1.5.18-1 - Update to haproxy 1.5.18 Make the spec better for building with systemd * Thu Jan 21 2016 Marcus Berglof - 1.5.15-1 - Update to haproxy 1.5.15 * Tue Jul 21 2015 Marcus Berglof - 1.5.14-1 - Update to haproxy 1.5.14 Resolves: CVE-2015-3281 https://bugzilla.redhat.com/show_bug.cgi?id=1239072 * Tue Apr 14 2015 Marcus Berglof - 1.5.11-1 - Update to haproxy 1.5.11 * Fri Jun 20 2014 Joseph Daigle - 1.5.0 - Update to haproxy 1.5.0 * Mon May 12 2014 Jeff Palmer - 1.5dev25 - Update to haproxy 1.5-dev25 * Tue Feb 04 2014 Chris Schuld - 1.5dev22 - Update to haproxy 1.5-dev22 * Thu Aug 29 2013 Martijn Storck - 1.5dev19.2 - Compile with OpenSSL support * Wed Aug 28 2013 Martijn Storck - 1.5dev19.1 - Update to haproxy 1.5-dev19 * Tue Oct 02 2012 Ryan O'Hara - 1.4.22-3 - Use static uid/gid. Resolves: rhbz#846067 * Fri Sep 21 2012 Ryan O'Hara - 1.4.22-2 - Bump release number. Resolves: rhbz#846067 * Thu Sep 20 2012 Ryan O'Hara - 1.4.22-1 - Initial build. Resolves: rhbz#846067