Files

18 lines
836 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Unmodified upstream, pinned source; custom tags enable per-user statistics.
SOURCE_COMMIT=af6e64c3b69e6132ebaee0e1a3d24e93903f6709
DEST=$(pwd)/data/artifacts
mkdir -p "$DEST"
WORK=$(mktemp -d)
trap 'rm -rf "$WORK"' EXIT
git clone --depth 1 --branch v1.14.2 https://github.com/SagerNet/sing-box.git "$WORK/source"
[ "$(git -C "$WORK/source" rev-parse HEAD)" = "$SOURCE_COMMIT" ]
for arch in amd64 arm64; do
(cd "$WORK/source" && CGO_ENABLED=0 GOOS=linux GOARCH=$arch go build -trimpath -tags with_v2ray_api,with_clash_api,with_utls \
-ldflags '-s -w -X github.com/sagernet/sing-box/constant.Version=1.14.2' \
-o "$DEST/sing-box-1.14.2-linux-$arch" ./cmd/sing-box)
done
cp "$WORK/source/LICENSE" "$DEST/sing-box-LICENSE"
(cd "$DEST" && shasum -a 256 sing-box-1.14.2-linux-* > SHA256SUMS)