| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- include $(TOPDIR)/rules.mk
- PKG_NAME:=xray-core
- PKG_VERSION:=1.4.2
- PKG_RELEASE:=1
- PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
- PKG_SOURCE_URL:=https://codeload.github.com/XTLS/xray-core/tar.gz/v$(PKG_VERSION)?
- PKG_HASH:=565255d8c67b254f403d498b9152fa7bc097d649c50cb318d278c2be644e92cc
- PKG_MAINTAINER:=Tianling Shen <[email protected]>
- PKG_LICENSE:=MPL-2.0
- PKG_LICENSE_FILES:=LICENSE
- PKG_CONFIG_DEPENDS:= \
- CONFIG_XRAY_CORE_COMPRESS_GOPROXY \
- CONFIG_XRAY_CORE_COMPRESS_UPX \
- PKG_BUILD_DIR:=$(BUILD_DIR)/Xray-core-$(PKG_VERSION)
- PKG_BUILD_DEPENDS:=golang/host
- PKG_BUILD_PARALLEL:=1
- PKG_USE_MIPS16:=0
- GO_PKG:=github.com/xtls/xray-core
- GO_PKG_BUILD_PKG:=github.com/xtls/xray-core/main
- GO_PKG_LDFLAGS:=-s -w
- GO_PKG_LDFLAGS_X:= \
- $(GO_PKG)/core.build=OpenWrt \
- $(GO_PKG)/core.version=$(PKG_VERSION)
- include $(INCLUDE_DIR)/package.mk
- include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
- define Package/xray/template
- TITLE:=A platform for building proxies to bypass network restrictions
- SECTION:=net
- CATEGORY:=Network
- URL:=https://xtls.github.io
- endef
- define Package/xray-core
- $(call Package/xray/template)
- DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
- PROVIDES:=v2ray-core
- endef
- define Package/xray-geodata
- $(call Package/xray/template)
- TITLE+= (geodata files)
- DEPENDS:=xray-core
- endef
- define Package/xray/description
- Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
- It secures your network connections and thus protects your privacy.
- endef
- define Package/xray-core/description
- $(call Package/xray/description)
- endef
- define Package/xray-geodata/description
- $(call Package/xray/description)
- This includes GEO datas used for xray-core.
- endef
- define Package/xray-core/config
- menu "Xray-core Configuration"
- depends on PACKAGE_xray-core
- config XRAY_CORE_COMPRESS_GOPROXY
- bool "Compiling with GOPROXY proxy"
- default n
- config XRAY_CORE_COMPRESS_UPX
- bool "Compress executable files with UPX"
- default y
- endmenu
- endef
- GEOIP_VER:=202103250007
- GEOIP_FILE:=geoip.dat.$(GEOIP_VER)
- define Download/geoip
- URL:=https://github.com/v2fly/geoip/releases/download/$(GEOIP_VER)/
- URL_FILE:=geoip.dat
- FILE:=$(GEOIP_FILE)
- HASH:=eca0b25e528167dbdec6c130b6a5240284ce20b28158d1448f8dbeddace2e8cf
- endef
- GEOSITE_VER:=20210331082244
- GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
- define Download/geosite
- URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
- URL_FILE:=dlc.dat
- FILE:=$(GEOSITE_FILE)
- HASH:=e2b942b93994af1a59fd0c39179eeac7afaf351f48bf863f3e779b46a7530823
- endef
- ifneq ($(CONFIG_XRAY_CORE_COMPRESS_GOPROXY),)
- export GO111MODULE=on
- export GOPROXY=https://goproxy.io
- endif
- define Build/Prepare
- $(call Build/Prepare/Default)
- ifneq ($(CONFIG_PACKAGE_xray-geodata),)
- $(call Download,geoip)
- $(call Download,geosite)
- endif
- endef
- define Build/Compile
- $(call GoPackage/Build/Compile)
- ifneq ($(CONFIG_XRAY_CORE_COMPRESS_UPX),)
- $(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/main
- endif
- endef
- define Package/xray-core/install
- $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
- $(INSTALL_DIR) $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/xray
- $(LN) xray $(1)/usr/bin/v2ray
- endef
- define Package/xray-geodata/install
- $(INSTALL_DIR) $(1)/usr/share/xray/
- $(INSTALL_DATA) $(DL_DIR)/$(GEOIP_FILE) $(1)/usr/share/xray/geoip.dat
- $(INSTALL_DATA) $(DL_DIR)/$(GEOSITE_FILE) $(1)/usr/share/xray/geosite.dat
- endef
- $(eval $(call BuildPackage,xray-core))
- $(eval $(call BuildPackage,xray-geodata))
|