瀏覽代碼

*ray-plugin: cleanup Makefile

Signed-off-by: Tianling Shen <[email protected]>
Tianling Shen 4 年之前
父節點
當前提交
9ed9a8ea96
共有 2 個文件被更改,包括 40 次插入61 次删除
  1. 29 32
      v2ray-plugin/Makefile
  2. 11 29
      xray-plugin/Makefile

+ 29 - 32
v2ray-plugin/Makefile

@@ -1,15 +1,13 @@
+# SPDX-License-Identifier: GPL-3.0-only
 #
 # Copyright (C) 2020 SharerMax
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
+# Copyright (C) 2021 ImmortalWrt.org
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=v2ray-plugin
 PKG_VERSION:=4.43.0
-PKG_RELEASE:=$(AUTORELEASE)
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/teddysun/v2ray-plugin/tar.gz/v$(PKG_VERSION)?
@@ -19,6 +17,10 @@ PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE
 PKG_MAINTAINER:=madeye <[email protected]>
 
+PKG_CONFIG_DEPENDS:= \
+	CONFIG_V2RAY_PLUGIN_COMPRESS_GOPROXY \
+	CONFIG_V2RAY_PLUGIN_COMPRESS_UPX
+
 PKG_BUILD_DEPENDS:=golang/host
 PKG_BUILD_PARALLEL:=1
 PKG_USE_MIPS16:=0
@@ -27,45 +29,40 @@ GO_PKG:=github.com/shadowsocks/v2ray-plugin
 GO_PKG_LDFLAGS:=-s -w
 GO_PKG_LDFLAGS_X:=main.VERSION=v$(PKG_VERSION)
 
-PKG_CONFIG_DEPENDS := CONFIG_$(PKG_NAME)_INCLUDE_GOPROXY
-
 include $(INCLUDE_DIR)/package.mk
 include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
 
-define Package/$(PKG_NAME)/config
-config $(PKG_NAME)_INCLUDE_GOPROXY
-	depends on PACKAGE_v2ray-plugin
+define Package/v2ray-plugin/config
+config V2RAY_PLUGIN_COMPRESS_GOPROXY
 	bool "Compiling with GOPROXY proxy"
-	default y
+	default n
 
+config V2RAY_PLUGIN_COMPRESS_UPX
+	bool "Compress executable files with UPX"
+	depends on !mips64
+	default y
 endef
 
-ifeq ($(CONFIG_$(PKG_NAME)_INCLUDE_GOPROXY),y)
-export GO111MODULE=on
-export GOPROXY=https://goproxy.cn
+ifeq ($(CONFIG_V2RAY_PLUGIN_COMPRESS_GOPROXY),y)
+	export GO111MODULE=on
+	export GOPROXY=https://goproxy.baidu.com
 endif
 
-define Package/$(PKG_NAME)
-	SECTION:=net
-	CATEGORY:=Network
-	TITLE:=SIP003 plugin for shadowsocks, based on v2ray
-	URL:=https://github.com/teddysun/v2ray-plugin
-	DEPENDS:=$(GO_ARCH_DEPENDS) +ca-certificates
-endef
-
-define Package/$(PKG_NAME)/description
-	Yet another SIP003 plugin for shadowsocks, based on v2ray
+define Package/v2ray-plugin
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=SIP003 plugin for shadowsocks, based on v2ray
+  URL:=https://github.com/teddysun/v2ray-plugin
+  DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
 endef
 
 define Build/Compile
 	$(call GoPackage/Build/Compile)
-	$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ray-plugin || true
-endef
-
-define Package/$(PKG_NAME)/install
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/v2ray-plugin $(1)/usr/bin/v2ray-plugin
+ifeq ($(CONFIG_V2RAY_PLUGIN_COMPRESS_UPX),y)
+	$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ray-plugin
+endif
 endef
 
-$(eval $(call GoBinPackage,$(PKG_NAME)))
-$(eval $(call BuildPackage,$(PKG_NAME)))
+$(eval $(call GoBinPackage,v2ray-plugin))
+$(eval $(call BuildPackage,v2ray-plugin))

+ 11 - 29
xray-plugin/Makefile

@@ -1,10 +1,6 @@
+# SPDX-License-Identifier: GPL-3.0-only
 #
-# Copyright (C) 2021 ImmortalWrt
-# <https://project-openwrt.eu.org>
-#
-# This is free software, licensed under the GNU General Public License v3.
-# See /LICENSE for more information.
-#
+# Copyright (C) 2021 ImmortalWrt.org
 
 include $(TOPDIR)/rules.mk
 
@@ -18,10 +14,9 @@ PKG_HASH:=a4483fa0e3071935da8b8bd19a9a6b349fc2c221ba2fe777ff2131915debb607
 
 PKG_LICENSE:=MIT
 PKG_LICENSE_FILES:=LICENSE
-PKG_MAINTAINER:=Tianling Shen <cnsztl@project-openwrt.eu.org>
+PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
 
 PKG_CONFIG_DEPENDS:= \
-	CONFIG_XRAY_PLUGIN_PROVIDE_V2RAY_PLUGIN \
 	CONFIG_XRAY_PLUGIN_COMPRESS_GOPROXY \
 	CONFIG_XRAY_PLUGIN_COMPRESS_UPX
 
@@ -36,34 +31,28 @@ include $(INCLUDE_DIR)/package.mk
 include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
 
 define Package/xray-plugin/config
-config XRAY_PLUGIN_PROVIDE_V2RAY_PLUGIN
-	bool "Provide v2ray-plugin binary using xray-plugin"
-	default n
-
 config XRAY_PLUGIN_COMPRESS_GOPROXY
 	bool "Compiling with GOPROXY proxy"
 	default n
 
 config XRAY_PLUGIN_COMPRESS_UPX
 	bool "Compress executable files with UPX"
+	depends on !mips64
 	default y
 endef
 
 ifneq ($(CONFIG_XRAY_PLUGIN_COMPRESS_GOPROXY),)
 	export GO111MODULE=on
-	export GOPROXY=https://goproxy.io
+	export GOPROXY=https://goproxy.baidu.com
 endif
 
 define Package/xray-plugin
-	SECTION:=net
-	CATEGORY:=Network
-	TITLE:=SIP003 plugin for Shadowsocks, based on Xray
-	URL:=https://github.com/teddysun/xray-plugin
-	DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
-endef
-
-define Package/xray-plugin/description
-	Yet another SIP003 plugin for Shadowsocks, based on Xray.
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=SIP003 plugin for Shadowsocks, based on Xray
+  URL:=https://github.com/teddysun/xray-plugin
+  DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
 endef
 
 define Build/Compile
@@ -73,12 +62,5 @@ ifneq ($(CONFIG_XRAY_PLUGIN_COMPRESS_UPX),)
 endif
 endef
 
-define Package/xray-plugin/install
-	$(call GoPackage/Package/Install/Bin,$(1))
-ifneq ($(CONFIG_XRAY_PLUGIN_PROVIDE_V2RAY_PLUGIN),)
-	$(LN) xray-plugin $(1)/usr/bin/v2ray-plugin
-endif
-endef
-
 $(eval $(call GoBinPackage,xray-plugin))
 $(eval $(call BuildPackage,xray-plugin))