From 1beed69cd4cc833b950aea966299a03d4478a3d8 Mon Sep 17 00:00:00 2001 From: bgme Date: Tue, 16 May 2023 23:44:31 +0800 Subject: [PATCH] add sing-box-git --- repo/sing-box-git/PKGBUILD | 70 ++++++++++++++++++++++++++++++++++++ repo/sing-box-git/lilac.yaml | 14 ++++++++ 2 files changed, 84 insertions(+) create mode 100644 repo/sing-box-git/PKGBUILD create mode 100644 repo/sing-box-git/lilac.yaml diff --git a/repo/sing-box-git/PKGBUILD b/repo/sing-box-git/PKGBUILD new file mode 100644 index 0000000..5830aa0 --- /dev/null +++ b/repo/sing-box-git/PKGBUILD @@ -0,0 +1,70 @@ +# Maintainer: everyx +# Contributor: BGME + +pkgname=sing-box-git +_pkgname=sing-box +pkgver=1.3beta11.r9.g5065ab3e +pkgrel=1 + +pkgdesc='The universal proxy platform (git version).' +arch=('x86_64' 'i686') +url='https://sing-box.sagernet.org/' +license=('GPL3 with name use or association addition') + +provides=("$_pkgname") +conflicts=("sing-box" "sing-box-beta") + +makedepends=('go' 'git') +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") +sha256sums=(SKIP) + +pkgver() { + cd "$_pkgname" + git describe --tags --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-\([^-]*\)-\([^-]*\)$/.\1.\2/;s/-//' +} + +_tags=with_quic,with_grpc,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_clash_api,with_v2ray_api,with_gvisor +build() { + cd "$_pkgname" + + export CGO_CPPFLAGS="$CPPFLAGS" + export CGO_CFLAGS="$CFLAGS" + export CGO_CXXFLAGS="$CXXFLAGS" + export CGO_LDFLAGS="$LDFLAGS" + export VERSION=$(go run ./cmd/internal/read_tag) + + 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 + + sed -i "/^\[Service\]$/a User=$_pkgname" release/config/$_pkgname*.service + + echo 'u sing-box - "Sing-box Service" - -' >"release/config/$_pkgname.sysusers" +} + +package() { + cd "$_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 "release/config/$_pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$_pkgname.conf" +} diff --git a/repo/sing-box-git/lilac.yaml b/repo/sing-box-git/lilac.yaml new file mode 100644 index 0000000..a9ef958 --- /dev/null +++ b/repo/sing-box-git/lilac.yaml @@ -0,0 +1,14 @@ +maintainers: + - github: yingziwu + email: i@bgme.me + +build_prefix: extra-x86_64 + +pre_build: vcs_update + +post_build: git_pkgbuild_commit + +update_on: + - source: github + github: SagerNet/sing-box + - source: vcs