xref: /OK3568_Linux_fs/buildroot/package/balena-engine/balena-engine.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# balena-engine
4#
5################################################################################
6
7BALENA_ENGINE_VERSION = 19.03.14
8BALENA_ENGINE_SITE = $(call github,balena-os,balena-engine,v$(BALENA_ENGINE_VERSION))
9
10BALENA_ENGINE_LICENSE = Apache-2.0
11BALENA_ENGINE_LICENSE_FILES = LICENSE
12
13BALENA_ENGINE_DEPENDENCIES = host-pkgconf
14BALENA_ENGINE_GOMOD = github.com/docker/docker
15
16BALENA_ENGINE_LDFLAGS = \
17	-X github.com/docker/cli/cli/version.Version=N/A \
18	-X github.com/docker/cli/cli/version.GitCommit= \
19	-X github.com/docker/cli/cli/version.BuildTime= \
20	-X github.com/containerd/containerd/version.Version=N/A \
21	-X github.com/opencontainers/runc.version=N/A
22
23BALENA_ENGINE_TAGS = \
24	cgo \
25	exclude_graphdriver_zfs \
26	autogen \
27	no_buildkit \
28	no_btrfs \
29	no_cri \
30	no_devmapper \
31	no_zfs \
32	exclude_disk_quota \
33	exclude_graphdriver_btrfs \
34	exclude_graphdriver_devicemapper
35
36BALENA_ENGINE_BUILD_TARGETS = cmd/balena-engine
37
38ifeq ($(BR2_INIT_SYSTEMD),y)
39BALENA_ENGINE_DEPENDENCIES += systemd
40BALENA_ENGINE_TAGS += journald
41endif
42
43define BALENA_ENGINE_RUN_AUTOGEN
44	cd $(@D) && \
45		VERSION=$(BALENA_ENGINE_VERSION) \
46		PKG_CONFIG=$(PKG_CONFIG_HOST_BINARY) \
47		$(TARGET_MAKE_ENV) \
48		$(SHELL) hack/make/.go-autogen
49endef
50
51BALENA_ENGINE_POST_CONFIGURE_HOOKS += BALENA_ENGINE_RUN_AUTOGEN
52
53define BALENA_ENGINE_INSTALL_INIT_SYSTEMD
54	$(INSTALL) -D -m 644 $(@D)/contrib/init/systemd/balena-engine.service \
55		$(TARGET_DIR)/usr/lib/systemd/system/balena-engine.service
56	$(INSTALL) -D -m 644 $(@D)/contrib/init/systemd/balena-engine.socket \
57		$(TARGET_DIR)/usr/lib/systemd/system/balena-engine.socket
58endef
59
60define BALENA_ENGINE_USERS
61	- - balena-engine -1 * - - - balenaEngine daemon
62endef
63
64define BALENA_ENGINE_LINUX_CONFIG_FIXUPS
65	$(call KCONFIG_ENABLE_OPT,CONFIG_POSIX_MQUEUE)
66	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
67	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG)
68	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_SCHED)
69	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_FREEZER)
70	$(call KCONFIG_ENABLE_OPT,CONFIG_CPUSETS)
71	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_DEVICE)
72	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_CPUACCT)
73	$(call KCONFIG_ENABLE_OPT,CONFIG_NAMESPACES)
74	$(call KCONFIG_ENABLE_OPT,CONFIG_UTS_NS)
75	$(call KCONFIG_ENABLE_OPT,CONFIG_IPC_NS)
76	$(call KCONFIG_ENABLE_OPT,CONFIG_PID_NS)
77	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_NS)
78	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER)
79	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_ADVANCED)
80	$(call KCONFIG_ENABLE_OPT,CONFIG_BRIDGE_NETFILTER)
81	$(call KCONFIG_ENABLE_OPT,CONFIG_NF_CONNTRACK)
82	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_ADDRTYPE)
83	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_CONNTRACK)
84	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_IPVS)
85	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_IPTABLES)
86	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_FILTER)
87	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_NAT)
88	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_TARGET_MASQUERADE)
89	$(call KCONFIG_ENABLE_OPT,CONFIG_BRIDGE)
90	$(call KCONFIG_ENABLE_OPT,CONFIG_DUMMY)
91	$(call KCONFIG_ENABLE_OPT,CONFIG_MACVLAN)
92	$(call KCONFIG_ENABLE_OPT,CONFIG_VXLAN)
93	$(call KCONFIG_ENABLE_OPT,CONFIG_VETH)
94	$(call KCONFIG_ENABLE_OPT,CONFIG_OVERLAY_FS)
95	$(call KCONFIG_ENABLE_OPT,CONFIG_KEYS)
96endef
97
98define BALENA_ENGINE_INSTALL_SYMLINK
99	ln -f -s balena-engine $(TARGET_DIR)/usr/bin/balena-engine-daemon
100	ln -f -s balena-engine $(TARGET_DIR)/usr/bin/balena-engine-containerd
101	ln -f -s balena-engine $(TARGET_DIR)/usr/bin/balena-engine-containerd-shim
102	ln -f -s balena-engine $(TARGET_DIR)/usr/bin/balena-engine-containerd-ctr
103	ln -f -s balena-engine $(TARGET_DIR)/usr/bin/balena-engine-runc
104	ln -f -s balena-engine $(TARGET_DIR)/usr/bin/balena-engine-proxy
105	$(if $(BR2_PACKAGE_TINI),ln -f -s tini $(TARGET_DIR)/usr/bin/balena-engine-init)
106endef
107BALENA_ENGINE_POST_INSTALL_TARGET_HOOKS += BALENA_ENGINE_INSTALL_SYMLINK
108
109$(eval $(golang-package))
110