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.

141 lines
3.8 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=xray-core
  3. PKG_VERSION:=1.4.2
  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:=565255d8c67b254f403d498b9152fa7bc097d649c50cb318d278c2be644e92cc
  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:=-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://xtls.github.io
  28. endef
  29. define Package/xray-core
  30. $(call Package/xray/template)
  31. DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
  32. endef
  33. define Package/xray-example
  34. $(call Package/xray/template)
  35. TITLE+= (example configs)
  36. DEPENDS:=xray-core
  37. PKGARCH:=all
  38. endef
  39. define Package/xray-geodata
  40. $(call Package/xray/template)
  41. TITLE+= (geodata files)
  42. DEPENDS:=xray-core
  43. PKGARCH:=all
  44. endef
  45. define Package/xray/description
  46. Xray, Penetrates Everything. It helps you to build your own computer network.
  47. It secures your network connections and thus protects your privacy.
  48. endef
  49. define Package/xray-core/description
  50. $(call Package/xray/description)
  51. endef
  52. define Package/xray-example/description
  53. $(call Package/xray/description)
  54. This includes example configuration files for xray-core.
  55. endef
  56. define Package/xray-geodata/description
  57. $(call Package/xray/description)
  58. This includes GEO datas used for xray-core.
  59. endef
  60. define Package/xray-core/conffiles
  61. /etc/xray/
  62. /etc/config/xray
  63. endef
  64. GEOIP_VER:=202106030115
  65. GEOIP_FILE:=geoip.dat.$(GEOIP_VER)
  66. define Download/geoip
  67. URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/
  68. URL_FILE:=geoip.dat
  69. FILE:=$(GEOIP_FILE)
  70. HASH:=acf231d7c6461d088ae479fe0c1cb143b5ee3cf7048a897c5a9b7807ab7005df
  71. endef
  72. GEOSITE_VER:=20210531212831
  73. GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
  74. define Download/geosite
  75. URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
  76. URL_FILE:=dlc.dat
  77. FILE:=$(GEOSITE_FILE)
  78. HASH:=332bbe53af49582dbf89bda04ee5e60e474f9293fc368ab55b517fdcd4a78ed2
  79. endef
  80. define Build/Prepare
  81. $(call Build/Prepare/Default)
  82. ifneq ($(CONFIG_PACKAGE_xray-geodata),)
  83. $(call Download,geoip)
  84. $(call Download,geosite)
  85. endif
  86. endef
  87. define Package/xray-core/install
  88. $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
  89. $(INSTALL_DIR) $(1)/usr/bin/
  90. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
  91. $(INSTALL_DIR) $(1)/etc/xray/
  92. $(INSTALL_DATA) $(CURDIR)/files/config.json.example $(1)/etc/xray/
  93. $(INSTALL_DIR) $(1)/etc/config/
  94. $(INSTALL_CONF) $(CURDIR)/files/xray.conf $(1)/etc/config/xray
  95. $(INSTALL_DIR) $(1)/etc/init.d/
  96. $(INSTALL_BIN) $(CURDIR)/files/xray.init $(1)/etc/init.d/xray
  97. $(INSTALL_DIR) $(1)/etc/capabilities/
  98. $(INSTALL_DATA) $(CURDIR)/files/xray.capabilities $(1)/etc/capabilities/xray.json
  99. endef
  100. define Package/xray-example/install
  101. $(INSTALL_DIR) $(1)/etc/xray/
  102. $(INSTALL_DATA) $(CURDIR)/files/vpoint_socks_vmess.json $(1)/etc/xray/
  103. $(INSTALL_DATA) $(CURDIR)/files/vpoint_vmess_freedom.json $(1)/etc/xray/
  104. endef
  105. define Package/xray-geodata/install
  106. $(INSTALL_DIR) $(1)/usr/share/xray/
  107. $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/xray/geoip.dat
  108. $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/xray/geosite.dat
  109. endef
  110. $(eval $(call BuildPackage,xray-core))
  111. $(eval $(call BuildPackage,xray-example))
  112. $(eval $(call BuildPackage,xray-geodata))