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.

135 lines
3.6 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=xray-core
  3. PKG_VERSION:=1.6.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:=b65375090a2d48d358a582837d485bfaa9572e4d1f5a649895b9fd83d0f69e43
  8. PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
  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_X:= \
  18. $(GO_PKG)/core.build=OpenWrt \
  19. $(GO_PKG)/core.version=$(PKG_VERSION)
  20. include $(INCLUDE_DIR)/package.mk
  21. include ../../lang/golang/golang-package.mk
  22. define Package/xray/template
  23. TITLE:=A platform for building proxies to bypass network restrictions
  24. SECTION:=net
  25. CATEGORY:=Network
  26. URL:=https://xtls.github.io
  27. endef
  28. define Package/xray-core
  29. $(call Package/xray/template)
  30. DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
  31. endef
  32. define Package/xray-example
  33. $(call Package/xray/template)
  34. TITLE+= (example configs)
  35. DEPENDS:=xray-core
  36. PKGARCH:=all
  37. endef
  38. define Package/xray-geodata
  39. $(call Package/xray/template)
  40. TITLE+= (geodata files)
  41. DEPENDS:=xray-core
  42. PKGARCH:=all
  43. endef
  44. define Package/xray/description
  45. Xray, Penetrates Everything. It helps you to build your own computer network.
  46. It secures your network connections and thus protects your privacy.
  47. endef
  48. define Package/xray-core/description
  49. $(call Package/xray/description)
  50. endef
  51. define Package/xray-example/description
  52. $(call Package/xray/description)
  53. This includes example configuration files for xray-core.
  54. endef
  55. define Package/xray-geodata/description
  56. $(call Package/xray/description)
  57. This includes GEO datas used for xray-core.
  58. endef
  59. define Package/xray-core/conffiles
  60. /etc/xray/
  61. /etc/config/xray
  62. endef
  63. GEOIP_VER:=202209170841
  64. GEOIP_FILE:=geoip.dat.$(GEOIP_VER)
  65. define Download/geoip
  66. URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/
  67. URL_FILE:=geoip.dat
  68. FILE:=$(GEOIP_FILE)
  69. HASH:=ceb0cfdf0fab39141e807fe7bb8a0972c6b3f616abcd1097ac30c26368f368a5
  70. endef
  71. GEOSITE_VER:=20220918140014
  72. GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
  73. define Download/geosite
  74. URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
  75. URL_FILE:=dlc.dat
  76. FILE:=$(GEOSITE_FILE)
  77. HASH:=8a69b68f02d422ab05f351772c871f367bf387fa78dc37c4f8c1e421a13540a6
  78. endef
  79. define Build/Prepare
  80. $(call Build/Prepare/Default)
  81. ifneq ($(CONFIG_PACKAGE_xray-geodata),)
  82. $(call Download,geoip)
  83. $(call Download,geosite)
  84. endif
  85. endef
  86. define Package/xray-core/install
  87. $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
  88. $(INSTALL_DIR) $(1)/usr/bin/
  89. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
  90. $(INSTALL_DIR) $(1)/etc/xray/
  91. $(INSTALL_DATA) $(CURDIR)/files/config.json.example $(1)/etc/xray/
  92. $(INSTALL_DIR) $(1)/etc/config/
  93. $(INSTALL_CONF) $(CURDIR)/files/xray.conf $(1)/etc/config/xray
  94. $(INSTALL_DIR) $(1)/etc/init.d/
  95. $(INSTALL_BIN) $(CURDIR)/files/xray.init $(1)/etc/init.d/xray
  96. endef
  97. define Package/xray-example/install
  98. $(INSTALL_DIR) $(1)/etc/xray/
  99. $(INSTALL_DATA) $(CURDIR)/files/vpoint_socks_vmess.json $(1)/etc/xray/
  100. $(INSTALL_DATA) $(CURDIR)/files/vpoint_vmess_freedom.json $(1)/etc/xray/
  101. endef
  102. define Package/xray-geodata/install
  103. $(INSTALL_DIR) $(1)/usr/share/xray/
  104. $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/xray/geoip.dat
  105. $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/xray/geosite.dat
  106. endef
  107. $(eval $(call BuildPackage,xray-core))
  108. $(eval $(call BuildPackage,xray-example))
  109. $(eval $(call BuildPackage,xray-geodata))