small-package/sing-box/Makefile

70 lines
1.8 KiB
Makefile
Raw Normal View History

2022-09-06 20:23:01 +08:00
#
# 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
2022-09-15 20:26:22 +08:00
PKG_VERSION:=1.0.4
2022-09-06 20:23:01 +08:00
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/SagerNet/sing-box/tar.gz/v$(PKG_VERSION)?
2022-09-15 20:26:22 +08:00
PKG_HASH:=bf477345e54166c6226ef864f602ac048a26a13f9628d80f837a2084c777187a
2022-09-06 20:23:01 +08:00
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILE:=LICENSE
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/sagernet/sing-box
GO_PKG_LDFLAGS:=-s -w -buildid=
GO_PKG_BUILD_PKG:=$(GO_PKG)/cmd/sing-box
GO_PKG_LDFLAGS_X:=main.appVersion=v$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
define Package/sing-box
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
endef
GO_PKG_TARGET_VARS:=$(filter-out CGO_ENABLED=%,$(GO_PKG_TARGET_VARS)) CGO_ENABLED=0
2022-09-13 20:25:56 +08:00
GO_PKG_TAGS:=with_quic,with_grpc,with_wireguard
2022-09-06 20:23:01 +08:00
define Package/$(PKG_NAME)/conffiles
/etc/sing-box/config.json
endef
define Package/sing-box/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
endef
define Package/sing-box/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/sing-box stop >/dev/null 2>&1
/etc/init.d/sing-box disable >/dev/null 2>&1
fi
exit 0
endef
$(eval $(call GoBinPackage,sing-box))
$(eval $(call BuildPackage,sing-box))