6b73d93f70ab5cb579c39b1e8824793513755942
[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_STABLE \
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         source "$(SOURCE)/Config.in"
60 endef
61
62 define Package/quagga-libzebra
63   $(call Package/quagga/Default)
64   TITLE:=zebra library
65 endef
66
67 define Package/quagga-libospf
68   $(call Package/quagga/Default)
69   TITLE:=OSPF library
70 endef
71
72 define Package/quagga-bgpd
73   $(call Package/quagga/Default)
74   DEPENDS+=+quagga-libzebra
75   TITLE:=BGPv4, BGPv4+, BGPv4- routing engine
76 endef
77
78 define Package/quagga-isisd
79   $(call Package/quagga/Default)
80   TITLE:=IS-IS routing engine
81 endef
82
83 define Package/quagga-ospfd
84   $(call Package/quagga/Default)
85   DEPENDS+=+quagga-libospf +quagga-libzebra
86   TITLE:=OSPFv2 routing engine
87 endef
88
89 define Package/quagga-ospf6d
90   $(call Package/quagga/Default)
91   DEPENDS+=+quagga-libospf +quagga-libzebra @IPV6
92   TITLE:=OSPFv3 routing engine
93 endef
94
95 define Package/quagga-ripd
96   $(call Package/quagga/Default)
97   DEPENDS+=+quagga-libzebra
98   TITLE:=RIP routing engine
99 endef
100
101 define Package/quagga-ripngd
102   $(call Package/quagga/Default)
103   DEPENDS+=+quagga-libzebra @BROKEN
104   TITLE:=RIPNG routing engine
105 endef
106
107 define Package/quagga-vtysh
108   $(call Package/quagga/Default)
109   DEPENDS+=quagga-libzebra +libreadline +libncurses
110   TITLE:=integrated shell for Quagga routing software
111 endef
112
113 define Package/quagga/conffiles
114 /etc/quagga/zebra.conf
115 endef
116
117 define Package/quagga-bgpd/conffiles
118 /etc/quagga/bgpd.conf
119 endef
120
121 define Package/quagga-isisd/conffiles
122 /etc/quagga/isisd.conf
123 endef
124
125 define Package/quagga-ospfd/conffiles
126 /etc/quagga/ospfd.conf
127 endef
128
129 define Package/quagga-ospf6d/conffiles
130 /etc/quagga/ospf6d.conf
131 endef
132
133 define Package/quagga-ripd/conffiles
134 /etc/quagga/ripd.conf
135 endef
136
137 define Package/quagga-ripngd/conffiles
138 /etc/quagga/ripngd.conf
139 endef
140
141 CONFIGURE_ARGS+= \
142         --localstatedir=/var/run/quagga \
143         --sysconfdir=/etc/quagga/ \
144         --enable-shared \
145         --disable-static \
146         --enable-vtysh \
147         --enable-user=quagga \
148         --enable-group=quagga \
149         --enable-pie=no \
150         --enable-multipath=8 \
151
152 ifneq ($(CONFIG_PACKAGE_quagga-isisd),)
153   CONFIGURE_ARGS+= --enable-isisd
154 endif
155
156 ifneq ($(CONFIG_PACKAGE_quagga-ripngd),)
157   CONFIGURE_ARGS+= --enable-ripngd
158 endif
159
160 define Build/Configure
161         (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
162         );
163         $(call Build/Configure/Default)
164 endef
165
166 define Package/quagga/install
167         $(INSTALL_DIR) $(1)/usr/sbin
168         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
169         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/
170         # avoid /etc being set to 0750
171         $(INSTALL_DIR) $(1)/etc/quagga
172         chmod 0750 $(1)/etc/quagga
173         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/zebra.conf
174         $(INSTALL_DIR) $(1)/etc/init.d
175         $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init
176         $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga
177 endef
178
179 define Package/quagga/postinst
180 #!/bin/sh
181
182 name=quagga
183 id=51
184
185 # do not change below
186 # check if we are on real system
187 if [ -z "$${IPKG_INSTROOT}" ]; then
188         # create copies of passwd and group, if we use squashfs
189         rootfs=`mount |awk '/root/ { print $$5 }'`
190         if [ "$$rootfs" = "squashfs" ]; then
191                 if [ -h /etc/group ]; then
192                         rm /etc/group
193                         cp /rom/etc/group /etc/group
194                 fi
195                 if [ -h /etc/passwd ]; then
196                         rm /etc/passwd
197                         cp /rom/etc/passwd /etc/passwd
198                 fi
199         fi
200 fi
201
202 echo ""
203 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
204         echo "adding group $$name to /etc/group"
205         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
206 fi
207
208 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
209         echo "adding user $$name to /etc/passwd"
210         echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
211 fi
212
213 grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
214 if [ $$? -ne 0 ]; then
215 echo "zebrasrv      2600/tcp" >>$${IPKG_INSTROOT}/etc/services
216 echo "zebra         2601/tcp" >>$${IPKG_INSTROOT}/etc/services
217 echo "ripd          2602/tcp" >>$${IPKG_INSTROOT}/etc/services
218 echo "ripngd        2603/tcp" >>$${IPKG_INSTROOT}/etc/services
219 echo "ospfd         2604/tcp" >>$${IPKG_INSTROOT}/etc/services
220 echo "bgpd          2605/tcp" >>$${IPKG_INSTROOT}/etc/services
221 echo "ospf6d        2606/tcp" >>$${IPKG_INSTROOT}/etc/services
222 echo "ospfapi       2607/tcp" >>$${IPKG_INSTROOT}/etc/services
223 echo "isisd         2608/tcp" >>$${IPKG_INSTROOT}/etc/services
224 fi
225 endef
226
227 define Package/quagga-bgpd/install
228         $(INSTALL_DIR) $(1)/usr/sbin
229         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/
230         $(INSTALL_DIR) $(1)/etc/quagga
231         chmod 0750 $(1)/etc/quagga
232         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/bgpd.conf
233 endef
234
235 define Package/quagga-isisd/install
236         $(INSTALL_DIR) $(1)/usr/sbin
237         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin/
238         $(INSTALL_DIR) $(1)/etc/quagga
239         chmod 0750 $(1)/etc/quagga
240         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/isisd.conf
241 endef
242
243 define Package/quagga-ospfd/install
244         $(INSTALL_DIR) $(1)/usr/sbin
245         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/
246         $(INSTALL_DIR) $(1)/etc/quagga
247         chmod 0750 $(1)/etc/quagga
248         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospfd.conf
249 endef
250
251 define Package/quagga-ospf6d/install
252         $(INSTALL_DIR) $(1)/usr/sbin
253         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/
254         $(INSTALL_DIR) $(1)/etc/quagga
255         chmod 0750 $(1)/etc/quagga
256         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospf6d.conf
257 endef
258
259 define Package/quagga-ripd/install
260         $(INSTALL_DIR) $(1)/usr/sbin
261         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/
262         $(INSTALL_DIR) $(1)/etc/quagga
263         chmod 0750 $(1)/etc/quagga
264         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripd.conf
265 endef
266
267 define Package/quagga-ripngd/install
268         $(INSTALL_DIR) $(1)/usr/sbin
269         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/
270         $(INSTALL_DIR) $(1)/etc/quagga
271         chmod 0750 $(1)/etc/quagga
272         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf
273 endef
274
275 define Package/quagga-vtysh/install
276         $(INSTALL_DIR) $(1)/usr/bin
277         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
278 endef
279
280 define Package/quagga-libospf/install
281         $(INSTALL_DIR) $(1)/usr/lib
282         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/
283 endef
284
285 define Package/quagga-libzebra/install
286         $(INSTALL_DIR) $(1)/usr/lib
287         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib/
288 endef
289
290 $(eval $(call BuildPackage,quagga))
291 $(eval $(call BuildPackage,quagga-libzebra))
292 $(eval $(call BuildPackage,quagga-libospf))
293 $(eval $(call BuildPackage,quagga-bgpd))
294 $(eval $(call BuildPackage,quagga-isisd))
295 $(eval $(call BuildPackage,quagga-ospfd))
296 $(eval $(call BuildPackage,quagga-ospf6d))
297 $(eval $(call BuildPackage,quagga-ripd))
298 $(eval $(call BuildPackage,quagga-ripngd))
299 $(eval $(call BuildPackage,quagga-vtysh))