small-package/xray-plugin/Makefile

72 lines
1.7 KiB
Makefile
Raw Normal View History

2021-11-13 08:59:03 +08:00
# SPDX-License-Identifier: GPL-3.0-only
2021-09-05 16:50:22 +08:00
#
2021-11-13 08:59:03 +08:00
# Copyright (C) 2021 ImmortalWrt.org
2021-09-05 16:50:22 +08:00
include $(TOPDIR)/rules.mk
PKG_NAME:=xray-plugin
2021-12-15 20:31:46 +08:00
PKG_VERSION:=1.5.1
2021-09-05 16:50:22 +08:00
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/teddysun/xray-plugin/tar.gz/v$(PKG_VERSION)?
2021-09-24 19:49:47 +08:00
PKG_HASH:=skip
2021-09-05 16:50:22 +08:00
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@project-openwrt.eu.org>
PKG_CONFIG_DEPENDS:= \
CONFIG_XRAY_PLUGIN_COMPRESS_GOPROXY \
CONFIG_XRAY_PLUGIN_COMPRESS_UPX
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/teddysun/xray-plugin
GO_PKG_LDFLAGS:=-s -w
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/xray-plugin/config
config XRAY_PLUGIN_COMPRESS_GOPROXY
bool "Compiling with GOPROXY proxy"
default n
config XRAY_PLUGIN_COMPRESS_UPX
bool "Compress executable files with UPX"
2021-10-25 18:05:09 +08:00
depends on !mips64
2021-09-05 16:50:22 +08:00
default y
endef
ifneq ($(CONFIG_XRAY_PLUGIN_COMPRESS_GOPROXY),)
export GO111MODULE=on
export GOPROXY=https://goproxy.io
endif
define Package/xray-plugin
2021-11-13 08:59:03 +08:00
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
2021-09-05 16:50:22 +08:00
endef
define Build/Compile
$(call GoPackage/Build/Compile)
ifneq ($(CONFIG_XRAY_PLUGIN_COMPRESS_UPX),)
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/xray-plugin
endif
endef
define Package/xray-plugin/install
2021-11-13 08:59:03 +08:00
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/xray-plugin $(1)/usr/bin/xray-plugin
2021-09-05 16:50:22 +08:00
endef
$(eval $(call GoBinPackage,xray-plugin))
$(eval $(call BuildPackage,xray-plugin))