bird-openwrt: update to version 0.3
[feed/routing.git] / bird-openwrt / bird6-openwrt / Makefile
1 # Copyright (C) 2014-2017 Eloi Carbo <eloicaso@openmailbox.org>
2 #
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 #
16
17 include $(TOPDIR)/rules.mk
18 include $(INCLUDE_DIR)/kernel.mk
19
20 BIRD := bird6
21 PKG_NAME := $(BIRD)-openwrt
22 PKG_VERSION := 0.3
23 PKG_RELEASE := 1
24 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
25 PKG_LICENSE := GPL-3.0+
26 uci := $(BIRD)-uci
27 luci := luci-app-$(BIRD)
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/bird-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)/conffiles
51 /etc/config/$(BIRD)
52 endef
53
54 define Package/$(uci)/install
55 $(INSTALL_DIR) $(1)/etc/$(BIRD)/init.d
56 $(INSTALL_DIR) $(1)/etc/config
57 $(INSTALL_DIR) $(1)/etc/$(BIRD)/filters
58 $(INSTALL_DIR) $(1)/etc/$(BIRD)/functions
59 $(INSTALL_BIN) ./src/init.d/$(BIRD)* $(1)/etc/$(BIRD)/init.d/
60 $(CP) ./src/uci-defaults/* $(1)/etc/$(BIRD)/init.d/
61 $(INSTALL_CONF) ./src/config/$(BIRD) $(1)/etc/config/
62 endef
63
64 define Package/$(uci)/postinst
65 #!/bin/sh
66 if [ -z "$${IPKG_INSTROOT}" ]; then
67 ( . /etc/$(BIRD)/init.d/bird-uci-install-init.d $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/bird-uci-install-init.d
68 ( . /etc/$(BIRD)/init.d/99-relocate-filters $(BIRD) ) && rm -f /etc/$(BIRD)/init.d/99-relocate-filters
69 if [ -f /etc/sysupgrade.conf ] && ! grep $(BIRD) /etc/sysupgrade.conf; then
70 echo /etc/config/$(BIRD) >> /etc/sysupgrade.conf
71 echo /etc/$(BIRD)/filters/ >> /etc/sysupgrade.conf
72 echo /etc/$(BIRD)/functions/ >> /etc/sysupgrade.conf
73 fi
74 fi
75 endef
76
77 $(eval $(call BuildPackage,$(uci)))
78
79 define Package/$(luci)
80 TITLE:=LuCI support for $(BIRD)
81 SECTION:=luci
82 CATEGORY:=LuCI
83 SUBMENU:=3. Applications
84 MAINTAINER:=Eloi Carbo <eloicaso@openmailbox.org>
85 URL:=https://github.com/eloicaso/bird-openwrt/
86 DEPENDS:=+$(BIRD)-uci +luci-base
87 endef
88
89 define Package/$(luci)/description
90 $(BIRD) application for LuCI
91 endef
92
93 define Package/$(luci)/install
94 $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
95 $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
96 $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/$(BIRD)/
97 $(CP) ./src/model/* $(1)/usr/lib/lua/luci/model/cbi/$(BIRD)/
98 $(CP) ./src/controller/* $(1)/usr/lib/lua/luci/controller/
99 $(CP) ./src/view/* $(1)/usr/lib/lua/luci/view/$(BIRD)/
100 endef
101
102 $(eval $(call BuildPackage,$(luci)))