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