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