Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapt new rust build standard #82

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions contrib/openwrt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/mokeyish/smartdns-rs.git
PKG_SOURCE_VERSION:=9a4691e224c418d9474aa74a890a92d7d62f151d
PKG_MIRROR_HASH:=abe9b00da257fa5f7607cc72d7f0798ed6ce5ab8c7b79599442adfe6172aa9e3
PKG_SOURCE_VERSION:=e96c4577e8cff1ff810e96e93eb7dba9bbd25353
PKG_MIRROR_HASH:=a653849bf7f6962270f73f9cb5554c1d0e2cd4afd05764e5c9de1d860e8bb405

PKG_MAINTAINER:=Zxlhhyccc <[email protected]>
PKG_LICENSE:=MIT
Expand All @@ -23,43 +23,30 @@ PKG_BUILD_PARALLEL:=1

PKG_BUILD_DEPENDS:=rust/host

RUST_PKG:=smartdns

include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/rust/rust-package.mk

define Package/smartdns-rust/Default
define Package/smartdns-rust
define Package/smartdns-rust
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=smartdns-rust server
URL:=https://github.com/mokeyish/smartdns-rs.git
DEPENDS:=$$(RUST_ARCH_DEPENDS)
endef
endef

define Package/smartdns-rust/description
define Package/smartdns-rust/description
A cross platform local DNS server (Dnsmasq like) written in rust to obtain the fastest website IP for the best Internet experience, supports DoT, DoH.
endef

define Package/smartdns-rust/install
$$(INSTALL_DIR) $$(1)/usr/sbin
$$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/bin/smartdns $$(1)/usr/sbin/

$$(INSTALL_DIR) $$(1)/etc/init.d
$$(INSTALL_BIN) $(CURDIR)/conf/smartdns.init $$(1)/etc/init.d/smartdns
endef
endef

define smartdns-rust/templates
$(foreach smartdns,smartdns,
$(call Package/smartdns-rust/Default,smartdns)
)
endef
$(eval $(call smartdns-rust/templates))
define Package/smartdns-rust/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/target/$(RUSTC_TARGET_ARCH)/stripped/smartdns $(1)/usr/sbin/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$(1) 是 prefix 么?是的话 /usr 可以不要的。

例如,

  • 当 prefix 是 / 时,这时二进制程序在 /sbin
  • 当 prefix 是 /usr/local 时,,这时二进制程序在 /usr/local/sbin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需/usr,否则编译后安装的目录是/sbin/而不是/usr/sbin/


define Build/Compile
$(call Build/Compile/Cargo,, smartdns)
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(CURDIR)/conf/smartdns.init $(1)/etc/init.d/smartdns
endef

$(foreach smartdns,smartdns, \
$(eval $(call BuildPackage,smartdns-rust)) \
)
$(eval $(call BuildPackage,smartdns-rust))