-
Notifications
You must be signed in to change notification settings - Fork 59
/
Makefile
66 lines (51 loc) · 1.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
include $(TOPDIR)/rules.mk
PKG_NAME:=openwrt-xray
PKG_VERSION:=25.1.1
PKG_RELEASE:=1
PKG_LICENSE:=MPLv2
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=yichya <[email protected]>
PKG_SOURCE:=Xray-core-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/XTLS/Xray-core/tar.gz/v${PKG_VERSION}?
PKG_HASH:=619b10d24bab367a0788b3585f8d31fa4e5e060be7f72647d6ee17bd744603a5
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
GO_PKG:=github.com/XTLS/Xray-core
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/../feeds/packages/lang/golang/golang-package.mk
define Package/$(PKG_NAME)
SECTION:=Custom
CATEGORY:=Extra packages
TITLE:=Xray-core
DEPENDS:=$(GO_ARCH_DEPENDS)
PROVIDES:=xray-core
endef
define Package/$(PKG_NAME)/description
Xray-core bare bones binary (compiled without cgo)
endef
define Package/$(PKG_NAME)/config
menu "Xray Configuration"
depends on PACKAGE_$(PKG_NAME)
config PACKAGE_XRAY_ENABLE_GOPROXY_IO
bool "Use goproxy.io to speed up module fetching (recommended for some network situations)"
default n
endmenu
endef
USE_GOPROXY:=
ifdef CONFIG_PACKAGE_XRAY_ENABLE_GOPROXY_IO
USE_GOPROXY:=GOPROXY=https://goproxy.io,direct
endif
MAKE_PATH:=$(GO_PKG_WORK_DIR_NAME)/build/src/$(GO_PKG)
MAKE_VARS += $(GO_PKG_VARS)
define Build/Patch
$(CP) $(PKG_BUILD_DIR)/../Xray-core-$(PKG_VERSION)/* $(PKG_BUILD_DIR)
$(Build/Patch/Default)
endef
define Build/Compile
cd $(PKG_BUILD_DIR); $(GO_PKG_VARS) $(USE_GOPROXY) CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o $(PKG_INSTALL_DIR)/bin/xray ./main;
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/xray $(1)/usr/bin/xray
endef
$(eval $(call BuildPackage,$(PKG_NAME)))