xref: /OK3568_Linux_fs/buildroot/package/quagga/quagga.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# quagga
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunQUAGGA_VERSION = 1.2.4
8*4882a593SmuzhiyunQUAGGA_SITE = http://download.savannah.gnu.org/releases/quagga
9*4882a593SmuzhiyunQUAGGA_INSTALL_STAGING = YES
10*4882a593SmuzhiyunQUAGGA_DEPENDENCIES = host-gawk host-pkgconf
11*4882a593SmuzhiyunQUAGGA_LICENSE = GPL-2.0+
12*4882a593SmuzhiyunQUAGGA_LICENSE_FILES = COPYING
13*4882a593SmuzhiyunQUAGGA_CPE_ID_VENDOR = quagga
14*4882a593SmuzhiyunQUAGGA_SELINUX_MODULES = zebra
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun# We need to override the sysconf and localstate directories so that
17*4882a593Smuzhiyun# quagga can create files as the quagga user without extra
18*4882a593Smuzhiyun# intervention
19*4882a593SmuzhiyunQUAGGA_CONF_OPTS = \
20*4882a593Smuzhiyun	--program-transform-name='' \
21*4882a593Smuzhiyun	--sysconfdir=/etc/quagga \
22*4882a593Smuzhiyun	--localstatedir=/var/run/quagga
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun# quagga has its own internal copy of getopt_long. To avoid conflicts with libc's
25*4882a593Smuzhiyun# getopt, we need to make sure that the getopt function itself is also built.
26*4882a593SmuzhiyunQUAGGA_CONF_ENV = \
27*4882a593Smuzhiyun	CFLAGS="$(TARGET_CFLAGS) -DREALLY_NEED_PLAIN_GETOPT"
28*4882a593Smuzhiyun
29*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_LIBCAP),y)
30*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --enable-capabilities
31*4882a593SmuzhiyunQUAGGA_DEPENDENCIES += libcap
32*4882a593Smuzhiyunelse
33*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --disable-capabilities
34*4882a593Smuzhiyunendif
35*4882a593Smuzhiyun
36*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PROTOBUF_C),y)
37*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --enable-protobuf
38*4882a593SmuzhiyunQUAGGA_DEPENDENCIES += protobuf-c
39*4882a593Smuzhiyunelse
40*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --disable-protobuf
41*4882a593Smuzhiyunendif
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_ZEBRA),--enable-zebra,--disable-zebra)
44*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_BGPD),--enable-bgpd,--disable-bgpd)
45*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_RIPD),--enable-ripd,--disable-ripd)
46*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_RIPNGD),--enable-ripngd,--disable-ripngd)
47*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_OSPFD),--enable-ospfd,--disable-ospfd --disable-ospfapi)
48*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_OSPF6D),--enable-ospf6d,--disable-ospf6d)
49*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_PIMD),--enable-pimd,--disable-pimd)
50*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_WATCHQUAGGA),--enable-watchquagga,--disable-watchquagga)
51*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_ISISD),--enable-isisd,--disable-isisd)
52*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_BGP_ANNOUNCE),--enable-bgp-announce,--disable-bgp-announce)
53*4882a593SmuzhiyunQUAGGA_CONF_OPTS += $(if $(BR2_PACKAGE_QUAGGA_TCP_ZEBRA),--enable-tcp-zebra,--disable-tcp-zebra)
54*4882a593Smuzhiyun
55*4882a593Smuzhiyundefine QUAGGA_USERS
56*4882a593Smuzhiyun	quagga -1 quagga -1 * - - - Quagga priv drop user
57*4882a593Smuzhiyunendef
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun# Set the permissions of /etc/quagga such that quagga (through vtysh)
60*4882a593Smuzhiyun# can save the configuration - set the folder recursively as the files
61*4882a593Smuzhiyun# need to be 600, and then set the folder (non-recursively) to 755 so
62*4882a593Smuzhiyun# it can used.  Quagga also needs to write to the folder as it moves
63*4882a593Smuzhiyun# and creates, rather than overwriting.
64*4882a593Smuzhiyundefine QUAGGA_PERMISSIONS
65*4882a593Smuzhiyun	/etc/quagga r 600 quagga quagga - - - - -
66*4882a593Smuzhiyun	/etc/quagga d 755 quagga quagga - - - - -
67*4882a593Smuzhiyunendef
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun# In order for the QUAGGA_PERMISSIONS variable above to work,
70*4882a593Smuzhiyun# /etc/quagga has to exist. However, this package without any
71*4882a593Smuzhiyun# sub-option enabled will not create /etc/quagga, so let's create it
72*4882a593Smuzhiyun# unconditionally in a post-install hook, in case it hasn't been
73*4882a593Smuzhiyun# already created by the quagga installation.
74*4882a593Smuzhiyundefine QUAGGA_CREATE_ETC_QUAGGA
75*4882a593Smuzhiyun	mkdir -p $(TARGET_DIR)/etc/quagga
76*4882a593Smuzhiyunendef
77*4882a593SmuzhiyunQUAGGA_POST_INSTALL_TARGET_HOOKS += QUAGGA_CREATE_ETC_QUAGGA
78*4882a593Smuzhiyun
79*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_QUAGGA_NHRPD),y)
80*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --enable-nhrpd
81*4882a593SmuzhiyunQUAGGA_DEPENDENCIES += c-ares
82*4882a593Smuzhiyunelse
83*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --disable-nhrpd
84*4882a593Smuzhiyunendif
85*4882a593Smuzhiyun
86*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_QUAGGA_SNMP),y)
87*4882a593SmuzhiyunQUAGGA_CONF_ENV += ac_cv_path_NETSNMP_CONFIG=$(STAGING_DIR)/usr/bin/net-snmp-config
88*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --enable-snmp=agentx
89*4882a593SmuzhiyunQUAGGA_DEPENDENCIES += netsnmp
90*4882a593Smuzhiyunendif
91*4882a593Smuzhiyun
92*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_QUAGGA_VTYSH),y)
93*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --enable-vtysh
94*4882a593SmuzhiyunQUAGGA_DEPENDENCIES += readline
95*4882a593Smuzhiyunelse
96*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --disable-vtysh
97*4882a593Smuzhiyunendif
98*4882a593Smuzhiyun
99*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_SUPPORTS_PIE),)
100*4882a593SmuzhiyunQUAGGA_CONF_OPTS += --disable-pie
101*4882a593Smuzhiyunendif
102*4882a593Smuzhiyun
103*4882a593Smuzhiyundefine QUAGGA_INSTALL_INIT_SYSTEMD
104*4882a593Smuzhiyun	$(INSTALL) -D -m 644 package/quagga/quagga_tmpfiles.conf \
105*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/tmpfiles.d/quagga.conf
106*4882a593Smuzhiyun	$(INSTALL) -D -m 644 package/quagga/quagga@.service \
107*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system/quagga@.service
108*4882a593Smuzhiyunendef
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun$(eval $(autotools-package))
111