net/quagga: honor configure.ac patch changes
[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:=5
14   PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68
15   PATCH_DIR:=./patches-old
16 else
17   PKG_VERSION:=0.99.17
18   PKG_RELEASE:=1
19   PKG_MD5SUM:=37b9022adca04b03863d2d79787e643f
20 endif
21
22 PKG_SOURCE:=quagga-$(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-unstable-isisd \
30         CONFIG_PACKAGE_quagga-unstable-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                 autoconf \
163         );
164         $(call Build/Configure/Default)
165 endef
166
167 define Package/quagga/install
168         $(INSTALL_DIR) $(1)/usr/sbin
169         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
170         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/
171         # avoid /etc being set to 0750
172         $(INSTALL_DIR) $(1)/etc/quagga
173         chmod 0750 $(1)/etc/quagga
174         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/zebra.conf
175         $(INSTALL_DIR) $(1)/etc/init.d
176         $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init
177         $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga
178 endef
179
180 define Package/quagga/postinst
181 #!/bin/sh
182
183 name=quagga
184 id=51
185
186 # do not change below
187 # check if we are on real system
188 if [ -z "$${IPKG_INSTROOT}" ]; then
189         # create copies of passwd and group, if we use squashfs
190         rootfs=`mount |awk '/root/ { print $$5 }'`
191         if [ "$$rootfs" = "squashfs" ]; then
192                 if [ -h /etc/group ]; then
193                         rm /etc/group
194                         cp /rom/etc/group /etc/group
195                 fi
196                 if [ -h /etc/passwd ]; then
197                         rm /etc/passwd
198                         cp /rom/etc/passwd /etc/passwd
199                 fi
200         fi
201 fi
202
203 echo ""
204 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
205         echo "adding group $$name to /etc/group"
206         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
207 fi
208
209 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
210         echo "adding user $$name to /etc/passwd"
211         echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
212 fi
213
214 grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
215 if [ $$? -ne 0 ]; then
216 echo "zebrasrv      2600/tcp" >>$${IPKG_INSTROOT}/etc/services
217 echo "zebra         2601/tcp" >>$${IPKG_INSTROOT}/etc/services
218 echo "ripd          2602/tcp" >>$${IPKG_INSTROOT}/etc/services
219 echo "ripngd        2603/tcp" >>$${IPKG_INSTROOT}/etc/services
220 echo "ospfd         2604/tcp" >>$${IPKG_INSTROOT}/etc/services
221 echo "bgpd          2605/tcp" >>$${IPKG_INSTROOT}/etc/services
222 echo "ospf6d        2606/tcp" >>$${IPKG_INSTROOT}/etc/services
223 echo "ospfapi       2607/tcp" >>$${IPKG_INSTROOT}/etc/services
224 echo "isisd         2608/tcp" >>$${IPKG_INSTROOT}/etc/services
225 fi
226 endef
227
228 define Package/quagga-bgpd/install
229         $(INSTALL_DIR) $(1)/usr/sbin
230         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/
231         $(INSTALL_DIR) $(1)/etc/quagga
232         chmod 0750 $(1)/etc/quagga
233         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/bgpd.conf
234 endef
235
236 define Package/quagga-isisd/install
237         $(INSTALL_DIR) $(1)/usr/sbin
238         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin/
239         $(INSTALL_DIR) $(1)/etc/quagga
240         chmod 0750 $(1)/etc/quagga
241         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/isisd.conf
242 endef
243
244 define Package/quagga-ospfd/install
245         $(INSTALL_DIR) $(1)/usr/sbin
246         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/
247         $(INSTALL_DIR) $(1)/etc/quagga
248         chmod 0750 $(1)/etc/quagga
249         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospfd.conf
250 endef
251
252 define Package/quagga-ospf6d/install
253         $(INSTALL_DIR) $(1)/usr/sbin
254         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/
255         $(INSTALL_DIR) $(1)/etc/quagga
256         chmod 0750 $(1)/etc/quagga
257         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ospf6d.conf
258 endef
259
260 define Package/quagga-ripd/install
261         $(INSTALL_DIR) $(1)/usr/sbin
262         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/
263         $(INSTALL_DIR) $(1)/etc/quagga
264         chmod 0750 $(1)/etc/quagga
265         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripd.conf
266 endef
267
268 define Package/quagga-ripngd/install
269         $(INSTALL_DIR) $(1)/usr/sbin
270         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/
271         $(INSTALL_DIR) $(1)/etc/quagga
272         chmod 0750 $(1)/etc/quagga
273         $(INSTALL_CONF) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf
274 endef
275
276 define Package/quagga-vtysh/install
277         $(INSTALL_DIR) $(1)/usr/bin
278         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
279 endef
280
281 define Package/quagga-libospf/install
282         $(INSTALL_DIR) $(1)/usr/lib
283         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/
284 endef
285
286 define Package/quagga-libzebra/install
287         $(INSTALL_DIR) $(1)/usr/lib
288         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib/
289 endef
290
291 $(eval $(call BuildPackage,quagga))
292 $(eval $(call BuildPackage,quagga-libzebra))
293 $(eval $(call BuildPackage,quagga-libospf))
294 $(eval $(call BuildPackage,quagga-bgpd))
295 $(eval $(call BuildPackage,quagga-isisd))
296 $(eval $(call BuildPackage,quagga-ospfd))
297 $(eval $(call BuildPackage,quagga-ospf6d))
298 $(eval $(call BuildPackage,quagga-ripd))
299 $(eval $(call BuildPackage,quagga-ripngd))
300 $(eval $(call BuildPackage,quagga-vtysh))