Skip to content

Commit 16ada83

Browse files
brvphoenixhnyman
authored andcommitted
sing-box: add variant tiny
The tiny version disables tailscale by default for small package size. OpenWrt also has the tailscale package as an alternative. We prefer to keep the base version has the same build tags with the upstream releases for compatibility. Signed-off-by: Van Waholtz <[email protected]>
1 parent 28ac7b8 commit 16ada83

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

net/sing-box/Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,25 @@ define Package/sing-box
3131
URL:=https://sing-box.sagernet.org
3232
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle +kmod-inet-diag +kmod-tun
3333
USERID:=sing-box=5566:sing-box=5566
34+
VARIANT:=full
35+
DEFAULT_VARIANT:=1
3436
endef
3537

3638
define Package/sing-box/description
3739
Sing-box is a universal proxy platform which supports hysteria, SOCKS, Shadowsocks,
3840
ShadowTLS, Tor, trojan, VLess, VMess, WireGuard and so on.
3941
endef
4042

43+
define Package/sing-box-tiny
44+
$(Package/sing-box)
45+
TITLE+=(tiny)
46+
PROVIDES:=sing-box
47+
VARIANT:=tiny
48+
CONFLICTS:=sing-box
49+
endef
50+
51+
Package/sing-box-tiny/description:=$(Package/sing-box/description)
52+
4153
define Package/sing-box/config
4254
menu "Select build options"
4355
depends on PACKAGE_sing-box
@@ -96,6 +108,12 @@ PKG_CONFIG_DEPENDS:= \
96108
CONFIG_SINGBOX_WITH_V2RAY_API \
97109
CONFIG_SINGBOX_WITH_WIREGUARD
98110

111+
ifeq ($(BUILD_VARIANT),tiny)
112+
ifeq ($(CONFIG_SMALL_FLASH),)
113+
GO_PKG_TAGS:=with_gvisor
114+
endif
115+
GO_PKG_TAGS:=$(GO_PKG_TAGS),with_quic,with_utls,with_clash_api
116+
else
99117
GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \
100118
$(if $(CONFIG_SINGBOX_WITH_ACME),with_acme) \
101119
$(if $(CONFIG_SINGBOX_WITH_CLASH_API),with_clash_api) \
@@ -109,12 +127,15 @@ GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \
109127
$(if $(CONFIG_SINGBOX_WITH_V2RAY_API),with_v2ray_api) \
110128
$(if $(CONFIG_SINGBOX_WITH_WIREGUARD),with_wireguard) \
111129
))
130+
endif
112131

113132
define Package/sing-box/conffiles
114133
/etc/config/sing-box
115134
/etc/sing-box/
116135
endef
117136

137+
Package/sing-box-tiny/conffiles=$(Package/sing-box/conffiles)
138+
118139
define Package/sing-box/install
119140
$(INSTALL_DIR) $(1)/usr/bin/
120141
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/sing-box $(1)/usr/bin/sing-box
@@ -128,4 +149,7 @@ define Package/sing-box/install
128149
$(INSTALL_BIN) ./files/sing-box.init $(1)/etc/init.d/sing-box
129150
endef
130151

152+
Package/sing-box-tiny/install=$(Package/sing-box/install)
153+
131154
$(eval $(call BuildPackage,sing-box))
155+
$(eval $(call BuildPackage,sing-box-tiny))

0 commit comments

Comments
 (0)