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