bird-openwrt: BIRD daemon integration with UCI and LuCI configuration
[feed/routing.git] / bird-openwrt / bird4-openwrt / Makefile
1 # Copyright (C) 2014 - Eloi Carbó Solé (GSoC2014)
2 # BGP/Bird integration with OpenWRT and QMP
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
17
18 include $(TOPDIR)/rules.mk
19 include $(INCLUDE_DIR)/kernel.mk
20
21 BIRD:=bird4
22 PKG_NAME:=$(BIRD)-openwrt
23 PKG_RELEASE:=0.2
24 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
25 uci:=$(BIRD)-uci
26 luci:=luci-app-$(BIRD)
27
28
29 include $(INCLUDE_DIR)/package.mk
30
31 define Build/Prepare
32 endef
33 define Build/Compile
34 endef
35
36 define Package/$(uci)
37 TITLE:=The BIRD UCI module
38 SECTION:=net
39 CATEGORY:=Network
40 SUBMENU:=Routing and Redirection
41 MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
42 URL:=https://github.com/eloicaso/bird4-openwrt/
43 DEPENDS:=+$(BIRD) +libuci +uci
44 endef
45
46 define Package/$(uci)/description
47 $(BIRD) UCI integration module
48 endef
49
50 define Package/$(uci)/install
51 $(INSTALL_DIR) $(1)/etc/$(BIRD)/init.d
52 $(INSTALL_DIR) $(1)/etc/config
53 $(INSTALL_BIN) ./src/init.d/$(BIRD) $(1)/etc/$(BIRD)/init.d/
54 $(CP) ./src/uci-defaults/$(uci)-install-init.d $(1)/etc/$(BIRD)/init.d/
55 $(CP) ./src/config/$(BIRD) $(1)/etc/config/
56 endef
57
58 define Package/$(uci)/postinst
59 #!/bin/sh
60 if [ -z $${IPKG_INSTROOT} ]; then
61 ( . /etc/bird4/init.d/bird4-uci-install-init.d ) && rm -f /etc/bird4/init.d/bird4-uci-install-init.d
62 fi
63 endef
64
65 $(eval $(call BuildPackage,$(uci)))
66
67
68
69 define Package/$(luci)
70 TITLE:=LuCI support for $(BIRD)
71 SECTION:=luci
72 CATEGORY:=LuCI
73 SUBMENU:=3. Applications
74 MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
75 URL:=https://github.com/eloicaso/bird4-openwrt/
76 DEPENDS:=+$(BIRD)-uci +luci-base
77 endef
78
79 define Package/$(luci)/description
80 $(BIRD) application for LuCI
81 endef
82
83 define Package/$(luci)/install
84 $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
85 $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
86 $(CP) ./src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
87 $(CP) ./src/controller/* $(1)/usr/lib/lua/luci/controller/
88 endef
89
90 $(eval $(call BuildPackage,$(luci)))