Squashed 'smartdns/' content from commit 5514f3d
git-subtree-dir: smartdns git-subtree-split: 5514f3d41c72d6bdea89e72f8c4546f6376cb44f
This commit is contained in:
commit
c799778b3e
143
Makefile
Normal file
143
Makefile
Normal file
|
@ -0,0 +1,143 @@
|
|||
#
|
||||
# Copyright (c) 2018-2023 Nick Peng (pymumu@gmail.com)
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=smartdns
|
||||
PKG_VERSION:=1.2025.46.2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://www.github.com/pymumu/smartdns.git
|
||||
PKG_SOURCE_VERSION:=20f56745c4f2ad2a5a4e1fb927770b3cb8122a69
|
||||
PKG_MIRROR_HASH:=29b32ee0c275a4b845b28c53a2597b43f4d3f04676e04b9c53aae5ecaf3c6f94
|
||||
|
||||
SMARTDNS_WEBUI_VERSION:=1.0.0
|
||||
SMAETDNS_WEBUI_SOURCE_PROTO:=git
|
||||
SMARTDNS_WEBUI_SOURCE_URL:=https://github.com/pymumu/smartdns-webui.git
|
||||
SMARTDNS_WEBUI_SOURCE_VERSION:=7bbd1a6f6a7038ecb6cfbf424615aa7831bc1cea
|
||||
SMARTDNS_WEBUI_FILE:=smartdns-webui-$(SMARTDNS_WEBUI_VERSION).tar.gz
|
||||
|
||||
PKG_MAINTAINER:=Nick Peng <pymumu@gmail.com>
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
# node compile is slow, so do not use it, doownload node manually.
|
||||
# PACKAGE_smartdns-ui:node/host
|
||||
PKG_BUILD_DEPENDS:=PACKAGE_smartdns-ui:rust/host
|
||||
|
||||
include ../../lang/rust/rust-package.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
MAKE_VARS += VER=$(PKG_VERSION)
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/smartdns/default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
URL:=https://www.github.com/pymumu/smartdns/
|
||||
endef
|
||||
|
||||
define Package/smartdns
|
||||
$(Package/smartdns/default)
|
||||
TITLE:=smartdns server
|
||||
DEPENDS:=+libpthread +libopenssl
|
||||
endef
|
||||
|
||||
define Package/smartdns/description
|
||||
SmartDNS is a local DNS server which accepts DNS query requests from local network clients,
|
||||
gets DNS query results from multiple upstream DNS servers concurrently, and returns the fastest IP to clients.
|
||||
Unlike dnsmasq's all-servers, smartdns returns the fastest IP, and encrypt DNS queries with DoT or DoH.
|
||||
endef
|
||||
|
||||
define Package/smartdns/conffiles
|
||||
/etc/config/smartdns
|
||||
/etc/smartdns/address.conf
|
||||
/etc/smartdns/blacklist-ip.conf
|
||||
/etc/smartdns/custom.conf
|
||||
/etc/smartdns/domain-block.list
|
||||
/etc/smartdns/domain-forwarding.list
|
||||
endef
|
||||
|
||||
define Package/smartdns/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/smartdns $(1)/etc/smartdns/domain-set $(1)/etc/smartdns/conf.d/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/smartdns $(1)/usr/sbin/smartdns
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/package/openwrt/files/etc/init.d/smartdns $(1)/etc/init.d/smartdns
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/address.conf $(1)/etc/smartdns/address.conf
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/blacklist-ip.conf $(1)/etc/smartdns/blacklist-ip.conf
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/custom.conf $(1)/etc/smartdns/custom.conf
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/package/openwrt/files/etc/config/smartdns $(1)/etc/config/smartdns
|
||||
endef
|
||||
|
||||
define Package/smartdns-ui
|
||||
$(Package/smartdns/default)
|
||||
TITLE:=smartdns dashboard
|
||||
DEPENDS:=+smartdns $(RUST_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/smartdns-ui/description
|
||||
A dashboard ui for smartdns server.
|
||||
endef
|
||||
|
||||
define Package/smartdns-ui/conffiles
|
||||
/etc/config/smartdns
|
||||
endef
|
||||
|
||||
define Package/smartdns-ui/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/etc/smartdns/conf.d/
|
||||
$(INSTALL_DIR) $(1)/usr/share/smartdns/wwwroot
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/plugin/smartdns-ui/target/libsmartdns_ui.so $(1)/usr/lib/libsmartdns_ui.so
|
||||
$(CP) $(PKG_BUILD_DIR)/smartdns-webui/out/* $(1)/usr/share/smartdns/wwwroot
|
||||
endef
|
||||
|
||||
define Build/Compile/smartdns-webui
|
||||
which npm || (echo "npm not found, please install npm first" && exit 1)
|
||||
npm install --prefix $(PKG_BUILD_DIR)/smartdns-webui/
|
||||
npm run build --prefix $(PKG_BUILD_DIR)/smartdns-webui/
|
||||
endef
|
||||
|
||||
define Build/Compile/smartdns-ui
|
||||
cargo install --force --locked bindgen-cli
|
||||
CARGO_BUILD_ARGS="$(if $(strip $(RUST_PKG_FEATURES)),--features "$(strip $(RUST_PKG_FEATURES))") --profile $(CARGO_PKG_PROFILE)"
|
||||
+$(CARGO_PKG_VARS) CARGO_BUILD_ARGS="$(CARGO_BUILD_ARGS)" CC=$(TARGET_CC) \
|
||||
PATH="$$(PATH):$(CARGO_HOME)/bin" \
|
||||
make -C $(PKG_BUILD_DIR)/plugin/smartdns-ui
|
||||
endef
|
||||
|
||||
define Download/smartdns-webui
|
||||
FILE:=$(SMARTDNS_WEBUI_FILE)
|
||||
PROTO:=$(SMAETDNS_WEBUI_SOURCE_PROTO)
|
||||
URL:=$(SMARTDNS_WEBUI_SOURCE_URL)
|
||||
MIRROR_HASH:=b3f4f73b746ee169708f6504c52b33d9bbeb7c269b731bd7de4f61d0ad212d74
|
||||
VERSION:=$(SMARTDNS_WEBUI_SOURCE_VERSION)
|
||||
HASH:=$(SMARTDNS_WEBUI_HASH)
|
||||
SUBDIR:=smartdns-webui
|
||||
endef
|
||||
$(eval $(call Download,smartdns-webui))
|
||||
|
||||
ifdef CONFIG_PACKAGE_smartdns-ui
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(TAR) -C $(PKG_BUILD_DIR)/ -xf $(DL_DIR)/$(SMARTDNS_WEBUI_FILE)
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default,smartdns)
|
||||
ifdef CONFIG_PACKAGE_smartdns-ui
|
||||
$(call Build/Compile/smartdns-ui)
|
||||
$(call Build/Compile/smartdns-webui)
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,smartdns))
|
||||
$(eval $(call RustBinPackage,smartdns-ui))
|
||||
$(eval $(call BuildPackage,smartdns-ui))
|
||||
|
71
ReadMe.md
Normal file
71
ReadMe.md
Normal file
|
@ -0,0 +1,71 @@
|
|||
# openwrt-smartdns
|
||||
|
||||
此仓库为smartdns独立仓库,为单独编译使用,可配合luci-app-smartdns一起使用。
|
||||
luci界面:[luci-app-smartdns](https://github.com/pymumu/luci-app-smartdns)
|
||||
|
||||
## 使用方式
|
||||
|
||||
注意:如下命令操作路径为openwrt源代码所在目录。
|
||||
|
||||
### 复制仓库中的文件到如下目录,并执行安装
|
||||
|
||||
```shell
|
||||
./feeds/packages/net/smartdns/
|
||||
./scripts/feeds install package -a
|
||||
```
|
||||
|
||||
### 执行openwrt配置, 选中smartdns
|
||||
|
||||
执行编译配置:
|
||||
|
||||
```shell
|
||||
make menuconfig
|
||||
```
|
||||
|
||||
* 选择路径:
|
||||
|
||||
Network > smartdns
|
||||
Network > smartdns-ui
|
||||
|
||||
* 编译模式:
|
||||
|
||||
1. 若编译独立软件包,选择编译模式为`M`
|
||||
1. 若编译到固件中,选择编译模式为`*`
|
||||
1. UI为单独安装包,需要选择后才能编译。
|
||||
|
||||
### 执行openwrt编译
|
||||
|
||||
仅编译软件包:
|
||||
|
||||
```shell
|
||||
make package/feeds/packages/smartdns/compile
|
||||
```
|
||||
|
||||
编译固件以及软件包。
|
||||
|
||||
```shell
|
||||
make -j8
|
||||
```
|
||||
|
||||
## 懒人脚本
|
||||
|
||||
也可可执行如下命令,一次性下载smartdns。
|
||||
|
||||
下列命令可采用复制粘贴的方式执行, 注意目录需要在openwrt源代码目录中。
|
||||
|
||||
```shell
|
||||
WORKINGDIR="`pwd`/feeds/packages/net/smartdns"
|
||||
mkdir $WORKINGDIR -p
|
||||
rm $WORKINGDIR/* -fr
|
||||
wget https://github.com/pymumu/openwrt-smartdns/archive/master.zip -O $WORKINGDIR/master.zip
|
||||
unzip $WORKINGDIR/master.zip -d $WORKINGDIR
|
||||
mv $WORKINGDIR/openwrt-smartdns-master/* $WORKINGDIR/
|
||||
rmdir $WORKINGDIR/openwrt-smartdns-master
|
||||
rm $WORKINGDIR/master.zip
|
||||
|
||||
./scripts/feeds install -a
|
||||
make menuconfig
|
||||
|
||||
```
|
||||
|
||||
上述命令完成后,可执行编译。
|
Loading…
Reference in a new issue