From cda4a4ff706de0418a4118325170f57a71a0f8f3 Mon Sep 17 00:00:00 2001 From: Beginner <70857188+Beginner-Go@users.noreply.github.com> Date: Wed, 28 Apr 2021 13:05:09 +0800 Subject: [PATCH] baidupcs-web: add upx support (#6772) --- package/lean/baidupcs-web/Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/package/lean/baidupcs-web/Makefile b/package/lean/baidupcs-web/Makefile index bf06c64a4..8b4e4733d 100644 --- a/package/lean/baidupcs-web/Makefile +++ b/package/lean/baidupcs-web/Makefile @@ -20,6 +20,10 @@ PKG_MIRROR_HASH:=815410a7c348c82eea638f6d34fd4dfab59286e16b172c434ff0008de24676d PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE +PKG_CONFIG_DEPENDS:= \ + CONFIG_BAIDUPCS_WEB_COMPRESS_GOPROXY \ + CONFIG_BAIDUPCS_WEB_COMPRESS_UPX + PKG_BUILD_DEPENDS:=golang/host PKG_BUILD_PARALLEL:=1 PKG_USE_MIPS16:=0 @@ -43,6 +47,21 @@ define Package/$(PKG_NAME)/description BaiduPCS-Web is a web controller for BaiduPCS-Go endef +define Package/$(PKG_NAME)/config +config BAIDUPCS_WEB_COMPRESS_GOPROXY + bool "Compiling with GOPROXY proxy" + default n + +config BAIDUPCS_WEB_COMPRESS_UPX + bool "Compress executable files with UPX" + default y +endef + +ifeq ($(CONFIG_BAIDUPCS_WEB_COMPRESS_GOPROXY),y) + export GO111MODULE=on + export GOPROXY=https://goproxy.baidu.com +endif + define Build/Compile ( \ GOOS=$$$$(go env GOOS) GOARCH=$$$$(go env GOARCH) go get -v github.com/GeertJohan/go.rice/rice/... ; \ @@ -50,7 +69,9 @@ define Build/Compile "$$$$(go env GOPATH)/bin/rice" embed-go ; \ ) $(call GoPackage/Build/Compile) +ifeq ($(CONFIG_BAIDUPCS_WEB_COMPRESS_UPX),y) $(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/BaiduPCS-Go +endif endef define Package/$(PKG_NAME)/install