kenzok8-package/trojan-go/Makefile
github-actions[bot] 4022b7c3db update-10.23
2021-10-23 20:29:42 +08:00

77 lines
1.8 KiB
Makefile

# Copyright (C) 2020 Lienol
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=trojan-go
PKG_VERSION:=0.10.6
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/p4gefau1t/trojan-go/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=skip
PKG_CONFIG_DEPENDS:= \
CONFIG_TROJAN_GO_COMPRESS_GOPROXY \
CONFIG_TROJAN_GO_COMPRESS_UPX
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/p4gefau1t/trojan-go
GO_PKG_BUILD_PKG:=$$(GO_PKG)
GO_PKG_TAGS:=full
GO_PKG_LDFLAGS:=-s -w
GO_PKG_LDFLAGS_X:= \
$(GO_PKG)/constant.Version=$(PKG_VERSION) \
$(GO_PKG)/constant.Commit=v$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
DEPENDS:=$$(GO_ARCH_DEPENDS)
TITLE:=An unidentifiable mechanism that helps you bypass GFW. It's compatible with original trojan with experimental features.
URL:=https://github.com/p4gefau1t/trojan-go
endef
define Package/$(PKG_NAME)/config
menu "Configuration"
depends on PACKAGE_$(PKG_NAME)
config TROJAN_GO_COMPRESS_GOPROXY
bool "Compiling with GOPROXY proxy"
default n
config TROJAN_GO_COMPRESS_UPX
bool "Compress executable files with UPX"
depends on @!mips64
default y
endmenu
endef
ifeq ($(CONFIG_TROJAN_GO_COMPRESS_GOPROXY),y)
export GO111MODULE=on
export GOPROXY=https://goproxy.io
endif
define Build/Compile
$(call GoPackage/Build/Compile)
ifeq ($(CONFIG_TROJAN_GO_COMPRESS_UPX),y)
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/$(PKG_NAME)
endif
endef
$(eval $(call GoBinPackage,$(PKG_NAME)))
$(eval $(call BuildPackage,$(PKG_NAME)))