forked from fw876/helloworld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
151 lines (120 loc) · 3.76 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=v2ray-core
PKG_VERSION:=4.44.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/v2fly/v2ray-core/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=d9973bafd3020f60a51fa3495b24ab417b08b3c8f9539a3748d00da6c68d0103
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <[email protected]>
PKG_CONFIG_DEPENDS:= \
CONFIG_V2RAY_CORE_COMPRESS_GOPROXY \
CONFIG_V2RAY_CORE_COMPRESS_UPX \
CONFIG_V2RAY_CTL_COMPRESS_GOPROXY \
CONFIG_V2RAY_CTL_COMPRESS_UPX
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/v2fly/v2ray-core/v4
GO_PKG_BUILD_PKG:=github.com/v2fly/v2ray-core/v4/main
GO_PKG_LDFLAGS:=-s -w
GO_PKG_LDFLAGS_X:= \
$(GO_PKG).build=OpenWrt \
$(GO_PKG).version=$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/v2ray/template
TITLE:=A platform for building proxies to bypass network restrictions
SECTION:=net
CATEGORY:=Network
URL:=https://www.v2fly.org
endef
define Package/v2ray-core
$(call Package/v2ray/template)
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
endef
define Package/v2ray-ctl
$(call Package/v2ray/template)
DEPENDS:=v2ray-core
endef
define Package/v2ray-extra
$(call Package/v2ray/template)
TITLE+= (extra resources)
DEPENDS:=v2ray-core
PKGARCH:=all
endef
define Package/v2ray/description
Project V is a set of network tools that help you to build your own computer network.
It secures your network connections and thus protects your privacy.
endef
define Package/v2ray-core/description
$(call Package/v2ray/description)
endef
define Package/v2ray-ctl/description
$(call Package/v2ray/description)
This includes configuration tool for v2ray-core.
endef
define Package/v2ray-extra/description
$(call Package/v2ray/description)
This includes extra resources for v2ray-core.
endef
define Package/v2ray-core/config
menu "v2ray-core Configuration"
depends on PACKAGE_v2ray-core
config V2RAY_CORE_COMPRESS_GOPROXY
bool "Compiling with GOPROXY proxy"
default n
config V2RAY_CORE_COMPRESS_UPX
bool "Compress executable files with UPX"
depends on !mips64
default n
endmenu
endef
define Package/v2ray-ctl/config
menu "v2ray-ctl Configuration"
depends on PACKAGE_v2ray-ctl
config V2RAY_CTL_COMPRESS_GOPROXY
bool "Compiling with GOPROXY proxy"
default n
config V2RAY_CTL_COMPRESS_UPX
bool "Compress executable files with UPX"
depends on !mips64
default n
endmenu
endef
define Build/Compile
$(call GoPackage/Build/Compile)
mv $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ray
ifneq ($(CONFIG_V2RAY_CORE_COMPRESS_UPX),)
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ray
endif
ifneq ($(CONFIG_PACKAGE_v2ray-ctl),)
$(eval GO_PKG_BUILD_PKG:=$(GO_PKG)/infra/control/main)
$(call GoPackage/Build/Compile)
mv $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ctl
ifneq ($(CONFIG_V2RAY_CTL_COMPRESS_UPX),)
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ctl
endif
endif
endef
define Package/v2ray-core/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/v2ray $(1)/usr/bin/
endef
define Package/v2ray-ctl/install
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/v2ctl $(1)/usr/bin/
endef
define Package/v2ray-extra/install
$(INSTALL_DIR) $(1)/usr/share/v2ray/
$(CP) $(PKG_BUILD_DIR)/release/extra/* $(1)/usr/share/v2ray/
endef
$(eval $(call BuildPackage,v2ray-core))
$(eval $(call BuildPackage,v2ray-ctl))
$(eval $(call BuildPackage,v2ray-extra))