16198e41ce7870d9f09d93441620d2fabe0f7d61
[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.13
12 PKG_RELEASE:=1
13 PKG_MD5SUM:=55a7d2dcf016580a7c7412b3518cd942
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
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-ipv6 \
101 --enable-vtysh \
102 --enable-user=quagga \
103 --enable-group=quagga \
104 --enable-multipath=8 \
105 --enable-isisd \
106 )
107 endef
108
109 define Build/Compile
110 $(MAKE) -C $(PKG_BUILD_DIR) \
111 DESTDIR=$(PKG_INSTALL_DIR) \
112 all install
113 endef
114
115 define Package/quagga-unstable/install
116 $(INSTALL_DIR) $(1)/usr/sbin
117 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
118 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/
119 # avoid /etc being set to 0750
120 $(INSTALL_DIR) $(1)/etc/quagga/
121 chmod 0750 $(1)/etc/quagga/
122 $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/zebra.conf
123 $(INSTALL_DIR) $(1)/etc/init.d/
124 $(INSTALL_BIN) ./files/quagga $(1)/usr/sbin/quagga.init
125 $(INSTALL_BIN) ./files/quagga.init $(1)/etc/init.d/quagga
126 $(INSTALL_DIR) $(1)/var/run/quagga
127 endef
128
129 define Package/quagga-unstable/postinst
130 #!/bin/sh
131
132 name=quagga
133 id=51
134
135 # do not change below
136 # check if we are on real system
137 if [ -z "$${IPKG_INSTROOT}" ]; then
138 # create copies of passwd and group, if we use squashfs
139 rootfs=`mount |awk '/root/ { print $$5 }'`
140 if [ "$$rootfs" = "squashfs" ]; then
141 if [ -h /etc/group ]; then
142 rm /etc/group
143 cp /rom/etc/group /etc/group
144 fi
145 if [ -h /etc/passwd ]; then
146 rm /etc/passwd
147 cp /rom/etc/passwd /etc/passwd
148 fi
149 fi
150 fi
151
152 echo ""
153 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
154 echo "adding group $$name to /etc/group"
155 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
156 fi
157
158 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
159 echo "adding user $$name to /etc/passwd"
160 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
161 fi
162
163 grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
164 if [ $$? -ne 0 ]; then
165 echo "zebrasrv 2600/tcp" >>$${IPKG_INSTROOT}/etc/services
166 echo "zebra 2601/tcp" >>$${IPKG_INSTROOT}/etc/services
167 echo "ripd 2602/tcp" >>$${IPKG_INSTROOT}/etc/services
168 echo "ripngd 2603/tcp" >>$${IPKG_INSTROOT}/etc/services
169 echo "ospfd 2604/tcp" >>$${IPKG_INSTROOT}/etc/services
170 echo "bgpd 2605/tcp" >>$${IPKG_INSTROOT}/etc/services
171 echo "ospf6d 2606/tcp" >>$${IPKG_INSTROOT}/etc/services
172 echo "ospfapi 2607/tcp" >>$${IPKG_INSTROOT}/etc/services
173 echo "isisd 2608/tcp" >>$${IPKG_INSTROOT}/etc/services
174 fi
175 endef
176
177 define Package/quagga-unstable-bgpd/install
178 $(INSTALL_DIR) $(1)/usr/sbin
179 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/
180 $(INSTALL_DIR) $(1)/etc/quagga/
181 chmod 0750 $(1)/etc/quagga/
182 $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/bgpd.conf
183 endef
184
185 define Package/quagga-unstable-isisd/install
186 $(INSTALL_DIR) $(1)/usr/sbin
187 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin
188 $(INSTALL_DIR) $(1)/etc/quagga/
189 chmod 0750 $(1)/etc/quagga/
190 $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/isisd.conf
191 endef
192
193 define Package/quagga-unstable-ospfd/install
194 $(INSTALL_DIR) $(1)/usr/sbin
195 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/
196 $(INSTALL_DIR) $(1)/etc/quagga/
197 chmod 0750 $(1)/etc/quagga/
198 $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ospfd.conf
199 endef
200
201 define Package/quagga-unstable-ospf6d/install
202 $(INSTALL_DIR) $(1)/usr/sbin
203 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/
204 $(INSTALL_DIR) $(1)/etc/quagga/
205 chmod 0750 $(1)/etc/quagga/
206 $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ospf6d.conf
207 endef
208
209 define Package/quagga-unstable-ripd/install
210 $(INSTALL_DIR) $(1)/usr/sbin
211 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/
212 $(INSTALL_DIR) $(1)/etc/quagga/
213 chmod 0750 $(1)/etc/quagga/
214 $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ripd.conf
215 endef
216
217 define Package/quagga-unstable-ripngd/install
218 $(INSTALL_DIR) $(1)/usr/sbin
219 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/
220 $(INSTALL_DIR) $(1)/etc/quagga/
221 chmod 0750 $(1)/etc/quagga/
222 $(INSTALL_DATA) ./files/quagga.conf $(1)/etc/quagga/ripngd.conf
223 endef
224
225 define Package/quagga-unstable-vtysh/install
226 $(INSTALL_DIR) $(1)/usr/bin
227 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
228 endef
229
230 define Package/quagga-unstable-libospf/install
231 $(INSTALL_DIR) $(1)/usr/lib
232 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/
233 endef
234
235 define Package/quagga-unstable-libzebra/install
236 $(INSTALL_DIR) $(1)/usr/lib
237 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib
238 endef
239
240 $(eval $(call BuildPackage,quagga-unstable))
241 $(eval $(call BuildPackage,quagga-unstable-libzebra))
242 $(eval $(call BuildPackage,quagga-unstable-libospf))
243 $(eval $(call BuildPackage,quagga-unstable-bgpd))
244 $(eval $(call BuildPackage,quagga-unstable-isisd))
245 $(eval $(call BuildPackage,quagga-unstable-ospfd))
246 $(eval $(call BuildPackage,quagga-unstable-ospf6d))
247 $(eval $(call BuildPackage,quagga-unstable-ripd))
248 $(eval $(call BuildPackage,quagga-unstable-ripngd))
249 $(eval $(call BuildPackage,quagga-unstable-vtysh))