forked from kenzok8/small
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
150 lines (120 loc) · 4.32 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
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=sing-box
PKG_VERSION:=1.8.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/SagerNet/sing-box/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=6ea56eb52c2168f3d5ac98ab1bb758f109a411a5a897599e60eaecaf8f8fdcd9
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
PKG_BUILD_FLAGS:=no-mips16
GO_PKG:=github.com/sagernet/sing-box
GO_PKG_BUILD_PKG:=$(GO_PKG)/cmd/sing-box
GO_PKG_LDFLAGS_X:=$(GO_PKG)/constant.Version=v$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=The universal proxy platform.
URL:=https://sing-box.sagernet.org
DEPENDS:=$(GO_ARCH_DEPENDS) \
+ca-bundle \
+kmod-inet-diag \
+kmod-netlink-diag \
+kmod-tun
endef
define Package/$(PKG_NAME)/description
Sing-box is a universal proxy platform which supports hysteria, SOCKS,
Shadowsocks, ShadowTLS, Tor, trojan, VLess, VMess, WireGuard and so on.
endef
GO_PKG_TARGET_VARS:=$(filter-out CGO_ENABLED=%,$(GO_PKG_TARGET_VARS)) CGO_ENABLED=0
define Package/$(PKG_NAME)/config
menu "Customizing build tags"
depends on PACKAGE_sing-box
config SING_BOX_WITH_ACME
bool "Build with ACME TLS certificate issuer support"
default n
config SING_BOX_WITH_CLASH_API
bool "Build with Clash API support (EXPERIMENTAL!!!)"
default y
config SING_BOX_WITH_DHCP
bool "Build with DHCP support"
default y
config SING_BOX_WITH_ECH
bool "Build with TLS ECH extension support"
default y
config SING_BOX_WITH_GRPC
bool "Build with standard gRPC support"
default n
help
sing-box has better performance gun-lite gRPC built-in by default.
This standard gRPC has better compatibility but poor performance.
config SING_BOX_WITH_GVISOR
bool "Build with gVisor support"
default n
config SING_BOX_WITH_QUIC
bool "Build with QUIC support"
default y
help
Required by HTTP3 DNS transports, Naive inbound,
Hysteria inbound / outbound, and v2ray QUIC transport.
config SING_BOX_WITH_REALITY_SERVER
bool "Build with reality TLS server support"
default n
config SING_BOX_WITH_UTLS
bool "Build with uTLS support"
default y
config SING_BOX_WITH_V2RAY_API
bool "Build with V2Ray API support (EXPERIMENTAL!!!)"
default n
config SING_BOX_WITH_WIREGUARD
bool "Build with WireGuard support"
default y
endmenu
endef
PKG_CONFIG_DEPENDS:= \
CONFIG_SING_BOX_WITH_ACME \
CONFIG_SING_BOX_WITH_CLASH_API \
CONFIG_SING_BOX_WITH_DHCP \
CONFIG_SING_BOX_WITH_ECH \
CONFIG_SING_BOX_WITH_GRPC \
CONFIG_SING_BOX_WITH_GVISOR \
CONFIG_SING_BOX_WITH_QUIC \
CONFIG_SING_BOX_WITH_REALITY_SERVER \
CONFIG_SING_BOX_WITH_UTLS \
CONFIG_SING_BOX_WITH_V2RAY_API \
CONFIG_SING_BOX_WITH_WIREGUARD
GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \
$(if $(CONFIG_SING_BOX_WITH_ACME),with_acme) \
$(if $(CONFIG_SING_BOX_WITH_CLASH_API),with_clash_api) \
$(if $(CONFIG_SING_BOX_WITH_DHCP),with_dhcp) \
$(if $(CONFIG_SING_BOX_WITH_ECH),with_ech) \
$(if $(CONFIG_SING_BOX_WITH_GRPC),with_grpc) \
$(if $(CONFIG_SING_BOX_WITH_GVISOR),with_gvisor) \
$(if $(CONFIG_SING_BOX_WITH_QUIC),with_quic) \
$(if $(CONFIG_SING_BOX_WITH_REALITY_SERVER),with_reality_server) \
$(if $(CONFIG_SING_BOX_WITH_UTLS),with_utls) \
$(if $(CONFIG_SING_BOX_WITH_V2RAY_API),with_v2ray_api) \
$(if $(CONFIG_SING_BOX_WITH_WIREGUARD),with_wireguard) \
))
define Package/$(PKG_NAME)/conffiles
/etc/sing-box/config.json
endef
define Package/$(PKG_NAME)/install
$(call GoPackage/Package/Install/Bin,$(1))
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/sing-box.init $(1)/etc/init.d/sing-box
$(INSTALL_DIR) $(1)/etc/sing-box
$(INSTALL_DATA) ./files/config.json.example $(1)/etc/sing-box/config.json.example
endef
$(eval $(call GoBinPackage,sing-box))
$(eval $(call BuildPackage,sing-box))