• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#  Copyright (c) 2020, The OpenThread Authors.
3#  All rights reserved.
4#
5#  Redistribution and use in source and binary forms, with or without
6#  modification, are permitted provided that the following conditions are met:
7#  1. Redistributions of source code must retain the above copyright
8#     notice, this list of conditions and the following disclaimer.
9#  2. Redistributions in binary form must reproduce the above copyright
10#     notice, this list of conditions and the following disclaimer in the
11#     documentation and/or other materials provided with the distribution.
12#  3. Neither the name of the copyright holder nor the
13#     names of its contributors may be used to endorse or promote products
14#     derived from this software without specific prior written permission.
15#
16#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26#  POSSIBILITY OF SUCH DAMAGE.
27#
28
29LOCAL_SOURCE_DIR:=$(abspath $(realpath $(dir $(lastword $(MAKEFILE_LIST))))/../../..)
30
31include $(TOPDIR)/rules.mk
32
33PKG_NAME:=openthread-br
34PKG_LICENSE:=BSD-3-Clause
35PKG_LICENSE_FILES:=LICENSE
36PKG_RELEASE:=1
37PKG_VERSION:=1.0
38
39include $(INCLUDE_DIR)/package.mk
40include $(INCLUDE_DIR)/cmake.mk
41
42CMAKE_SOURCE_DIR=$(LOCAL_SOURCE_DIR)
43CMAKE_OPTIONS+= \
44	-DBUILD_TESTING=OFF \
45	-DCMAKE_INSTALL_PREFIX=/usr \
46	-DOTBR_BORDER_AGENT=ON \
47	-DOTBR_BORDER_ROUTING=ON \
48	-DOTBR_INFRA_IF_NAME=\"br-lan\" \
49	-DOTBR_MDNS="avahi" \
50	-DOTBR_OPENWRT=ON \
51	-DOTBR_SRP_ADVERTISING_PROXY=ON \
52	-DOT_FIREWALL=ON \
53	-DOT_POSIX_SETTINGS_PATH=\"/etc/openthread\" \
54	-DOT_READLINE=OFF \
55	-DOTBR_NAT64=OFF \
56	-DNAT64_SERVICE=\"openthread\"
57
58TARGET_CFLAGS += -DOPENTHREAD_POSIX_CONFIG_DAEMON_SOCKET_BASENAME=\\\"/var/run/openthread-%s\\\"
59
60define Package/openthread-br
61	SECTION:=base
62	CATEGORY:=Network
63	TITLE:=OpenThread Border Router
64	DEPENDS:=+libstdcpp +libjson-c +libubus +libblobmsg-json +libavahi-client +avahi-daemon +iptables-mod-extra +ipset
65endef
66
67define Package/openthread-br/description
68    A Thread border router for POSIX-based platforms.
69endef
70
71define Package/openthread-br/install
72	$(INSTALL_DIR) $(1)/usr/sbin
73	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/otbr-agent $(1)/usr/sbin
74	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ot-ctl $(1)/usr/sbin
75
76	$(INSTALL_DIR) $(1)/etc/init.d
77	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/init.d/* $(1)/etc/init.d
78
79	$(INSTALL_DIR) $(1)/etc/config
80	$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/config/* $(1)/etc/config
81
82	$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/admin
83	$(INSTALL_BIN) $(LOCAL_SOURCE_DIR)/src/openwrt/controller/thread.lua $(1)/usr/lib/lua/luci/controller/admin
84
85	$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view
86	$(CP) $(LOCAL_SOURCE_DIR)/src/openwrt/view/admin_thread $(1)/usr/lib/lua/luci/view
87
88	$(INSTALL_DIR) $(1)/www/luci-static/resources
89	$(CP) $(LOCAL_SOURCE_DIR)/src/openwrt/handle_error.js $(1)/www/luci-static/resources
90endef
91
92$(eval $(call BuildPackage,openthread-br))
93