You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
3.8 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=xray-core
  3. PKG_VERSION:=1.3.0
  4. PKG_RELEASE:=$(AUTORELEASE)
  5. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  6. PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v$(PKG_VERSION)?
  7. PKG_HASH:=1125af4411655abf47913af14a22fd7e2b13371e3566cc03676207519b0fe407
  8. PKG_MAINTAINER:=
  9. PKG_LICENSE:=MPL-2.0
  10. PKG_LICENSE_FILES:=LICENSE
  11. PKG_BUILD_DIR:=$(BUILD_DIR)/Xray-core-$(PKG_VERSION)
  12. PKG_BUILD_DEPENDS:=golang/host
  13. PKG_BUILD_PARALLEL:=1
  14. PKG_USE_MIPS16:=0
  15. GO_PKG:=github.com/xtls/xray-core
  16. GO_PKG_BUILD_PKG:=github.com/xtls/xray-core/main
  17. GO_PKG_LDFLAGS:=-s -w
  18. GO_PKG_LDFLAGS_X:= \
  19. $(GO_PKG)/core.build=OpenWrt \
  20. $(GO_PKG)/core.version=$(PKG_VERSION)
  21. include $(INCLUDE_DIR)/package.mk
  22. include ../../lang/golang/golang-package.mk
  23. define Package/xray/template
  24. TITLE:=A platform for building proxies to bypass network restrictions
  25. SECTION:=net
  26. CATEGORY:=Network
  27. URL:=https://xray.sh
  28. endef
  29. define Package/xray-core
  30. $(call Package/xray/template)
  31. DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
  32. PROVIDES:=v2ray-core
  33. endef
  34. define Package/xray-example
  35. $(call Package/xray/template)
  36. TITLE+= (example configs)
  37. DEPENDS:=xray-core
  38. PKGARCH:=all
  39. endef
  40. define Package/xray-geodata
  41. $(call Package/xray/template)
  42. TITLE+= (geodata files)
  43. DEPENDS:=xray-core
  44. PKGARCH:=all
  45. endef
  46. define Package/xray/description
  47. Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
  48. It secures your network connections and thus protects your privacy.
  49. endef
  50. define Package/xray-core/description
  51. $(call Package/xray/description)
  52. endef
  53. define Package/xray-example/description
  54. $(call Package/xray/description)
  55. This includes example configuration files for xray-core.
  56. endef
  57. define Package/xray-geodata/description
  58. $(call Package/xray/description)
  59. This includes GEO datas used for xray-core.
  60. endef
  61. define Package/xray-core/conffiles
  62. /etc/xray/
  63. /etc/config/xray
  64. endef
  65. GEOIP_VER:=202102110014
  66. GEOIP_FILE:=geoip.dat.$(GEOIP_VER)
  67. define Download/geoip
  68. URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/
  69. URL_FILE:=geoip.dat
  70. FILE:=$(GEOIP_FILE)
  71. HASH:=c80e61b251fd76b09df5624b12cc84d7e1d9a0492b9acb43e21f0a244b1f9fc3
  72. endef
  73. GEOSITE_VER:=20210211141342
  74. GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
  75. define Download/geosite
  76. URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
  77. URL_FILE:=dlc.dat
  78. FILE:=$(GEOSITE_FILE)
  79. HASH:=e71b4acf2918851dd56e7cda714abb4758deb57b91d716911f33c453b909e796
  80. endef
  81. define Build/Prepare
  82. $(call Build/Prepare/Default)
  83. ifneq ($(CONFIG_PACKAGE_xray-geodata),)
  84. $(call Download,geoip)
  85. $(call Download,geosite)
  86. endif
  87. endef
  88. define Package/xray-core/install
  89. $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
  90. $(INSTALL_DIR) $(1)/usr/bin/
  91. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
  92. $(LN) xray $(1)/usr/bin/v2ray
  93. $(INSTALL_DIR) $(1)/etc/xray/
  94. $(INSTALL_CONF) $(CURDIR)/files/config.json.example $(1)/etc/xray/
  95. $(INSTALL_DIR) $(1)/etc/config/
  96. $(INSTALL_CONF) $(CURDIR)/files/xray.conf $(1)/etc/config/xray
  97. $(INSTALL_DIR) $(1)/etc/init.d/
  98. $(INSTALL_BIN) $(CURDIR)/files/xray.init $(1)/etc/init.d/xray
  99. $(INSTALL_DIR) $(1)/etc/capabilities/
  100. $(INSTALL_DATA) $(CURDIR)/files/xray.capabilities $(1)/etc/capabilities/xray.json
  101. endef
  102. define Package/xray-example/install
  103. $(INSTALL_DIR) $(1)/etc/xray/
  104. $(INSTALL_CONF) $(CURDIR)/files/vpoint_socks_vmess.json $(1)/etc/xray/
  105. $(INSTALL_CONF) $(CURDIR)/files/vpoint_vmess_freedom.json $(1)/etc/xray/
  106. endef
  107. define Package/xray-geodata/install
  108. $(INSTALL_DIR) $(1)/usr/share/xray/
  109. $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/xray/geoip.dat
  110. $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/xray/geosite.dat
  111. endef
  112. $(eval $(call BuildPackage,xray-core))
  113. $(eval $(call BuildPackage,xray-example))
  114. $(eval $(call BuildPackage,xray-geodata))