Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #
  2. # Copyright (C) 2021 ImmortalWrt
  3. # <https://project-openwrt.eu.org>
  4. #
  5. # This is free software, licensed under the GNU General Public License v3.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=xray-plugin
  10. PKG_VERSION:=1.4.1
  11. PKG_RELEASE:=1
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=https://codeload.github.com/teddysun/xray-plugin/tar.gz/v$(PKG_VERSION)?
  14. PKG_HASH:=ada0e3305e0133fa662a72280d718565686c72c251029832c5ab143490660a7f
  15. PKG_LICENSE:=MIT
  16. PKG_LICENSE_FILES:=LICENSE
  17. PKG_MAINTAINER:=Tianling Shen <[email protected]>
  18. PKG_CONFIG_DEPENDS:= \
  19. CONFIG_XRAY_PLUGIN_PROVIDE_V2RAY_PLUGIN \
  20. CONFIG_XRAY_PLUGIN_COMPRESS_GOPROXY \
  21. CONFIG_XRAY_PLUGIN_COMPRESS_UPX
  22. PKG_BUILD_DEPENDS:=golang/host
  23. PKG_BUILD_PARALLEL:=1
  24. PKG_USE_MIPS16:=0
  25. GO_PKG:=github.com/teddysun/xray-plugin
  26. GO_PKG_LDFLAGS:=-s -w
  27. include $(INCLUDE_DIR)/package.mk
  28. include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
  29. define Package/xray-plugin/config
  30. config XRAY_PLUGIN_PROVIDE_V2RAY_PLUGIN
  31. bool "Provide v2ray-plugin binary using xray-plugin"
  32. default n
  33. config XRAY_PLUGIN_COMPRESS_GOPROXY
  34. bool "Compiling with GOPROXY proxy"
  35. default n
  36. config XRAY_PLUGIN_COMPRESS_UPX
  37. bool "Compress executable files with UPX"
  38. default y
  39. endef
  40. ifneq ($(CONFIG_XRAY_PLUGIN_COMPRESS_GOPROXY),)
  41. export GO111MODULE=on
  42. export GOPROXY=https://goproxy.io
  43. endif
  44. define Package/xray-plugin
  45. SECTION:=net
  46. CATEGORY:=Network
  47. TITLE:=SIP003 plugin for Shadowsocks, based on Xray
  48. URL:=https://github.com/teddysun/xray-plugin
  49. DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
  50. endef
  51. define Package/xray-plugin/description
  52. Yet another SIP003 plugin for Shadowsocks, based on Xray.
  53. endef
  54. define Build/Compile
  55. $(call GoPackage/Build/Compile)
  56. ifneq ($(CONFIG_XRAY_PLUGIN_COMPRESS_UPX),)
  57. $(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/xray-plugin
  58. endif
  59. endef
  60. define Package/xray-plugin/install
  61. $(call GoPackage/Package/Install/Bin,$(1))
  62. ifneq ($(CONFIG_XRAY_PLUGIN_PROVIDE_V2RAY_PLUGIN),)
  63. $(LN) xray-plugin $(1)/usr/bin/v2ray-plugin
  64. endif
  65. endef
  66. $(eval $(call GoBinPackage,xray-plugin))
  67. $(eval $(call BuildPackage,xray-plugin))