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