This commit is contained in:
SirPdboy 2022-12-25 00:40:42 +08:00 committed by GitHub
parent e1a2ccee7f
commit 3f80ca7fb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,14 +11,11 @@ PKG_RELEASE:=$(AUTORELESE)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/ZeaKyX/speedtest-go.git
PKG_SOURCE_VERSION:=d8ccc31d3ae0ed2833691e3b8fc6fd1795d1ec13
PKG_MIRROR_HASH:=63dad14ce21c78b37f223aacc4fd4611bbe1f9619afff8d52a38186441cb6a86
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=LGPL-3.0
PKG_LICENSE_FILES:=LICENSE
PKG_CONFIG_DEPENDS:= \
CONFIG_SPEEDTEST_WEB_COMPRESS_GOPROXY \
CONFIG_SPEEDTEST_WEB_COMPRESS_UPX
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
@ -31,21 +28,6 @@ GO_PKG_LDFLAGS_X:=main.VersionString=v$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/speedtest-web/config
config SPEEDTEST_WEB_COMPRESS_GOPROXY
bool "Compiling with GOPROXY proxy"
default n
config SPEEDTEST_WEB_COMPRESS_UPX
bool "Compress executable files with UPX"
default y
endef
ifeq ($(CONFIG_SPEEDTEST_WEB_COMPRESS_GOPROXY),y)
export GO111MODULE=on
export GOPROXY=https://goproxy.baidu.com
endif
define Package/speedtest-web
SECTION:=net
CATEGORY:=Network
@ -58,18 +40,9 @@ define Package/speedtest-web/description
speedtest-web is a Openwrt package for speedtest-go, a Go backend for LibreSpeed
endef
define Build/Compile
$(call GoPackage/Build/Compile)
ifeq ($(CONFIG_SPEEDTEST_WEB_COMPRESS_UPX),y)
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/speedtest
endif
endef
define Package/speedtest-web/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/speedtest $(1)/usr/bin/$(PKG_NAME)
endef
$(eval $(call GoBinPackage,speedtest-web))
$(eval $(call BuildPackage,speedtest-web))