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.

140 lines
3.8 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=xray-core
  3. PKG_VERSION:=1.4.3
  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:=222c03855aa22cd47a648c63b8fa82d37b36983b5c99dc0e2f3c61a79edbb850
  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:=202109060310
  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:=ed94122961f358abede9f1954722039d5a0300b614c77cc27d92618c08b97bb8
  70. endef
  71. GEOSITE_VER:=20210906031055
  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:=7618b876fd5a1066d0b44c1c8ce04608495ae991806890f8b1cbfafe79caf6c1
  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. $(INSTALL_DIR) $(1)/etc/capabilities/
  97. $(INSTALL_DATA) $(CURDIR)/files/xray.capabilities $(1)/etc/capabilities/xray.json
  98. endef
  99. define Package/xray-example/install
  100. $(INSTALL_DIR) $(1)/etc/xray/
  101. $(INSTALL_DATA) $(CURDIR)/files/vpoint_socks_vmess.json $(1)/etc/xray/
  102. $(INSTALL_DATA) $(CURDIR)/files/vpoint_vmess_freedom.json $(1)/etc/xray/
  103. endef
  104. define Package/xray-geodata/install
  105. $(INSTALL_DIR) $(1)/usr/share/xray/
  106. $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/xray/geoip.dat
  107. $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/xray/geosite.dat
  108. endef
  109. $(eval $(call BuildPackage,xray-core))
  110. $(eval $(call BuildPackage,xray-example))
  111. $(eval $(call BuildPackage,xray-geodata))