Add vnstati (#4311)
[openwrt/svn-archive/archive.git] / net / quagga / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=quagga
12 PKG_VERSION:=0.98.6
13 PKG_RELEASE:=1
14 PKG_MD5SUM:=b0d4132039953a0214256873b7d23d68
15
16 PKG_SOURCE_URL:=http://www.quagga.net/download/ \
17 http://www.de.quagga.net/download/ \
18 http://www.uk.quagga.net/download/
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/quagga/Default
25 SECTION:=net
26 CATEGORY:=Network
27 DEPENDS:=quagga
28 TITLE:=The Quagga Software Routing Suite
29 URL:=http://www.quagga.net
30 endef
31
32 define Package/quagga
33 $(call Package/quagga/Default)
34 DEPENDS:=
35 MENU:=1
36 endef
37
38 define Package/quagga/description
39 A routing software package that provides TCP/IP based routing services
40 with routing protocols support such as RIPv1, RIPv2, RIPng, OSPFv2,
41 OSPFv3, BGP-4, and BGP-4+
42
43 endef
44
45 define Package/quagga-libzebra
46 $(call Package/quagga/Default)
47 TITLE:=zebra library
48 endef
49
50 define Package/quagga-libospf
51 $(call Package/quagga/Default)
52 TITLE:=OSPF library
53 endef
54
55 define Package/quagga-bgpd
56 $(call Package/quagga/Default)
57 DEPENDS += quagga-libzebra
58 TITLE:=BGPv4, BGPv4+, BGPv4- routing engine
59 endef
60
61 define Package/quagga-isisd
62 $(call Package/quagga/Default)
63 TITLE:=IS-IS routing engine
64 endef
65
66 define Package/quagga-ospfd
67 $(call Package/quagga/Default)
68 DEPENDS += quagga-libospf quagga-libzebra
69 TITLE:=OSPFv2 routing engine
70 endef
71
72 define Package/quagga-ospf6d
73 $(call Package/quagga/Default)
74 DEPENDS += quagga-libospf quagga-libzebra
75 TITLE:=OSPFv3 routing engine
76 endef
77
78 define Package/quagga-ripd
79 $(call Package/quagga/Default)
80 DEPENDS += quagga-libzebra
81 TITLE:=RIP routing engine
82 endef
83
84 define Package/quagga-ripngd
85 $(call Package/quagga/Default)
86 DEPENDS += quagga-libzebra
87 TITLE:=RIPNG routing engine
88 endef
89
90 define Package/quagga-vtysh
91 $(call Package/quagga/Default)
92 DEPENDS += quagga-libzebra +libreadline +libncurses
93 TITLE:=integrated shell for Quagga routing software
94 endef
95
96 define Build/Configure
97 $(call Build/Configure/Default, \
98 --localstatedir=/var/run/quagga \
99 --sysconfdir=/etc/quagga/ \
100 --enable-shared \
101 --disable-static \
102 --enable-ipv6 \
103 --enable-vtysh \
104 --enable-user=quagga \
105 --enable-group=quagga \
106 --enable-multipath=8 \
107 --enable-isisd \
108 )
109 endef
110
111 define Build/Compile
112 $(MAKE) -C $(PKG_BUILD_DIR) \
113 DESTDIR=$(PKG_INSTALL_DIR) \
114 all install
115 endef
116
117 define Package/quagga/install
118 $(INSTALL_DIR) $(1)/usr/sbin
119 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
120 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/
121 # avoid /etc being set to 0750
122 $(INSTALL_DIR) $(1)/etc/quagga/
123 chmod 0750 $(1)/etc/quagga/
124 $(INSTALL_DIR) $(1)/etc/init.d/
125 $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init
126 $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga
127 $(INSTALL_DIR) $(1)/var/run/quagga
128 endef
129
130 define Package/quagga/postinst
131 #!/bin/sh
132
133 name=quagga
134 id=51
135
136 # do not change below
137 # check if we are on real system
138 if [ -z "$${IPKG_INSTROOT}" ]; then
139 # create copies of passwd and group, if we use squashfs
140 rootfs=`mount |awk '/root/ { print $$5 }'`
141 if [ "$$rootfs" = "squashfs" ]; then
142 if [ -h /etc/group ]; then
143 rm /etc/group
144 cp /rom/etc/group /etc/group
145 fi
146 if [ -h /etc/passwd ]; then
147 rm /etc/passwd
148 cp /rom/etc/passwd /etc/passwd
149 fi
150 fi
151 fi
152
153 echo ""
154 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
155 echo "adding group $$name to /etc/group"
156 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
157 fi
158
159 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
160 echo "adding user $$name to /etc/passwd"
161 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
162 fi
163
164 grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
165 if [ $$? -ne 0 ]; then
166 echo "zebrasrv 2600/tcp" >>$${IPKG_INSTROOT}/etc/services
167 echo "zebra 2601/tcp" >>$${IPKG_INSTROOT}/etc/services
168 echo "ripd 2602/tcp" >>$${IPKG_INSTROOT}/etc/services
169 echo "ripngd 2603/tcp" >>$${IPKG_INSTROOT}/etc/services
170 echo "ospfd 2604/tcp" >>$${IPKG_INSTROOT}/etc/services
171 echo "bgpd 2605/tcp" >>$${IPKG_INSTROOT}/etc/services
172 echo "ospf6d 2606/tcp" >>$${IPKG_INSTROOT}/etc/services
173 echo "ospfapi 2607/tcp" >>$${IPKG_INSTROOT}/etc/services
174 echo "isisd 2608/tcp" >>$${IPKG_INSTROOT}/etc/services
175 fi
176 endef
177
178 define Package/quagga-bgpd/install
179 $(INSTALL_DIR) $(1)/usr/sbin
180 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/
181 endef
182
183 define Package/quagga-isisd/install
184 $(INSTALL_DIR) $(1)/usr/sbin
185 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin
186 endef
187
188 define Package/quagga-ospfd/install
189 $(INSTALL_DIR) $(1)/usr/sbin
190 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/
191 endef
192
193 define Package/quagga-ospf6d/install
194 $(INSTALL_DIR) $(1)/usr/sbin
195 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/
196 endef
197
198 define Package/quagga-ripd/install
199 $(INSTALL_DIR) $(1)/usr/sbin
200 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/
201 endef
202
203 define Package/quagga-ripngd/install
204 $(INSTALL_DIR) $(1)/usr/sbin
205 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/
206 endef
207
208 define Package/quagga-vtysh/install
209 $(INSTALL_DIR) $(1)/usr/bin
210 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
211 endef
212
213 define Package/quagga-libospf/install
214 $(INSTALL_DIR) $(1)/usr/lib
215 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/
216 endef
217
218 define Package/quagga-libzebra/install
219 $(INSTALL_DIR) $(1)/usr/lib
220 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib
221 endef
222
223 $(eval $(call BuildPackage,quagga))
224 $(eval $(call BuildPackage,quagga-libzebra))
225 $(eval $(call BuildPackage,quagga-libospf))
226 $(eval $(call BuildPackage,quagga-bgpd))
227 $(eval $(call BuildPackage,quagga-isisd))
228 $(eval $(call BuildPackage,quagga-ospfd))
229 $(eval $(call BuildPackage,quagga-ospf6d))
230 $(eval $(call BuildPackage,quagga-ripd))
231 $(eval $(call BuildPackage,quagga-ripngd))
232 $(eval $(call BuildPackage,quagga-vtysh))