mirror of
https://github.com/kenzok8/small-package
synced 2025-01-09 08:59:26 +08:00
78 lines
1.9 KiB
Makefile
78 lines
1.9 KiB
Makefile
# SPDX-License-Identifier: GPL-3.0-only
|
|
#
|
|
# Copyright (C) 2021 ImmortalWrt.org
|
|
|
|
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_LICENSE:=GPL-3.0-only
|
|
PKG_LICENSE_FILES:=LICENSE
|
|
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
|
|
|
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_LDFLAGS:=-s -w
|
|
GO_PKG_LDFLAGS_X:= \
|
|
$(GO_PKG)/constant.Version=$(PKG_VERSION) \
|
|
$(GO_PKG)/constant.Commit=v$(PKG_VERSION)
|
|
GO_PKG_TAGS:=full
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
|
|
|
define Package/trojan-go
|
|
SECTION:=net
|
|
CATEGORY:=Network
|
|
SUBMENU:=Web Servers/Proxies
|
|
TITLE:=A Trojan proxy written in Go
|
|
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
|
|
URL:=https://p4gefau1t.github.io/trojan-go/
|
|
endef
|
|
|
|
define Package/trojan-go/description
|
|
Trojan features multiple protocols over TLS to avoid both
|
|
active/passive detections and ISP QoS limitations.
|
|
endef
|
|
|
|
define Package/trojan-go/config
|
|
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 n
|
|
endef
|
|
|
|
ifeq ($(CONFIG_TROJAN_GO_COMPRESS_GOPROXY),y)
|
|
export GO111MODULE=on
|
|
export GOPROXY=https://goproxy.bj.bcebos.com
|
|
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)/trojan-go
|
|
endif
|
|
endef
|
|
|
|
$(eval $(call GoBinPackage,trojan-go))
|
|
$(eval $(call BuildPackage,trojan-go))
|