# Maintainer: BGME # Contributor: everyx pkgname=sing-box-git _pkgname=sing-box pkgver=1.3.5.r5.gca47b9b6 pkgrel=1 pkgdesc='The universal proxy platform (git version).' arch=('x86_64' 'i686') url='https://sing-box.sagernet.org/' license=('GPL3') provides=("${_pkgname}") conflicts=("sing-box" "sing-box-beta") makedepends=('go' 'git' 'patch') optdepends=( 'sing-geosite: sing-geosite database' 'sing-geoip: sing-geoip database' ) backup=("etc/${_pkgname}/config.json") source=( "${_pkgname}::git+https://github.com/SagerNet/sing-box.git#branch=dev-next" "sing-box.sysusers" "sing-box.tmpfiles" "0001-sing-box-service.patch" ) sha256sums=( 'SKIP' '35b9966604f3e5cf2acf9b86a7a1826b73829d59e04f283acaf89e84d9f4f4f7' '83f27690c2b37823b4de56d890462ac32118c6984554e32b4f6d25b93426a94f' 'b7a21a59ce2ec82fdded6b8a9e337c4f43e85a0688ad4a26f0f601aefa44dc54' ) pkgver() { cd "${srcdir}/${_pkgname}" git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-\([^-]*\)-\([^-]*\)$/.\1.\2/;s/-//' } _tags=with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_reality_server,with_clash_api,with_acme build() { cd "${srcdir}/${_pkgname}" export COMMIT=$(git rev-parse --short HEAD) export VERSION=$(go run ./cmd/internal/read_tag) export CGO_CPPFLAGS="$CPPFLAGS" export CGO_CFLAGS="$CFLAGS" export CGO_CXXFLAGS="$CXXFLAGS" export CGO_LDFLAGS="$LDFLAGS" go build \ -v \ -trimpath \ -buildmode=pie \ -mod=readonly \ -modcacherw \ -tags "$_tags" \ -ldflags " -X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid= -linkmode=external" \ ./cmd/sing-box cd release/config/ patch -p1 <"${srcdir}/0001-sing-box-service.patch" } package() { cd "${srcdir}/${_pkgname}" 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 -Dm644 "release/config/${_pkgname}.service" -t "${pkgdir}/usr/lib/systemd/system" install -Dm644 "release/config/${_pkgname}@.service" -t "${pkgdir}/usr/lib/systemd/system" install -Dm644 "${srcdir}/sing-box.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_pkgname}.conf" install -Dm644 "${srcdir}/sing-box.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_pkgname}.conf" }