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