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