small-package/sing-box/Makefile

148 lines
4.3 KiB
Makefile
Raw Normal View History

2024-02-29 01:07:51 +08:00
# SPDX-License-Identifier: GPL-3.0-only
2023-02-01 20:20:39 +08:00
#
2024-02-29 01:07:51 +08:00
# Copyright (C) 2022-2023 ImmortalWrt.org
2023-02-01 20:20:39 +08:00
include $(TOPDIR)/rules.mk
PKG_NAME:=sing-box
2024-02-29 01:07:51 +08:00
PKG_VERSION:=1.8.7
2023-02-01 20:20:39 +08:00
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)?
2024-02-29 01:07:51 +08:00
PKG_HASH:=35db2a6953c04ea6301f242ba2d6c7ca7f6d52bae0b4927beca5255ee958b218
2023-02-01 20:20:39 +08:00
2023-05-10 16:22:46 +08:00
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE
2024-02-29 01:07:51 +08:00
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_CONFIG_DEPENDS:= \
CONFIG_SING_BOX_BUILD_ACME \
CONFIG_SING_BOX_BUILD_CLASH_API \
CONFIG_SING_BOX_BUILD_DHCP \
CONFIG_SING_BOX_BUILD_ECH \
CONFIG_SING_BOX_BUILD_EMBEDDED_TOR \
CONFIG_SING_BOX_BUILD_GRPC \
CONFIG_SING_BOX_BUILD_GVISOR \
CONFIG_SING_BOX_BUILD_LWIP \
CONFIG_SING_BOX_BUILD_QUIC \
CONFIG_SING_BOX_BUILD_REALITY_SERVER \
CONFIG_SING_BOX_BUILD_UTLS \
CONFIG_SING_BOX_BUILD_V2RAY_API \
CONFIG_SING_BOX_BUILD_WIREGUARD
2023-02-01 20:20:39 +08:00
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
2023-09-14 11:24:21 +08:00
PKG_BUILD_FLAGS:=no-mips16
2023-02-01 20:20:39 +08:00
GO_PKG:=github.com/sagernet/sing-box
GO_PKG_BUILD_PKG:=$(GO_PKG)/cmd/sing-box
2024-02-29 01:07:51 +08:00
GO_PKG_LDFLAGS_X:=$(GO_PKG)/constant.Version=$(PKG_VERSION)
2023-02-01 20:20:39 +08:00
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
2024-02-29 01:07:51 +08:00
define Package/sing-box
2023-02-01 20:20:39 +08:00
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
2024-02-29 01:07:51 +08:00
TITLE:=The universal proxy platform
URL:=https://sing-box.sagernet.org/
2023-02-01 20:20:39 +08:00
DEPENDS:=$(GO_ARCH_DEPENDS) \
+ca-bundle \
+kmod-inet-diag \
+kmod-netlink-diag \
2024-02-29 01:07:51 +08:00
+(SING_BOX_BUILD_GVISOR||SING_BOX_BUILD_LWIP):kmod-tun
USERID:=sing-box=5566:sing-box=5566
2023-02-01 20:20:39 +08:00
endef
2024-02-29 01:07:51 +08:00
define Package/sing-box/config
if PACKAGE_sing-box
config SING_BOX_BUILD_ACME
bool "Build with ACME TLS certificate issuer support"
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_CLASH_API
bool "Build with Clash API support"
default y
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_DHCP
bool "Build with DHCP support"
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_ECH
bool "Build with TLS ECH extension support"
default y
2023-05-10 16:22:46 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_EMBEDDED_TOR
bool "Build with embedded Tor support"
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_GRPC
bool "Build with standard gPRC support"
help
Standard gRPC has good compatibility but poor performance.
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_GVISOR
bool "Build with gVisor support"
default y
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_LWIP
bool "Build with LWIP Tun stack support"
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_QUIC
bool "Build with QUIC support"
default y
help
Required by HTTP3 DNS transports, Naive inbound,
Hysteria inbound / outbound, and v2ray QUIC transport.
2023-05-10 16:22:46 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_REALITY_SERVER
bool "Build with REALITY TLS server support"
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_UTLS
bool "Build with uTLS support"
default y
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_V2RAY_API
bool "Build with V2Ray API support"
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
config SING_BOX_BUILD_WIREGUARD
bool "Build with WireGuard support"
default y
endif
2023-02-01 20:20:39 +08:00
endef
2023-05-10 16:22:46 +08:00
GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \
2024-02-29 01:07:51 +08:00
$(if $(CONFIG_SING_BOX_BUILD_ACME),with_acme) \
$(if $(CONFIG_SING_BOX_BUILD_CLASH_API),with_clash_api) \
$(if $(CONFIG_SING_BOX_BUILD_DHCP),with_dhcp) \
$(if $(CONFIG_SING_BOX_BUILD_ECH),with_ech) \
$(if $(CONFIG_SING_BOX_BUILD_EMBEDDED_TOR),with_embedded_tor) \
$(if $(CONFIG_SING_BOX_BUILD_GRPC),with_grpc) \
$(if $(CONFIG_SING_BOX_BUILD_GVISOR),with_gvisor) \
$(if $(CONFIG_SING_BOX_BUILD_LWIP),with_lwip) \
$(if $(CONFIG_SING_BOX_BUILD_QUIC),with_quic) \
$(if $(CONFIG_SING_BOX_BUILD_REALITY_SERVER),with_reality_server) \
$(if $(CONFIG_SING_BOX_BUILD_UTLS),with_utls) \
$(if $(CONFIG_SING_BOX_BUILD_V2RAY_API),with_v2ray_api) \
$(if $(CONFIG_SING_BOX_BUILD_WIREGUARD),with_wireguard) \
2023-05-10 16:22:46 +08:00
))
2023-02-01 20:20:39 +08:00
2024-02-29 01:07:51 +08:00
define Package/sing-box/conffiles
/etc/config/sing-box
/etc/sing-box/
2023-02-01 20:20:39 +08:00
endef
2024-02-29 01:07:51 +08:00
define Package/sing-box/install
2023-02-01 20:20:39 +08:00
$(call GoPackage/Package/Install/Bin,$(1))
$(INSTALL_DIR) $(1)/etc/sing-box
2024-02-29 01:07:51 +08:00
$(INSTALL_DATA) $(PKG_BUILD_DIR)/release/config/config.json $(1)/etc/sing-box
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_CONF) ./files/sing-box.conf $(1)/etc/config/sing-box
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) ./files/sing-box.init $(1)/etc/init.d/sing-box
2023-02-01 20:20:39 +08:00
endef
$(eval $(call GoBinPackage,sing-box))
$(eval $(call BuildPackage,sing-box))