mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
shadowsocks-rust: add new package
shadowsocks-rust is shadowsocks written in rust, with high performance for AES AEAD ciphers (while much lower for non-ones). However with the lack of rust toolchain, by now we can only download pre-compiled binaries for quick setup and this Makefile needs to be rewritten when rust toolchain is up. Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
4deeb05e91
commit
6d9545423e
112
package/ctcgfw/shadowsocks-rust/Makefile
Normal file
112
package/ctcgfw/shadowsocks-rust/Makefile
Normal file
@ -0,0 +1,112 @@
|
||||
#
|
||||
# Copyright (C) 2017-2020 Yousong Zhou <yszhou4tech@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=shadowsocks-rust
|
||||
PKG_VERSION:=1.9.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_HEADER:=shadowsocks-v$(PKG_VERSION)
|
||||
PKG_SOURCE_BODY:=unknown-linux-musl
|
||||
PKG_SOURCE_FOOTER:=tar.xz
|
||||
PKG_SOURCE_URL:=https://github.com/shell-script/openwrt-shadowsocks-rust/releases/download/v$(PKG_VERSION)/
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).aarch64-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=318e0538386e52025448e7dc1e67b71bd399981e386ba0a54802ff3c13b25016
|
||||
else ifeq ($(ARCH),arm)
|
||||
# Referred to golang/golang-values.mk
|
||||
ARM_CPU_FEATURES:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE))))
|
||||
ifeq ($(ARM_CPU_FEATURES),)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).arm-$(PKG_SOURCE_BODY)eabi.$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=38d15003799d91ebecb89be61eccb1f3b31ca4e11d6d5ecfcbd367e10cc42319
|
||||
else ifneq ($(filter $(ARM_CPU_FEATURES),vfp vfpv2),)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).arm-$(PKG_SOURCE_BODY)eabihf.$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=e31bfbba903ac171b133b897b2a0e183833002b141db74b95d94873d32c07d49
|
||||
else
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).armv7-$(PKG_SOURCE_BODY)eabihf.$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=e1ed14d86b4e7f6b88da3ff5b99431a707eb7a23f0e063ada86e85e7e84a8ec1
|
||||
endif
|
||||
else ifeq ($(ARCH),i386)
|
||||
ifeq ($(CONFIG_TARGET_x86_geode)$(CONFIG_TARGET_x86_legacy),y)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).i586-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=f08f6ab355495f5553e388b347f7bf70502ae3f53f3979267fcfe1dd6a7a565f
|
||||
else
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).i686-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=a5021533dad53a877d6265677dea6f5a6f500f135d47327c98beeb85642180ce
|
||||
endif
|
||||
else ifeq ($(ARCH),mips)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).mips-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=f76de3d0c4b2e3703faabfb730d817b5b5610ec3701827282c18ca44c84f6a28
|
||||
else ifeq ($(ARCH),mipsel)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).mipsel-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=953d2feb430906edcb5ed6994510b3bded141ae8abb3b77dd6bfc80aac8740d1
|
||||
else ifeq ($(ARCH),x86_64)
|
||||
PKG_SOURCE:=$(PKG_SOURCE_HEADER).x86_64-$(PKG_SOURCE_BODY).$(PKG_SOURCE_FOOTER)
|
||||
PKG_HASH:=adc68983961209cdf3c7a465911bdfabc52e7e08132a6dbcd0db77eaa924ec3f
|
||||
# Set the default value to make OpenWrt Package Checker happy
|
||||
else
|
||||
PKG_SOURCE:=dummy
|
||||
PKG_HASH:=dummy
|
||||
endif
|
||||
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TAR_CMD:=$(HOST_TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
|
||||
|
||||
define Package/shadowsocks-rust/Default
|
||||
PKG_CONFIG_DEPENDS+=CONFIG_SHADOWSOCKS_RUST_$(1)_COMPRESS_UPX
|
||||
|
||||
define Package/shadowsocks-rust-$(1)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
TITLE:=shadowsocks-rust $(1)
|
||||
URL:=https://github.com/shadowsocks/shadowsocks-rust
|
||||
DEPENDS:=@(aarch64||arm||i386||mips||mipsel||x86_64) @USE_MUSL
|
||||
endef
|
||||
|
||||
define Package/shadowsocks-rust-$(1)/config
|
||||
config SHADOWSOCKS_RUST_$(1)_COMPRESS_UPX
|
||||
bool "Compress $(1) with UPX"
|
||||
default y
|
||||
endef
|
||||
|
||||
define Package/shadowsocks-rust-$(1)/install
|
||||
$$(INSTALL_DIR) $$(1)/usr/bin
|
||||
$$(INSTALL_BIN) $$(PKG_BUILD_DIR)/$(1) $$(1)/usr/bin
|
||||
endef
|
||||
endef
|
||||
|
||||
PKG_CONFIG_DEPENDS:=
|
||||
SHADOWSOCKS_COMPONENTS:=sslocal ssmanager ssserver ssurl
|
||||
define shadowsocks-rust/templates
|
||||
$(foreach component,$(SHADOWSOCKS_COMPONENTS),
|
||||
$(call Package/shadowsocks-rust/Default,$(component))
|
||||
)
|
||||
endef
|
||||
$(eval $(call shadowsocks-rust/templates))
|
||||
|
||||
define Build/Compile
|
||||
$(foreach component,$(SHADOWSOCKS_COMPONENTS),
|
||||
ifneq ($(CONFIG_SHADOWSOCKS_RUST_$(component)_COMPRESS_UPX),)
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(PKG_BUILD_DIR)/$(component)
|
||||
endif
|
||||
)
|
||||
endef
|
||||
|
||||
$(foreach component,$(SHADOWSOCKS_COMPONENTS), \
|
||||
$(eval $(call BuildPackage,shadowsocks-rust-$(component))) \
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user