191e8c9e52b3d7e07d90c4482dd214ea4818c1cf
[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.12
12 PKG_RELEASE:=2
13 PKG_MD5SUM:=d2bb513f4ac113dbb300c15a0bd0a241
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:=
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_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 $(INSTALL_DIR) $(1)/var/run/quagga
126 endef
127
128 define Package/quagga-unstable/postinst
129 #!/bin/sh
130
131 name=quagga
132 id=51
133
134 # do not change below
135 # check if we are on real system
136 if [ -z "$${IPKG_INSTROOT}" ]; then
137 # create copies of passwd and group, if we use squashfs
138 rootfs=`mount |awk '/root/ { print $$5 }'`
139 if [ "$$rootfs" = "squashfs" ]; then
140 if [ -h /etc/group ]; then
141 rm /etc/group
142 cp /rom/etc/group /etc/group
143 fi
144 if [ -h /etc/passwd ]; then
145 rm /etc/passwd
146 cp /rom/etc/passwd /etc/passwd
147 fi
148 fi
149 fi
150
151 echo ""
152 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
153 echo "adding group $$name to /etc/group"
154 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
155 fi
156
157 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
158 echo "adding user $$name to /etc/passwd"
159 echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
160 fi
161
162 grep -q '^zebra[[:space:]]*2601/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
163 if [ $$? -ne 0 ]; then
164 echo "zebrasrv 2600/tcp" >>$${IPKG_INSTROOT}/etc/services
165 echo "zebra 2601/tcp" >>$${IPKG_INSTROOT}/etc/services
166 echo "ripd 2602/tcp" >>$${IPKG_INSTROOT}/etc/services
167 echo "ripngd 2603/tcp" >>$${IPKG_INSTROOT}/etc/services
168 echo "ospfd 2604/tcp" >>$${IPKG_INSTROOT}/etc/services
169 echo "bgpd 2605/tcp" >>$${IPKG_INSTROOT}/etc/services
170 echo "ospf6d 2606/tcp" >>$${IPKG_INSTROOT}/etc/services
171 echo "ospfapi 2607/tcp" >>$${IPKG_INSTROOT}/etc/services
172 echo "isisd 2608/tcp" >>$${IPKG_INSTROOT}/etc/services
173 fi
174 endef
175
176 define Package/quagga-unstable-bgpd/install
177 $(INSTALL_DIR) $(1)/usr/sbin
178 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/bgpd $(1)/usr/sbin/
179 endef
180
181 define Package/quagga-unstable-isisd/install
182 $(INSTALL_DIR) $(1)/usr/sbin
183 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin
184 endef
185
186 define Package/quagga-unstable-ospfd/install
187 $(INSTALL_DIR) $(1)/usr/sbin
188 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/
189 endef
190
191 define Package/quagga-unstable-ospf6d/install
192 $(INSTALL_DIR) $(1)/usr/sbin
193 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/
194 endef
195
196 define Package/quagga-unstable-ripd/install
197 $(INSTALL_DIR) $(1)/usr/sbin
198 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/
199 endef
200
201 define Package/quagga-unstable-ripngd/install
202 $(INSTALL_DIR) $(1)/usr/sbin
203 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/
204 endef
205
206 define Package/quagga-unstable-vtysh/install
207 $(INSTALL_DIR) $(1)/usr/bin
208 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
209 endef
210
211 define Package/quagga-unstable-libospf/install
212 $(INSTALL_DIR) $(1)/usr/lib
213 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/
214 endef
215
216 define Package/quagga-unstable-libzebra/install
217 $(INSTALL_DIR) $(1)/usr/lib
218 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib
219 endef
220
221 $(eval $(call BuildPackage,quagga-unstable))
222 $(eval $(call BuildPackage,quagga-unstable-libzebra))
223 $(eval $(call BuildPackage,quagga-unstable-libospf))
224 $(eval $(call BuildPackage,quagga-unstable-bgpd))
225 $(eval $(call BuildPackage,quagga-unstable-isisd))
226 $(eval $(call BuildPackage,quagga-unstable-ospfd))
227 $(eval $(call BuildPackage,quagga-unstable-ospf6d))
228 $(eval $(call BuildPackage,quagga-unstable-ripd))
229 $(eval $(call BuildPackage,quagga-unstable-ripngd))
230 $(eval $(call BuildPackage,quagga-unstable-vtysh))