[packages] quagga: Build daemons of selected packages only
[openwrt/svn-archive/archive.git] / net / quagga / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
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
10 PKG_NAME:=quagga
11 ifneq ($(CONFIG_QUAGGA_OLD),)
12 PKG_VERSION:=0.98.6
13 PKG_RELEASE:=7
14 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68
15 PATCH_DIR:=./patches-old
16 else
17 PKG_VERSION:=0.99.17
18 PKG_RELEASE:=3
19 PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f
20 endif
21
22 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
23 PKG_SOURCE_URL:=http://www.quagga.net/download/ \
24 http://www.de.quagga.net/download/ \
25 http://www.uk.quagga.net/download/
26 PKG_CONFIG_DEPENDS:= \
27 CONFIG_QUAGGA_OLD \
28 CONFIG_IPV6 \
29 CONFIG_PACKAGE_quagga-libzebra \
30 CONFIG_PACKAGE_quagga-libospf \
31 CONFIG_PACKAGE_quagga-bgpd \
32 CONFIG_PACKAGE_quagga-isisd \
33 CONFIG_PACKAGE_quagga-ospf6d \
34 CONFIG_PACKAGE_quagga-ripd \
35 CONFIG_PACKAGE_quagga-ripngd \
36 CONFIG_PACKAGE_quagga-vtysh
37 PKG_BUILD_PARALLEL:=1
38 PKG_FIXUP:=libtool
39 PKG_INSTALL:=1
40
41 include $(INCLUDE_DIR)/package.mk
42
43 define Package/quagga/Default
44 SECTION:=net
45 CATEGORY:=Network
46 DEPENDS:=quagga
47 TITLE:=The Quagga Software Routing Suite
48 URL:=http://www.quagga.net
49 MAINTAINER:=Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
50 endef
51
52 define Package/quagga
53 $(call Package/quagga/Default)
54 DEPENDS:=+!QUAGGA_OLD:librt
55 MENU:=1
56 endef
57
58 define Package/quagga/description
59 A routing software package that provides TCP/IP based routing services
60 with routing protocols support such as RIPv1, RIPv2, RIPng, OSPFv2,
61 OSPFv3, BGP-4, and BGP-4+
62 endef
63
64 define Package/quagga/config
65 config QUAGGA_OLD
66 depends on (PACKAGE_quagga && BROKEN)
67 default n
68 bool "Use the old release version 0.98.6"
69 help
70 This option allows you to select the old version of Quagga to be built.
71 endef
72
73 define Package/quagga-libzebra
74 $(call Package/quagga/Default)
75 TITLE:=zebra library
76 endef
77
78 define Package/quagga-libospf
79 $(call Package/quagga/Default)
80 TITLE:=OSPF library
81 endef
82
83 define Package/quagga-bgpd
84 $(call Package/quagga/Default)
85 DEPENDS+=+quagga-libzebra
86 TITLE:=BGPv4, BGPv4+, BGPv4- routing engine
87 endef
88
89 define Package/quagga-isisd
90 $(call Package/quagga/Default)
91 TITLE:=IS-IS routing engine
92 endef
93
94 define Package/quagga-ospfd
95 $(call Package/quagga/Default)
96 DEPENDS+=+quagga-libospf +quagga-libzebra
97 TITLE:=OSPFv2 routing engine
98 endef
99
100 define Package/quagga-ospf6d
101 $(call Package/quagga/Default)
102 DEPENDS+=+quagga-libospf +quagga-libzebra @IPV6
103 TITLE:=OSPFv3 routing engine
104 endef
105
106 define Package/quagga-ripd
107 $(call Package/quagga/Default)
108 DEPENDS+=+quagga-libzebra
109 TITLE:=RIP routing engine
110 endef
111
112 define Package/quagga-ripngd
113 $(call Package/quagga/Default)
114 DEPENDS+=+quagga-libzebra @BROKEN
115 TITLE:=RIPNG routing engine
116 endef
117
118 define Package/quagga-vtysh
119 $(call Package/quagga/Default)
120 DEPENDS+=quagga-libzebra +libreadline +libncurses
121 TITLE:=integrated shell for Quagga routing software
122 endef
123
124 define Package/quagga/conffiles
125 /etc/quagga/zebra.conf
126 endef
127
128 define Package/quagga-bgpd/conffiles
129 /etc/quagga/bgpd.conf
130 endef
131
132 define Package/quagga-isisd/conffiles
133 /etc/quagga/isisd.conf
134 endef
135
136 define Package/quagga-ospfd/conffiles
137 /etc/quagga/ospfd.conf
138 endef
139
140 define Package/quagga-ospf6d/conffiles
141 /etc/quagga/ospf6d.conf
142 endef
143
144 define Package/quagga-ripd/conffiles
145 /etc/quagga/ripd.conf
146 endef
147
148 define Package/quagga-ripngd/conffiles
149 /etc/quagga/ripngd.conf
150 endef
151
152 CONFIGURE_ARGS+= \
153 --localstatedir=/var/run/quagga \
154 --sysconfdir=/etc/quagga/ \
155 --enable-shared \
156 --disable-static \
157 --enable-user=quagga \
158 --enable-group=quagga \
159 --enable-pie=no \
160 --enable-multipath=8 \
161 $(call autoconf_bool,CONFIG_PACKAGE_quagga-libzebra,zebra) \
162 $(call autoconf_bool,CONFIG_PACKAGE_quagga-libospf,ospfd) \
163 $(call autoconf_bool,CONFIG_PACKAGE_quagga-bgpd,bgpd) \
164 $(call autoconf_bool,CONFIG_PACKAGE_quagga-isisd,isisd) \
165 $(call autoconf_bool,CONFIG_PACKAGE_quagga-ospf6d,ospf6d) \
166 $(call autoconf_bool,CONFIG_PACKAGE_quagga-ripd,ripd) \
167 $(call autoconf_bool,CONFIG_PACKAGE_quagga-ripngd,ripngd) \
168 $(call autoconf_bool,CONFIG_PACKAGE_quagga-vtysh,vtysh) \
169
170 define Build/Configure
171 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
172 );
173 $(call Build/Configure/Default)
174 endef
175
176 define Package/quagga/install
177 $(INSTALL_DIR) $(1)/usr/sbin
178 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
179 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/
180 # avoid /etc being set to 0750
181 $(INSTALL_DIR) $(1)/etc/quagga
182 chmod 0750 $(1)/etc/quagga
183 $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/zebra.conf
184 $(INSTALL_DIR) $(1)/etc/init.d
185 $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init
186 $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga
187 endef
188
189 define Package/quagga/postinst
190 #!/bin/sh
191
192 name=quagga
193 id=51
194
195 # do not change below
196 # check if we are on real system
197 if [ -z "$${IPKG_INSTROOT}" ]; then
198 # create copies of passwd and group, if we use squashfs
199 rootfs=`mount |awk '/root/ { print $$5 }'`
200 if [ "$$rootfs" = "squashfs" ]; then
201 if [ -h /etc/group ]; then
202 rm /etc/group
203 cp /rom/etc/group /etc/group
204 fi
205 if [ -h /etc/passwd ]; then
206 rm /etc/passwd
207 cp /rom/etc/passwd /etc/passwd
208 fi
209 fi
210 fi
211
212 echo ""
213 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
214 echo "adding group $$name to /etc/group"
215 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
216 fi
217
218 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
219 echo "adding user $$name to /etc/passwd"
220 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
221 fi
222
223 grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
224 if [ $$? -ne 0 ]; then
225 echo "zebrasrv 2600/tcp" >>$${IPKG_INSTROOT}/etc/services
226 echo "zebra 2601/tcp" >>$${IPKG_INSTROOT}/etc/services
227 echo "ripd 2602/tcp" >>$${IPKG_INSTROOT}/etc/services
228 echo "ripngd 2603/tcp" >>$${IPKG_INSTROOT}/etc/services
229 echo "ospfd 2604/tcp" >>$${IPKG_INSTROOT}/etc/services
230 echo "bgpd 2605/tcp" >>$${IPKG_INSTROOT}/etc/services
231 echo "ospf6d 2606/tcp" >>$${IPKG_INSTROOT}/etc/services
232 echo "ospfapi 2607/tcp" >>$${IPKG_INSTROOT}/etc/services
233 echo "isisd 2608/tcp" >>$${IPKG_INSTROOT}/etc/services
234 fi
235 endef
236
237 define Package/quagga-bgpd/install
238 $(INSTALL_DIR) $(1)/usr/sbin
239 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/
240 $(INSTALL_DIR) $(1)/etc/quagga
241 chmod 0750 $(1)/etc/quagga
242 $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/bgpd.conf
243 endef
244
245 define Package/quagga-isisd/install
246 $(INSTALL_DIR) $(1)/usr/sbin
247 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin/
248 $(INSTALL_DIR) $(1)/etc/quagga
249 chmod 0750 $(1)/etc/quagga
250 $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/isisd.conf
251 endef
252
253 define Package/quagga-ospfd/install
254 $(INSTALL_DIR) $(1)/usr/sbin
255 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/
256 $(INSTALL_DIR) $(1)/etc/quagga
257 chmod 0750 $(1)/etc/quagga
258 $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospfd.conf
259 endef
260
261 define Package/quagga-ospf6d/install
262 $(INSTALL_DIR) $(1)/usr/sbin
263 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/
264 $(INSTALL_DIR) $(1)/etc/quagga
265 chmod 0750 $(1)/etc/quagga
266 $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospf6d.conf
267 endef
268
269 define Package/quagga-ripd/install
270 $(INSTALL_DIR) $(1)/usr/sbin
271 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/
272 $(INSTALL_DIR) $(1)/etc/quagga
273 chmod 0750 $(1)/etc/quagga
274 $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripd.conf
275 endef
276
277 define Package/quagga-ripngd/install
278 $(INSTALL_DIR) $(1)/usr/sbin
279 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/
280 $(INSTALL_DIR) $(1)/etc/quagga
281 chmod 0750 $(1)/etc/quagga
282 $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf
283 endef
284
285 define Package/quagga-vtysh/install
286 $(INSTALL_DIR) $(1)/usr/bin
287 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
288 endef
289
290 define Package/quagga-libospf/install
291 $(INSTALL_DIR) $(1)/usr/lib
292 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/
293 endef
294
295 define Package/quagga-libzebra/install
296 $(INSTALL_DIR) $(1)/usr/lib
297 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib/
298 endef
299
300 $(eval $(call BuildPackage,quagga))
301 $(eval $(call BuildPackage,quagga-libzebra))
302 $(eval $(call BuildPackage,quagga-libospf))
303 $(eval $(call BuildPackage,quagga-bgpd))
304 $(eval $(call BuildPackage,quagga-isisd))
305 $(eval $(call BuildPackage,quagga-ospfd))
306 $(eval $(call BuildPackage,quagga-ospf6d))
307 $(eval $(call BuildPackage,quagga-ripd))
308 $(eval $(call BuildPackage,quagga-ripngd))
309 $(eval $(call BuildPackage,quagga-vtysh))