1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit user versionator toolchain-funcs flag-o-matic systemd
8 MY_P="${PN}-${PV/_beta/-dev}"
10 DESCRIPTION="A TCP/HTTP reverse proxy for high availability environments"
11 HOMEPAGE="http://haproxy.1wt.eu"
12 SRC_URI="http://haproxy.1wt.eu/download/$(get_version_component_range 1-2)/src/${MY_P}.tar.gz"
14 LICENSE="GPL-2 LGPL-2.1"
16 KEYWORDS="~amd64 ~arm ~ppc ~x86"
17 IUSE="+crypt examples libressl +pcre pcre-jit ssl tools vim-syntax +zlib"
22 pcre-jit? ( dev-libs/libpcre[jit] )
25 !libressl? ( dev-libs/openssl:0=[zlib?] )
26 libressl? ( dev-libs/libressl:0= )
28 zlib? ( sys-libs/zlib )"
31 S="${WORKDIR}/${MY_P}"
35 enewuser haproxy -1 -1 -1 haproxy
39 local args="TARGET=linux2628 USE_GETADDRINFO=1"
42 args="${args} USE_PCRE=1"
44 args="${args} USE_PCRE_JIT=1"
46 args="${args} USE_PCRE_JIT="
49 args="${args} USE_PCRE= USE_PCRE_JIT="
52 # if use kernel_linux; then
53 # args="${args} USE_LINUX_SPLICE=1 USE_LINUX_TPROXY=1"
55 # args="${args} USE_LINUX_SPLICE= USE_LINUX_TPROXY="
59 args="${args} USE_LIBCRYPT=1"
61 args="${args} USE_LIBCRYPT="
65 args="${args} USE_OPENSSL=1"
67 args="${args} USE_OPENSSL="
71 args="${args} USE_ZLIB=1"
73 args="${args} USE_ZLIB="
76 # For now, until the strict-aliasing breakage will be fixed
77 append-cflags -fno-strict-aliasing
79 emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args}
80 emake -C contrib/systemd SBINDIR=/usr/sbin
83 for contrib in halog iprange ; do
84 emake -C contrib/${contrib} \
85 CFLAGS="${CFLAGS}" OPTIMIZE="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC=$(tc-getCC) ${args}
92 dosym /usr/sbin/haproxy /usr/bin/haproxy
94 newinitd "${FILESDIR}/haproxy.initd-r6" haproxy
96 # Don't install useless files
97 # rm examples/build.cfg doc/*gpl.txt
99 dodoc CHANGELOG ROADMAP doc/{configuration,haproxy-en}.txt
102 dosbin haproxy-systemd-wrapper
103 dosym /usr/sbin/haproxy-systemd-wrapper /usr/bin/haproxy-systemd-wrapper
104 systemd_dounit contrib/systemd/haproxy.service
107 for contrib in halog iprange ; do
108 dobin contrib/${contrib}/${contrib}
112 if use examples ; then
117 if use vim-syntax ; then
118 insinto /usr/share/vim/vimfiles/syntax
119 doins examples/haproxy.vim
124 if [[ ! -f "${ROOT}/etc/haproxy.cfg" ]] ; then
125 ewarn "You need to create /etc/haproxy.cfg before you start the haproxy service."
126 ewarn "It's best practice to not run haproxy as root, user and group haproxy was therefore created."
127 ewarn "Make use of them with the \"user\" and \"group\" directives."
129 if [[ -d "${ROOT}/usr/share/doc/${PF}" ]]; then
130 einfo "Please consult the installed documentation for learning the configuration file's syntax."
131 einfo "The documentation and sample configuration files are installed here:"
132 einfo " ${ROOT}usr/share/doc/${PF}"