summaryrefslogtreecommitdiffstats
path: root/rules/haproxy.make
blob: 7c360135d5bcc43eccb3ac6d08ccf8d9b5f7fb2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# -*-makefile-*-
#
# Copyright (C) 2020 by Bastian Krause <bst@pengutronix.de>
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_HAPROXY) += haproxy

#
# Paths and names
#
HAPROXY_VERSION		:= 2.1.6
HAPROXY_MD5		:= 95ffd25fc6b57b4f1650322a7587f972
HAPROXY			:= haproxy-$(HAPROXY_VERSION)
HAPROXY_SUFFIX		:= tar.gz
HAPROXY_URL		:= https://www.haproxy.org/download/$(basename $(HAPROXY_VERSION))/src/$(HAPROXY).$(HAPROXY_SUFFIX)
HAPROXY_SOURCE		:= $(SRCDIR)/$(HAPROXY).$(HAPROXY_SUFFIX)
HAPROXY_DIR		:= $(BUILDDIR)/$(HAPROXY)
HAPROXY_LICENSE		:= GPL-2.0-or-later AND LGPL-2.1-or-later
HAPROXY_LICENSE_FILES	:= \
	file://doc/gpl.txt;md5=892f569a555ba9c07a568a7c0c4fa63a \
	file://doc/lgpl.txt;md5=fbc093901857fcd118f065f900982c24

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

HAPROXY_CONF_TOOL	:= NO
HAPROXY_MAKE_OPT	:= \
	CC=$(CROSS_CC) \
	PREFIX=/usr \
	TARGET=linux-glibc \
	USE_GZIP=1 \
	USE_LUA= \
	USE_OPENSSL=$(call ptx/ifdef,PTXCONF_HAPROXY_OPENSSL,1,) \
	USE_PCRE= \
	USE_RT=1 \
	USE_SLZ= \
	USE_SYSTEMD=$(call ptx/ifdef,PTXCONF_INITMETHOD_SYSTEMD,1,) \
	USE_ZLIB=1

ifdef PTXCONF_ARCH_PPC
HAPROXY_MAKE_OPT	+= \
	TARGET_LDFLAGS=-latomic
endif

HAPROXY_INSTALL_OPT	:= \
	PREFIX=/usr \
	install

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

$(STATEDIR)/haproxy.compile:
	@$(call targetinfo)
	@$(call world/compile, HAPROXY)
	@$(call compile, HAPROXY, -C contrib/systemd $(HAPROXY_MAKE_OPT))
	@$(call touch)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

$(STATEDIR)/haproxy.install:
	@$(call targetinfo)
	@$(call world/install, HAPROXY)
	@install -v -D -m644 $(HAPROXY_DIR)/contrib/systemd/haproxy.service \
		$(HAPROXY_PKGDIR)/usr/lib/systemd/system/haproxy.service
	@$(call touch)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

$(STATEDIR)/haproxy.targetinstall:
	@$(call targetinfo)

	@$(call install_init, haproxy)
	@$(call install_fixup, haproxy,PRIORITY,optional)
	@$(call install_fixup, haproxy,SECTION,base)
	@$(call install_fixup, haproxy,AUTHOR,"Bastian Krause <bst@pengutronix.de>")
	@$(call install_fixup, haproxy,DESCRIPTION,missing)

	@$(call install_copy, haproxy, 0, 0, 0755, -, /usr/sbin/haproxy)

	@$(call install_alternative_tree, haproxy, 0, 0, /etc/haproxy)

ifdef PTXCONF_HAPROXY_SYSTEMD_UNIT
	@$(call install_copy, haproxy, 0, 0, 0644, -, \
		/usr/lib/systemd/system/haproxy.service)
	@$(call install_link, haproxy, ../haproxy.service, \
		/usr/lib/systemd/system/multi-user.target.wants/haproxy.service)
endif

	@$(call install_finish, haproxy)

	@$(call touch)

# vim: syntax=make