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