aports/testing/sing-box/APKBUILD
2025-04-11 19:40:50 +02:00

59 lines
2.4 KiB
Text

# Contributor: Anon <danilagdn.2004@gmail.com>
# Maintainer: Lindsay Zhou <i@lin.moe>
maintainer="Lindsay Zhou <i@lin.moe>"
pkgname=sing-box
pkgver=1.11.7
pkgrel=1
pkgdesc="The universal proxy platform"
url="https://sing-box.sagernet.org/"
arch="all"
license="GPL-3.0-or-later with name use or association addition"
makedepends="go"
subpackages="$pkgname-openrc $pkgname-bash-completion $pkgname-fish-completion $pkgname-zsh-completion"
options="net" # go modules
source="$pkgname-$pkgver.tar.gz::https://github.com/SagerNet/sing-box/archive/v$pkgver.tar.gz
$pkgname.initd
$pkgname.confd
"
_tags="with_gvisor,with_quic,with_wireguard,with_utls,with_reality_server,with_clash_api,with_ech,with_dhcp,with_acme"
build() {
export CGO_CPPFLAGS="$CPPFLAGS"
export CGO_CFLAGS="$CFLAGS"
export CGO_CXXFLAGS="$CXXFLAGS"
export CGO_LDFLAGS="$LDFLAGS"
go build -v -tags "$_tags" \
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$pkgver\" -s -w
-buildid= -linkmode=external" ./cmd/sing-box
install -d completions
go run ./cmd/sing-box completion bash > completions/bash
go run ./cmd/sing-box completion fish > completions/fish
go run ./cmd/sing-box completion zsh > completions/zsh
}
check() {
go test -v ./...
# require docker to run test cases in the "test" submodule,
# so we don't use `make test`.
}
package() {
install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
install -Dm755 "$pkgname" -t "$pkgdir/usr/bin"
install -Dm644 "release/config/config.json" -t "$pkgdir/etc/$pkgname"
install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
install -Dm755 "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname"
install -Dm644 completions/bash "$pkgdir/usr/share/bash-completion/completions/$pkgname.bash"
install -Dm644 completions/fish "$pkgdir/usr/share/fish/vendor_completions.d/$pkgname.fish"
install -Dm644 completions/zsh "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
}
sha512sums="
33b469596d95cb25a094381cf88369fa0fd205330f61bb0a2e0b8a6b5426ec91565f8c530701023fb914a16aa17812674fffcf1ccf9aed2bf9edf4c4a7c2befe sing-box-1.11.7.tar.gz
1fd26edaeefb94d3fbf53a8310efad1776c2a90c6497481def603667e565bbca9f75ef670bb1e3c06488ab8a68ff27943f2f828fdb2b869ee6c2da95425cbccb sing-box.initd
448184b1ea062f93854c61c86b591681b35767bf475c2643e416e41f84da5b1a793351613470909b17c533ddf964ccbf438aa3454073e8e84d0f4d3ef0385654 sing-box.confd
"