File dba-haproxy-322.spec of Package dba-haproxy-322
%define real_name haproxy
%define version 3.2.2
%define vers 322
%define prefix /DBA/%{real_name}/%{version}
%define with_dbassl 1
%define with_lua 1
%define with_pcre2 1
Name: dba-%{real_name}-%{vers}
Summary: HAProxy reverse proxy for high availability environments version 3.2.2
Vendor: openSUSE Build Service
Version: %{version}
Release: 1
Group: System Environment/Daemons
License: GPL-2.0-or-later
URL: http://www.haproxy.org/
Source0: http://www.haproxy.org/download/2.4/src/haproxy-%{version}.tar.gz
Source1: %{real_name}.service
Source2: %{real_name}.cfg
Source3: %{real_name}.logrotate
Source4: %{real_name}.sysconfig
Source5: halog.1
Source6: set_haproxy_3.2.latest.sh
Source7: http://www.haproxy.org/download/2.4/src/haproxy-%{version}.tar.gz.md5
BuildRoot: %{_tmppath}/%{real_name}-%{version}-build
#!BuildIgnore: dba-openssl-098o dba-openssl-098r dba-openssl-098x dba-openssl-101c dba-openssl-102g-static
#!BuildIgnore: nspr dba-geoip-148 dba-geoip-160 dba-git-2191
# BuildRequires: lua-devel
BuildRequires: zlib-devel
%if %{with_lua}
%if 0%{?centos_version} >= 1000
BuildRequires: lua-devel
%else
BuildRequires: dba-lua-546-static
%define luadir /DBA/lua/5.4.6
%endif
%endif
%if %{with_dbassl}
#!BuildIgnore: openssl-devel
BuildRequires: dba-openssl-3016-static
%define ssldir /DBA/openssl/3.0.16
%else
BuildRequires: openssl-devel
%endif
%if %{with_pcre2}
%if 0%{?centos_version} >= 1000
BuildRequires: pcre2-devel
%else
BuildRequires: dba-pcre2-1042-static
%define pcrepath /DBA/pcre2/10.42
%endif
%endif
%if 0%{?suse_version} >= 1100
BuildRequires: -post-build-checks
%endif
Requires: socat
%description
HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high
availability environments. Indeed, it can:
- route HTTP requests depending on statically assigned cookies
- spread load among several servers while assuring server persistence
through the use of HTTP cookies
- switch to backup servers in the event a main one fails
- accept connections to special ports dedicated to service monitoring
- stop accepting connections without breaking existing ones
- add, modify, and delete HTTP headers in both directions
- block requests matching particular patterns
- report detailed status to authenticated users from a URI
intercepted from the application
%prep
md5sum %{SOURCE0} | awk '{print $1;}' | cmp - %{SOURCE7}
%setup -q -n %{real_name}-%{version}
#%patch0 -p0
%build
regparm_opts=
%ifarch %ix86 x86_64
regparm_opts="USE_REGPARM=1"
%endif
%if %{with_pcre2}
%if 0%{?centos_version} >= 1000
%else
export ADDINC="$ADDINC -I%{pcrepath}/include"
export ADDLIB="$ADDLIB -L%{pcrepath}/lib"
export PCRECONFIG=%{pcrepath}/bin/pcre2-config
%endif
%endif
%if %{with_lua}
%if 0%{?centos_version} >= 1000
%else
export LUA_LIB_NAME=lua
export LUA_LIB=%{luadir}/lib
export LUA_INC=%{luadir}/include
export ADDINC="$ADDINC -I%{luadir}/include"
export ADDLIB="$ADDLIB -L%{luadir}/lib -llua"
%endif
%endif
%if %{with_dbassl}
export ADDINC="$ADDINC -I%{ssldir}/include"
export ADDLIB="$ADDLIB -L%{ssldir}/lib64 -pthread"
%endif
%if 0%{?sles_version} == 11
export ADDINC="$ADDINC -DLUA_C89_NUMBERS -ldl"
%endif
addmake=
%if 0%{?rhel_version} <= 600 || 0%{?centos_version} <= 600 || 0%{?suse_version} <= 1100 || 0%{?sles_version} <= 1100
addmake="USE_NS= "
%endif
%if 0%{?sles_version} <=1200
addmake+=" USE_PTHREAD_PSHARED=1"
%endif
# CFLAGS="$RPM_OPT_FLAGS"
%if 0%{?centos_version} >= 1000
%{__make} %{?_smp_mflags} TARGET="linux-glibc" USE_OPENSSL=1 ADDINC="$ADDINC" ADDLIB="$ADDLIB" USE_PCRE2=1 USE_PCRE2_JIT=1 USE_ZLIB=1 USE_LUA=%{with_lua} ${regparm_opts} ${addmake}
%else
%{__make} %{?_smp_mflags} TARGET="linux-glibc" USE_OPENSSL=1 ADDINC="$ADDINC" ADDLIB="$ADDLIB" USE_STATIC_PCRE2=1 USE_PCRE2_JIT=1 USE_ZLIB=1 USE_LUA=%{with_lua} ${regparm_opts} ${addmake}
%endif
#pushd admin/halog/
%{__make} admin/halog/halog OPTIMIZE="%{optflags}"
#popd
pushd admin/iprange/
%{__make} iprange OPTIMIZE="%{optflags}"
popd
%install
%{__make} install-bin DESTDIR=%{buildroot} PREFIX=%{prefix} TARGET="linux-glibc"
%{__make} install-man DESTDIR=%{buildroot} PREFIX=%{prefix}
%{__mkdir_p} %{buildroot}%{prefix}/bin
%{__mkdir_p} %{buildroot}%{prefix}/conf
%{__mkdir_p} %{buildroot}%{prefix}/data
%{__mkdir_p} %{buildroot}%{prefix}/init
# # %{__mkdir_p} %{buildroot}%{prefix}/man/man1
%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{prefix}/init/%{real_name}.service
%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{prefix}/conf/%{real_name}.cfg
%{__install} -p -D -m 0644 %{SOURCE3} %{buildroot}%{prefix}/init/%{real_name}.log
%{__install} -p -D -m 0644 %{SOURCE4} %{buildroot}%{prefix}/init/%{real_name}.syscfg
# # %{__install} -p -D -m 0644 %{SOURCE5} %{buildroot}%{prefix}/man1/halog.1
%{__install} -p -m 0755 ./admin/halog/halog %{buildroot}%{prefix}/bin/halog
%{__install} -p -m 0755 ./admin/iprange/iprange %{buildroot}%{prefix}/bin/iprange
%{__install} -p -m 0644 ./examples/errorfiles/* %{buildroot}%{prefix}/data
for httpfile in $(find ./examples/errorfiles/ -type f)
do
%{__install} -p -m 0644 $httpfile %{buildroot}%{prefix}/data/
done
%{__rm} -rf ./examples/errorfiles/
find ./examples/* -type f ! -name "*.cfg" -exec %{__rm} -f "{}" \;
for textfile in $(find ./ -type f -name '*.txt')
do
%{__mv} $textfile $textfile.old
iconv --from-code ISO8859-1 --to-code UTF-8 --output $textfile $textfile.old
%{__rm} -f $textfile.old
done
%{__install} -m 0755 %{SOURCE6} %{buildroot}%{prefix}/bin/set_haproxy_3.2.latest.sh
%post
cd %{prefix}/..
%{prefix}/bin/set_haproxy_3.2.latest.sh
%files
%defattr(-,root,root)
%dir %{prefix}
%{prefix}/*
%changelog
* Fri Jul 04 2025 Dennis Hampe <dennis.hampe@bertelsmann.de>
- inital version