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