/[packages]/cauldron/haproxy/current/SPECS/haproxy.spec
ViewVC logotype

Contents of /cauldron/haproxy/current/SPECS/haproxy.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1824454 - (show annotations) (download)
Thu Mar 24 02:10:52 2022 UTC (2 years, 1 month ago) by umeabot
File size: 6096 byte(s)
Mageia 9 Mass Rebuild
1 %define adminpassword %(apg -m 32 -n 1 -a 0 -M ncl)
2 %define operatorpassword %(apg -m 32 -n 1 -a 0 -M ncl)
3
4 %{?!lua_version:%global lua_version 5.4}
5
6 Summary: Reliable High Performance TCP/HTTP Load Balancer
7 Name: haproxy
8 Version: 2.4.4
9 Release: %mkrel 3
10 License: GPLv2 and LGPLv2
11 Group: System/Servers
12 URL: https://www.haproxy.org
13 Source0: https://www.haproxy.org/download/2.4/src/%{name}-%{version}.tar.gz
14 Source1: https://www.haproxy.org/download/2.4/src/%{name}-%{version}.tar.gz.sha256
15 Source2: https://www.haproxy.org/download/2.4/src/%{name}-%{version}.tar.gz.md5
16 Source3: %{name}.service
17 Source4: %{name}.tmpfiles
18 Source5: %{name}.logrotate
19 Source6: %{name}.sysconfig
20 Source7: %{name}.conf
21 Patch0: haproxy-2.4.2-rapsys-key-private.patch
22 %ifarch armv7hl aarch64
23 BuildRequires: libatomic-devel
24 %endif
25 Requires(pre): shadow-utils
26 BuildRequires: pcre2-devel
27 BuildRequires: pkgconfig(libcrypt)
28 BuildRequires: pkgconfig(lua) >= %{lua_version}
29 BuildRequires: pkgconfig(openssl)
30 BuildRequires: pkgconfig(libsystemd)
31 BuildRequires: pkgconfig(zlib)
32 BuildRequires: perl
33 BuildRequires: apg
34 Requires: lua%{lua_version}
35
36 %description
37 HAProxy is free, open source software that provides a high availability load
38 balancer and proxy server for TCP and HTTP-based applications that spreads
39 requests across multiple servers. It is written in C and has a reputation for
40 being fast and efficient.
41
42 %package utils
43 Summary: Utilities for working with HAProxy servers
44 Group: Networking/Other
45
46 %description utils
47 HAProxy-utils contains a couple of command line utilities for working with
48 haproxy servers.
49
50 You should install haproxy-utils if you need to get information from HAProxy
51 servers.
52
53 %prep
54 %setup -q -n %{name}-%{version}
55 %autopatch -p1
56
57 %build
58
59 # Build haproxy
60 %make_build \
61 CFLAGS="%{build_cflags}" \
62 LDFLAGS="%{build_ldflags}" \
63 CPU="generic" \
64 TARGET="linux-glibc" \
65 USE_LUA="1" \
66 LUA_LIB="%{lua_libdir}" \
67 LUA_INC="%{_includedir}/lua" \
68 USE_CRYPT_H="1" \
69 USE_DL="1" \
70 USE_GETADDRINFO="1" \
71 USE_LIBCRYPT="1" \
72 USE_NS="1" \
73 USE_OPENSSL="1" \
74 USE_PCRE2="1" \
75 USE_PCRE2_JIT="1" \
76 USE_PROMEX="1" \
77 USE_PTHREAD_PSHARED="1" \
78 USE_RT="1" \
79 USE_SYSTEMD="1" \
80 USE_TFO="1" \
81 USE_ZLIB="1" \
82 PREFIX=%{_prefix} \
83 MANDIR=%{_mandir} \
84 DOCDIR=%{_pkgdocdir} \
85 PCRE2_LIB=%{_libdir}
86
87 # Build utils
88 %make_build \
89 CFLAGS="%{build_cflags}" \
90 LDFLAGS="%{build_ldflags}" \
91 admin/halog/halog \
92 admin/iprange/iprange \
93 dev/tcploop/tcploop \
94 dev/poll/poll \
95 dev/flags/flags \
96 dev/hpack/{decode,gen-enc,gen-rht}
97
98 %install
99 %make_install \
100 PREFIX=%{_prefix} \
101 MANDIR=%{_mandir} \
102 DOCDIR=%{_pkgdocdir}
103
104 # Install sysconfdirs
105 install -d 0755 %{buildroot}%{_sysconfdir}
106 install -d 0755 %{buildroot}%{_sysconfdir}/%{name}
107 install -d 0755 %{buildroot}%{_sysconfdir}/sysconfig
108
109 # Install shared state dir
110 install -d 0755 %{buildroot}%{_sharedstatedir}/%{name}
111
112 # Install service
113 install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
114
115 # Install tmpfiles
116 install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf
117
118 # Install log rotation stuff
119 install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
120
121 # Install sysconfig
122 install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
123
124 # Install configuration
125 #TODO: implement https://github.com/janeczku/haproxy-acme-validation-plugin/blob/master/acme-http01-webroot.lua ?
126 install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
127
128 # Replace admin password
129 perl -pne 's/ADMINPASSWORD/%{adminpassword}/' -i %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
130
131 # Replace operator password
132 perl -pne 's/OPERATORPASSWORD/%{operatorpassword}/' -i %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
133
134 # Copy errors files
135 cp -r examples/errorfiles %{buildroot}%{_pkgdocdir}/error
136
137 # Install vim syntax
138 install -D -p -m 0644 admin/syntax-highlight/%{name}.vim %{buildroot}%{_datadir}/vim/syntax/%{name}.vim
139
140 # Install README.urpmi
141 cat << EOF | perl -pe 'chomp if eof' > README.urpmi
142 Haproxy is now installed.
143
144 Configuration file is %{_sysconfdir}/%{name}/%{name}.conf
145
146 The server listen on any:8080 and 8443 by default.
147
148 Add to %{_sysconfdir}/shorewall/rules.haproxy these shorewall rules for a transparent proxy:
149 # Redirect tcp traffic from net on port 80 to 8080
150 REDIRECT net 8080 tcp 80
151 # Redirect tcp traffic from net on port 443 to 8443
152 REDIRECT net 8443 tcp 443
153
154 Enable the service with:
155 # systemctl enable haproxy.service
156
157 Start the service with:
158 # systemctl start haproxy.service
159 EOF
160
161 # Install log dir
162 install -d -m 755 %{buildroot}%{_logdir}/%{name}
163
164 # Install bin dir
165 install -d 0755 %{buildroot}%{_bindir}
166
167 # Install haproxy utils
168 install -p -m 0755 admin/halog/halog %{buildroot}%{_bindir}/halog
169 install -p -m 0755 admin/iprange/iprange %{buildroot}%{_bindir}/iprange
170 install -p -m 0755 dev/flags/flags %{buildroot}%{_bindir}/flags
171 install -p -m 0755 dev/poll/poll %{buildroot}%{_bindir}/poll
172 install -p -m 0755 dev/tcploop/tcploop %{buildroot}%{_bindir}/tcploop
173 install -p -m 0755 dev/hpack/gen-rht %{buildroot}%{_bindir}/gen-rht
174 install -p -m 0755 dev/hpack/gen-enc %{buildroot}%{_bindir}/gen-enc
175 install -p -m 0755 dev/hpack/decode %{buildroot}%{_bindir}/hadecode
176
177 %pre
178 %_pre_useradd %{name} %{_sharedstatedir}/%{name} /bin/false
179 %_pre_groupadd %{name} %{name}
180
181 %preun
182 %_preun_service %{name}
183
184 %post
185 %_tmpfilescreate %{name}
186 %_post_service %{name}
187 %_create_ssl_certificate %{name}
188
189 %postun
190 %_postun_userdel %{name}
191 %_postun_groupdel %{name}
192
193 %files
194 %dir %{_logdir}/%{name}
195 %dir %{_sysconfdir}/%{name}
196 %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
197 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
198 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
199 %{_sbindir}/%{name}
200 %{_pkgdocdir}/*.txt
201 %{_pkgdocdir}/error/*
202 %{_mandir}/man1/*
203 %{_tmpfilesdir}/%{name}.conf
204 %{_unitdir}/%{name}.service
205 %{_datadir}/vim/syntax/%{name}.vim
206 %attr(0750, %{name}, %{name}) %{_sharedstatedir}/%{name}
207
208 %files utils
209 %{_bindir}/flags
210 %{_bindir}/gen-enc
211 %{_bindir}/gen-rht
212 %{_bindir}/hadecode
213 %{_bindir}/halog
214 %{_bindir}/iprange
215 %{_bindir}/poll
216 %{_bindir}/tcploop

  ViewVC Help
Powered by ViewVC 1.1.30