This commit is contained in:
iceBear67
2026-07-24 15:20:50 +00:00
parent 3b0a360ac8
commit 17b805ea94
6 changed files with 47 additions and 32 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
// This file is substituted in via `go build -overlay` for the js/wasm build ONLY.
// This file is copied over the upstream sing source (in a build-local copy of the
// module) for the js/wasm build ONLY; see build.sh.
//
// Upstream common/buf/buffer_unix.go (build tag `!windows`) defines
// Buffer.Iovec returning golang.org/x/sys/unix.Iovec, which does not exist for
+2 -1
View File
@@ -1,4 +1,5 @@
// Substituted in via `go build -overlay` for the js/wasm build ONLY.
// Copied over the upstream sing source (in a build-local copy of the module) for
// the js/wasm build ONLY; see build.sh.
//
// Upstream common/bufio/copy_direct_posix.go (build tag `!windows`) implements
// the syscall read-waiters using golang.org/x/sys/unix (readv/recvmsg). wait.go
+2 -1
View File
@@ -1,4 +1,5 @@
// Substituted in via `go build -overlay` for the js/wasm build ONLY.
// Copied over the upstream sing source (in a build-local copy of the module) for
// the js/wasm build ONLY; see build.sh.
//
// Upstream common/bufio/vectorised_unix.go (build tag `!windows`) implements the
// syscall-based vectorised writers using golang.org/x/sys/unix (Iovec, writev,
-21
View File
@@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Generates the -overlay JSON that swaps the three sing source files that pull in
# golang.org/x/sys/unix (unavailable for GOARCH=wasm) for wasm-safe stubs in
# ./_stubs. Only the js/wasm build uses this overlay; native builds and tests are
# unaffected. The stubs live in an underscore-prefixed directory so the go tool
# ignores them during ./... builds (they carry mixed package names). See
# _stubs/*.go for the rationale of each substitution.
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
sing="$(cd "$here/.." && go list -m -f '{{.Dir}}' github.com/sagernet/sing)"
cat <<JSON
{
"Replace": {
"$sing/common/buf/buffer_unix.go": "$here/_stubs/buf_buffer_unix.go",
"$sing/common/bufio/vectorised_unix.go": "$here/_stubs/bufio_vectorised_unix.go",
"$sing/common/bufio/copy_direct_posix.go": "$here/_stubs/bufio_copy_direct_posix.go"
}
}
JSON