f6d2f393ebee0d1d071ea2c0855df6c215742dbd
[openwrt/svn-archive/archive.git] / net / quagga-unstable / 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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=quagga-unstable
11 PKG_VERSION:=0.99.11
12 PKG_RELEASE:=2
13 PKG_MD5SUM:=903e40c744730ad4d62bee872eeb813b
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
42 endef
43
44 define Package/quagga-unstable-libzebra
45 $(call Package/quagga-unstable/Default)
46 TITLE:=zebra library
47 endef
48
49 define Package/quagga-unstable-libospf
50 $(call Package/quagga-unstable/Default)
51 TITLE:=OSPF library
52 endef
53
54 define Package/quagga-unstable-bgpd
55 $(call Package/quagga-unstable/Default)
56 DEPENDS += quagga-unstable-libzebra
57 TITLE:=BGPv4, BGPv4+, BGPv4- routing engine
58 endef
59
60 define Package/quagga-unstable-isisd
61 $(call Package/quagga-unstable/Default)
62 TITLE:=IS-IS routing engine
63 endef
64
65 define Package/quagga-unstable-ospfd
66 $(call Package/quagga-unstable/Default)
67 DEPENDS += quagga-unstable-libospf quagga-unstable-libzebra
68 TITLE:=OSPFv2 routing engine
69 endef
70
71 define Package/quagga-unstable-ospf6d
72 $(call Package/quagga-unstable/Default)
73 DEPENDS += quagga-unstable-libospf quagga-unstable-libzebra
74 TITLE:=OSPFv3 routing engine
75 endef
76
77 define Package/quagga-unstable-ripd
78 $(call Package/quagga-unstable/Default)
79 DEPENDS += quagga-unstable-libzebra
80 TITLE:=RIP routing engine
81 endef
82
83 define Package/quagga-unstable-ripngd
84 $(call Package/quagga-unstable/Default)
85 DEPENDS += quagga-unstable-libzebra
86 TITLE:=RIPNG routing engine
87 endef
88
89 define Package/quagga-unstable-vtysh
90 $(call Package/quagga-unstable/Default)
91 DEPENDS += quagga-unstable-libzebra +libreadline +libncurses
92 TITLE:=integrated shell for Quagga routing software
93 endef
94
95 define Build/Configure
96 $(call Build/Configure/Default, \
97 --localstatedir=/var/run/quagga \
98 --sysconfdir=/etc/quagga/ \
99 --enable-shared \
100 --disable-static \
101 --enable-ipv6 \
102 --enable-vtysh \
103 --enable-user=quagga \
104 --enable-group=quagga \
105 --enable-multipath=8 \
106 --enable-isisd \
107 )
108 endef
109
110 define Build/Compile
111 $(MAKE) -C $(PKG_BUILD_DIR) \
112 DESTDIR=$(PKG_INSTALL_DIR) \
113 all install
114 endef
115
116 define Package/quagga-unstable/install
117 $(INSTALL_DIR) $(1)/usr/sbin
118 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zebra $(1)/usr/sbin/
119 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/watchquagga $(1)/usr/sbin/
120 # avoid /etc being set to 0750
121 $(INSTALL_DIR) $(1)/etc/quagga/
122 chmod 0750 $(1)/etc/quagga/
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 endef
181
182 define Package/quagga-unstable-isisd/install
183 $(INSTALL_DIR) $(1)/usr/sbin
184 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/isisd $(1)/usr/sbin
185 endef
186
187 define Package/quagga-unstable-ospfd/install
188 $(INSTALL_DIR) $(1)/usr/sbin
189 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospfd $(1)/usr/sbin/
190 endef
191
192 define Package/quagga-unstable-ospf6d/install
193 $(INSTALL_DIR) $(1)/usr/sbin
194 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ospf6d $(1)/usr/sbin/
195 endef
196
197 define Package/quagga-unstable-ripd/install
198 $(INSTALL_DIR) $(1)/usr/sbin
199 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripd $(1)/usr/sbin/
200 endef
201
202 define Package/quagga-unstable-ripngd/install
203 $(INSTALL_DIR) $(1)/usr/sbin
204 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ripngd $(1)/usr/sbin/
205 endef
206
207 define Package/quagga-unstable-vtysh/install
208 $(INSTALL_DIR) $(1)/usr/bin
209 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtysh $(1)/usr/bin/
210 endef
211
212 define Package/quagga-unstable-libospf/install
213 $(INSTALL_DIR) $(1)/usr/lib
214 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libospf.so.* $(1)/usr/lib/
215 endef
216
217 define Package/quagga-unstable-libzebra/install
218 $(INSTALL_DIR) $(1)/usr/lib
219 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzebra.so.* $(1)/usr/lib
220 endef
221
222 $(eval $(call BuildPackage,quagga-unstable))
223 $(eval $(call BuildPackage,quagga-unstable-libzebra))
224 $(eval $(call BuildPackage,quagga-unstable-libospf))
225 $(eval $(call BuildPackage,quagga-unstable-bgpd))
226 $(eval $(call BuildPackage,quagga-unstable-isisd))
227 $(eval $(call BuildPackage,quagga-unstable-ospfd))
228 $(eval $(call BuildPackage,quagga-unstable-ospf6d))
229 $(eval $(call BuildPackage,quagga-unstable-ripd))
230 $(eval $(call BuildPackage,quagga-unstable-ripngd))
231 $(eval $(call BuildPackage,quagga-unstable-vtysh))