b889c8a4c710aca5ba63ed4a325c17274558cebe
[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:=9.0.0
11 PKG_RELEASE:=1
12 PKG_SOURCE_DATE:=2023-08-12
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
15 PKG_SOURCE_VERSION:=9852228d1e87bdbad13e0fed8313203f00bf26af
16 PKG_SOURCE_URL:=https://codeload.github.com/FRRouting/frr/tar.gz/$(PKG_SOURCE_VERSION)?
17
18 PKG_HASH:=6e611cd86ae9787a4b8d71411fdc38ad1fe843a839756c9c386848ffde81f6cf
19 PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
22 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
23
24 PKG_LICENSE:=GPL-2.0-only LGPL-2.1-only
25 PKG_CPE_ID:=cpe:/a:ffrouting:ffrouting
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 PKG_BUILD_FLAGS:=lto
62
63 PKG_BUILD_DEPENDS:=frr/host protobuf-c/host
64 HOST_BUILD_DEPENDS:=python3/host
65
66 include $(INCLUDE_DIR)/package.mk
67 include $(INCLUDE_DIR)/host-build.mk
68
69 define Package/frr-libfrr/config
70 source "$(SOURCE)/Config.in"
71 endef
72
73 define Package/frr/Default
74 SECTION:=net
75 CATEGORY:=Network
76 SUBMENU:=Routing and Redirection
77 URL:=https://www.frrouting.org/
78 DEPENDS:=frr
79 endef
80
81 define Package/frr
82 $(call Package/frr/Default)
83 DEPENDS:=+librt
84 TITLE:=The FRRouting (FRR) Software Routing Suite
85 MENU:=1
86 endef
87
88 define Package/frr/description
89 FRRouting is free software that implements and manages various IPv4 and IPv6
90 routing protocols.
91
92 Currently FRRouting supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1, RIPv2, RIPng,
93 IS-IS, PIM-SM/MSDP, LDP, VRRP and Babel as well as very early support for EIGRP and
94 NHRP.
95 endef
96
97 define Package/frr-libfrr
98 $(call Package/frr/Default)
99 TITLE:=zebra library
100 DEPENDS+=+librt +libatomic +libcap +libjson-c +libyang +libprotobuf-c +FRR_OPENSSL:libopenssl +FRR_SNMP:libnetsnmp
101 CONFLICTS:=quagga-libzebra
102 endef
103
104 define Package/frr-vtysh
105 $(call Package/frr/Default)
106 DEPENDS+=+frr-libfrr +libreadline +libncurses +more
107 TITLE:=integrated shell for frr routing software
108 CONFLICTS:=quagga-vtysh
109 endef
110
111 define Package/frr-watchfrr
112 $(call Package/frr/Default)
113 TITLE:=frr watchdog
114 DEPENDS+=+frr-libfrr
115 DEFAULT:=y if PACKAGE_frr
116 endef
117
118 define Package/frr-zebra
119 $(call Package/frr/Default)
120 TITLE:=Zebra daemon
121 DEPENDS+=+frr-libfrr
122 DEFAULT:=y if PACKAGE_frr
123 CONFLICTS:=quagga-zebra
124 endef
125
126 define Package/frr-pythontools
127 $(call Package/frr/Default)
128 TITLE:=Python reload tool
129 DEPENDS+=+frr-libfrr +python3-base +python3-light +python3-logging
130 endef
131
132 ##Migrate from quagga
133 ##should test file exists and link in frr folder
134 #define Package/frr/postinst
135 ##!/bin/sh
136 #if [ -f /etc/quagga/ospfd.conf ]; then
137 # ls to /etc/frr
138 # sed enable ospfd daemon
139 #fi
140 #exit 0
141 #endef
142
143 define BuildDaemon
144 define Package/frr-$(1)
145 $$(call Package/frr/Default)
146 TITLE:= $(1) routing engine
147 DEPENDS+=frr-libfrr $(2)
148 endef
149 # if [ "$(1)" == "bfdd" ]; then \
150 # export HAVE_BFDD == 1 ; fi
151
152 define Package/frr-$(1)/install
153 $(INSTALL_DIR) $$(1)/usr/sbin
154 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(1) $$(1)/usr/sbin/; \
155 if [ "$(1)" == "nhrpd" ]; then \
156 $(INSTALL_DIR) $$(1)/usr/lib; \
157 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libfrrcares.so* $$(1)/usr/lib/; fi
158 endef
159
160 $$(eval $$(call BuildPackage,frr-$(1)))
161 endef
162
163 define Package/frr-libfrr/conffiles
164 /etc/frr/daemons
165 /etc/frr/frr.conf
166 /etc/frr/vtysh.conf
167 endef
168
169 TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed -latomic
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,))