frr: update to latest
[feed/packages.git] / net / frr / Makefile
1 #
2 # Copyright (C) 2019 Lucian Cristian <lucian.cristian@gmail.com>
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 PKG_NAME:=frr
10 PKG_VERSION:=8.1.0
11 PKG_RELEASE:=2
12 PKG_SOURCE_DATE:=2022-01-17
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
15 PKG_SOURCE_VERSION:=4757da741a81ba48a4ba1601a1e9c9380def66ef
16 PKG_SOURCE_URL:=https://codeload.github.com/FRRouting/frr/tar.gz/$(PKG_SOURCE_VERSION)?
17
18
19 PKG_HASH:=e9d45fb55276b74363c78977f467b88ed77b071ad2d54c6495eed1344d406ed5
20 PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
23 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
24
25 PKG_LICENSE:=GPL-2.0-only LGPL-2.1-only
26
27 PKG_DAEMON_AVAILABLE:= \
28 babeld \
29 bfdd \
30 bgpd \
31 eigrpd \
32 fabricd \
33 isisd \
34 ldpd \
35 nhrpd \
36 ospfd \
37 ospf6d \
38 pathd \
39 pbrd \
40 pimd \
41 ripd \
42 ripngd \
43 staticd \
44 vrrpd
45
46 PKG_CONFIG_DEPENDS:= \
47 CONFIG_IPV6 \
48 CONFIG_FRR_OPENSSL \
49 CONFIG_FRR_INTERNAL \
50 CONFIG_FRR_SNMP \
51 CONFIG_FRR_NO_SNMP \
52 CONFIG_PACKAGE_frr-libfrr \
53 CONFIG_PACKAGE_frr-vtysh \
54 CONFIG_PACKAGE_frr-watchfrr \
55 CONFIG_PACKAGE_frr-zebra \
56 $(patsubst %,CONFIG_PACKAGE_frr-%,$(PKG_DAEMON_AVAILABLE)) \
57
58 PKG_FIXUP:=autoreconf
59 PKG_BUILD_PARALLEL:=1
60 PKG_INSTALL:=1
61
62 PKG_BUILD_DEPENDS:=frr/host
63 HOST_BUILD_DEPENDS:=python3/host elfutils/host
64
65 include $(INCLUDE_DIR)/package.mk
66 include $(INCLUDE_DIR)/host-build.mk
67
68 define Package/frr-libfrr/config
69 source "$(SOURCE)/Config.in"
70 endef
71
72 define Package/frr/Default
73 SECTION:=net
74 CATEGORY:=Network
75 SUBMENU:=Routing and Redirection
76 URL:=https://www.frrouting.org/
77 DEPENDS:=frr
78 endef
79
80 define Package/frr
81 $(call Package/frr/Default)
82 DEPENDS:=+librt
83 TITLE:=The FRRouting (FRR) Software Routing Suite
84 MENU:=1
85 endef
86
87 define Package/frr/description
88 FRRouting is free software that implements and manages various IPv4 and IPv6
89 routing protocols.
90
91 Currently FRRouting supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1, RIPv2, RIPng,
92 IS-IS, PIM-SM/MSDP, LDP, VRRP and Babel as well as very early support for EIGRP and
93 NHRP.
94 endef
95
96 define Package/frr-libfrr
97 $(call Package/frr/Default)
98 TITLE:=zebra library
99 DEPENDS+=+librt +libatomic +libcap +libjson-c +libyang +FRR_OPENSSL:libopenssl +FRR_SNMP:libnetsnmp
100 CONFLICTS:=quagga-libzebra
101 endef
102
103 define Package/frr-vtysh
104 $(call Package/frr/Default)
105 DEPENDS+=+frr-libfrr +libreadline +libncurses +more
106 TITLE:=integrated shell for frr routing software
107 CONFLICTS:=quagga-vtysh
108 endef
109
110 define Package/frr-watchfrr
111 $(call Package/frr/Default)
112 TITLE:=frr watchdog
113 DEPENDS+=+frr-libfrr
114 DEFAULT:=y if PACKAGE_frr
115 endef
116
117 define Package/frr-zebra
118 $(call Package/frr/Default)
119 TITLE:=Zebra daemon
120 DEPENDS+=+frr-libfrr
121 DEFAULT:=y if PACKAGE_frr
122 CONFLICTS:=quagga-zebra
123 endef
124
125 define Package/frr-pythontools
126 $(call Package/frr/Default)
127 TITLE:=Python reload tool
128 DEPENDS+=+frr-libfrr +python3-base +python3-light +python3-logging
129 endef
130
131 ##Migrate from quagga
132 ##should test file exists and link in frr folder
133 #define Package/frr/postinst
134 ##!/bin/sh
135 #if [ -f /etc/quagga/ospfd.conf ]; then
136 # ls to /etc/frr
137 # sed enable ospfd daemon
138 #fi
139 #exit 0
140 #endef
141
142 define BuildDaemon
143 define Package/frr-$(1)
144 $$(call Package/frr/Default)
145 TITLE:= $(1) routing engine
146 DEPENDS+=frr-libfrr $(2)
147 endef
148 # if [ "$(1)" == "bfdd" ]; then \
149 # export HAVE_BFDD == 1 ; fi
150
151 define Package/frr-$(1)/install
152 $(INSTALL_DIR) $$(1)/usr/sbin
153 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(1) $$(1)/usr/sbin/; \
154 if [ "$(1)" == "nhrpd" ]; then \
155 $(INSTALL_DIR) $$(1)/usr/lib; \
156 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfrrcares.so* $$(1)/usr/lib/; fi
157 endef
158
159 $$(eval $$(call BuildPackage,frr-$(1)))
160 endef
161
162 define Package/frr-libfrr/conffiles
163 /etc/frr/daemons
164 /etc/frr/frr.conf
165 /etc/frr/vtysh.conf
166 endef
167
168 TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed -latomic
169 TARGET_CFLAGS += -flto
170
171 define Host/Configure
172 $(Host/Configure/Default)
173 $(SED) 's/$$$$(MAKE) $$$$(AM_MAKEFLAGS) install-am/# $$$$(MAKE) $$$$(AM_MAKEFLAGS) install-am/' $(HOST_BUILD_DIR)/Makefile.in
174 endef
175
176 HOST_CPPFLAGS += -I$(STAGING_DIR_HOST)/include/libelf
177 HOST_CONFIGURE_ARGS+= \
178 --enable-clippy-only
179
180 define Host/Install
181 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
182 $(INSTALL_BIN) $(HOST_BUILD_DIR)/lib/clippy $(STAGING_DIR_HOSTPKG)/bin/
183 endef
184
185 CONFIGURE_ARGS+= \
186 --with-clippy=$(STAGING_DIR_HOSTPKG)/bin/clippy \
187 --prefix=/usr \
188 --enable-shared \
189 --disable-static \
190 --enable-user=network \
191 --enable-group=network \
192 --disable-ospfclient \
193 --disable-doc \
194 --disable-backtrace \
195 --localstatedir=/var/run/frr \
196 --sysconfdir=/etc/frr/ \
197 $(if $(CONFIG_FRR_OPENSSL),--with-crypto=openssl,) \
198 $(if $(CONFIG_FRR_SNMP),--enable-snmp,) \
199 $(foreach m,$(PKG_DAEMON_AVAILABLE), \
200 $(call autoconf_bool,CONFIG_PACKAGE_frr-$(m),$(m)) ) \
201 $(call autoconf_bool,CONFIG_PACKAGE_frr-vtysh,vtysh) \
202 $(call autoconf_bool,CONFIG_PACKAGE_frr-libfrr,zebra)
203
204
205 define Package/frr/install
206 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
207 $(INSTALL_BIN) ./files/frrcommon.sh $(1)/usr/sbin/
208 $(INSTALL_BIN) ./files/frr $(1)/etc/init.d/
209 endef
210
211 define Package/frr-watchfrr/install
212 $(INSTALL_DIR) $(1)/usr/sbin
213 $(INSTALL_BIN) ./files/watchfrr.sh $(1)/usr/sbin/
214 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchfrr $(1)/usr/sbin/
215 endef
216
217 define Package/frr-zebra/install
218 $(INSTALL_DIR) $(1)/usr/sbin
219 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
220 endef
221
222 define Package/frr-libfrr/install
223 $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/frr
224 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfrr.so* $(1)/usr/lib/
225 $(if $(CONFIG_FRR_SNMP),$(CP) $(PKG_INSTALL_DIR)/usr/lib/libfrrsnmp.so* $(1)/usr/lib/,)
226 $(INSTALL_CONF) ./files/{frr.conf,daemons} $(1)/etc/frr/
227 endef
228
229
230 define Package/frr-pythontools/install
231 $(INSTALL_DIR) $(1)/usr/lib/frr $(1)/usr/sbin $(1)/etc/frr
232 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/*.py $(1)/usr/lib/frr/
233 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/frr-reload $(1)/usr/sbin/
234 $(INSTALL_CONF) $(PKG_BUILD_DIR)/tools/etc/frr/support_bundle_commands.conf $(1)/etc/frr/
235 endef
236
237 define Package/frr-vtysh/install
238 $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/frr
239 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
240 $(INSTALL_CONF) ./files/vtysh.conf $(1)/etc/frr/
241 endef
242
243 $(eval $(call HostBuild))
244 $(eval $(call BuildPackage,frr))
245 $(eval $(call BuildPackage,frr-libfrr))
246 $(eval $(call BuildPackage,frr-pythontools))
247 $(eval $(call BuildPackage,frr-watchfrr))
248 $(eval $(call BuildPackage,frr-zebra))
249 $(eval $(call BuildPackage,frr-vtysh))
250 $(eval $(call BuildDaemon,babeld,))
251 $(eval $(call BuildDaemon,bfdd,))
252 $(eval $(call BuildDaemon,bgpd,))
253 $(eval $(call BuildDaemon,eigrpd,))
254 $(eval $(call BuildDaemon,fabricd,))
255 $(eval $(call BuildDaemon,isisd,))
256 $(eval $(call BuildDaemon,ldpd,))
257 $(eval $(call BuildDaemon,nhrpd,+libcares))
258 $(eval $(call BuildDaemon,ospfd,))
259 $(eval $(call BuildDaemon,ospf6d,@IPV6))
260 $(eval $(call BuildDaemon,pathd,))
261 $(eval $(call BuildDaemon,pbrd,))
262 $(eval $(call BuildDaemon,pimd,))
263 $(eval $(call BuildDaemon,ripd,))
264 $(eval $(call BuildDaemon,ripngd,@IPV6))
265 $(eval $(call BuildDaemon,staticd,))
266 $(eval $(call BuildDaemon,vrrpd,))