sing-box: add variant tiny
authorVan Waholtz <[email protected]>
Sun, 31 Aug 2025 17:22:20 +0000 (01:22 +0800)
committerHannu Nyman <[email protected]>
Tue, 2 Sep 2025 04:13:44 +0000 (07:13 +0300)
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]>
net/sing-box/Makefile

index 7a3da84e6ff686d59676bfbb67926acbbde62304..b56feaa93293d7f8714a06b5cf8e41dd84b90563 100644 (file)
@@ -31,6 +31,8 @@ define Package/sing-box
   URL:=https://sing-box.sagernet.org
   DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle +kmod-inet-diag +kmod-tun
   USERID:=sing-box=5566:sing-box=5566
+  VARIANT:=full
+  DEFAULT_VARIANT:=1
 endef
 
 define Package/sing-box/description
@@ -38,6 +40,16 @@ define Package/sing-box/description
   ShadowTLS, Tor, trojan, VLess, VMess, WireGuard and so on.
 endef
 
+define Package/sing-box-tiny
+  $(Package/sing-box)
+  TITLE+=(tiny)
+  PROVIDES:=sing-box
+  VARIANT:=tiny
+  CONFLICTS:=sing-box
+endef
+
+Package/sing-box-tiny/description:=$(Package/sing-box/description)
+
 define Package/sing-box/config
        menu "Select build options"
                depends on PACKAGE_sing-box
@@ -96,6 +108,12 @@ PKG_CONFIG_DEPENDS:= \
        CONFIG_SINGBOX_WITH_V2RAY_API \
        CONFIG_SINGBOX_WITH_WIREGUARD
 
+ifeq ($(BUILD_VARIANT),tiny)
+ifeq ($(CONFIG_SMALL_FLASH),)
+GO_PKG_TAGS:=with_gvisor
+endif
+GO_PKG_TAGS:=$(GO_PKG_TAGS),with_quic,with_utls,with_clash_api
+else
 GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \
        $(if $(CONFIG_SINGBOX_WITH_ACME),with_acme) \
        $(if $(CONFIG_SINGBOX_WITH_CLASH_API),with_clash_api) \
@@ -109,12 +127,15 @@ GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \
        $(if $(CONFIG_SINGBOX_WITH_V2RAY_API),with_v2ray_api) \
        $(if $(CONFIG_SINGBOX_WITH_WIREGUARD),with_wireguard) \
 ))
+endif
 
 define Package/sing-box/conffiles
 /etc/config/sing-box
 /etc/sing-box/
 endef
 
+Package/sing-box-tiny/conffiles=$(Package/sing-box/conffiles)
+
 define Package/sing-box/install
        $(INSTALL_DIR) $(1)/usr/bin/
        $(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/sing-box $(1)/usr/bin/sing-box
@@ -128,4 +149,7 @@ define Package/sing-box/install
        $(INSTALL_BIN) ./files/sing-box.init $(1)/etc/init.d/sing-box
 endef
 
+Package/sing-box-tiny/install=$(Package/sing-box/install)
+
 $(eval $(call BuildPackage,sing-box))
+$(eval $(call BuildPackage,sing-box-tiny))