1 # Copyright (C) 2019 Wind River Systems, Inc.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 SUMMARY = "TCP/HTTP proxy and load balancer for high availability environments"
17 HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high \
18 availability environments. Indeed, it can: \
19 - route HTTP requests depending on statically assigned cookies \
20 - spread load among several servers while assuring server persistence \
21 through the use of HTTP cookies \
22 - switch to backup servers in the event a main server fails \
23 - accept connections to special ports dedicated to service monitoring \
24 - stop accepting connections without breaking existing ones \
25 - add, modify, and delete HTTP headers in both directions \
26 - block requests matching particular patterns \
27 - report detailed status to authenticated users from a URI \
28 intercepted by the application \
30 HOMEPAGE = "http://www.haproxy.org/"
33 LIC_FILES_CHKSUM = "file://LICENSE;md5=2d862e836f92129cdc0ecccc54eed5e0"
35 DEPENDS = "libpcre openssl zlib"
37 MAJOR_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
39 SRC_URI = "https://www.haproxy.org/download/${MAJOR_VER}/src/haproxy-${PV}.tar.gz \
40 file://haproxy.service \
44 inherit systemd useradd
46 # create a user for running haproxy
47 HAP_USER_HOME = "${libdir}/haproxy"
48 USERADD_PACKAGES = "${PN}"
49 USERADD_PARAM_${PN} = "--system --home ${HAP_USER_HOME} --shell /sbin/nologin \
50 --groups haproxy --gid haproxy haproxy"
51 GROUPADD_PARAM_${PN} = "haproxy"
54 HAP_TARGET = "linux2628"
58 'TARGET=${HAP_TARGET}' \
61 'USE_PCRE=1' 'USE_PCRE_JIT=1' \
63 'USE_LINUX_TPROXY=1' \
66 EXTRA_OEMAKE_append_x86 = " USE_REGPARM=1"
67 EXTRA_OEMAKE_append_x86-64 = " USE_REGPARM=1"
75 oe_runmake CC="${CC}" CFLAGS="${CFLAGS}" SBINDIR="${sbindir}" \
77 ZLIB_INC=${STAGING_INCDIR} \
78 ZLIB_LIB=${STAGING_LIBDIR} \
79 PCRE_INC=${STAGING_INCDIR} \
80 PCRE_LIB=${STAGING_LIBDIR} \
81 SSL_INC=${STAGING_INCDIR} \
82 SSL_LIB=${STAGING_LIBDIR}
83 oe_runmake -C contrib/halog halog
84 oe_runmake -C contrib/iprange iprange
88 oe_runmake install-bin \
90 SBINDIR="${sbindir}" \
92 INCLUDEDIR=${includedir}
94 install -D -m 0644 ${WORKDIR}/haproxy.service ${D}${systemd_system_unitdir}/haproxy.service
95 install -D -m 0644 ${WORKDIR}/haproxy.cfg ${D}${sysconfdir}/haproxy/haproxy.cfg
97 # install ssl folder for certificate
98 install -m 700 -d ${D}/${sysconfdir}/ssl/haproxy
99 chown haproxy:haproxy ${D}/${sysconfdir}/ssl/haproxy
101 # install halog and iprange
102 install -D -m 755 contrib/halog/halog ${D}${bindir}/halog
103 install -D -m 755 contrib/iprange/iprange ${D}${bindir}/iprange
110 ${systemd_system_unitdir} \
112 RDEPENDS_${PN} = "openssl"
114 SYSTEMD_SERVICE_${PN} = "haproxy.service"
116 INSANE_SKIP_${PN} += "already-stripped"