mirror of
https://github.com/hanzoai/esbuild.git
synced 2026-09-24 16:58:50 +00:00
omit go's buildvcs for more reproducible builds
This commit is contained in:
@@ -8,7 +8,7 @@ PATH_SEPARATOR = $(shell if uname | grep -qE "MINGW|WIN32|CYGWIN"; then echo ";"
|
||||
GO_COMPILER = PATH="$(GO_DIR)/bin$(PATH_SEPARATOR)$(PATH)" GOROOT="$(GO_DIR)" CGO_ENABLED=0
|
||||
|
||||
# Strip debug info and clear the build id for reproducible builds
|
||||
GO_FLAGS += "-ldflags=-s -w -buildid="
|
||||
GO_FLAGS += "-ldflags=-s -w -buildid=" -buildvcs=false
|
||||
|
||||
# Avoid embedding the build path in the executable for more reproducible builds
|
||||
GO_FLAGS += -trimpath
|
||||
|
||||
+2
-1
@@ -134,6 +134,7 @@ exports.buildWasmLib = async (esbuildPath) => {
|
||||
'build',
|
||||
'-o', path.join(npmWasmDir, 'esbuild.wasm'),
|
||||
'-ldflags=-s -w -buildid=', // This removes ~0.14mb of unnecessary WebAssembly code
|
||||
'-buildvcs=false',
|
||||
'-trimpath',
|
||||
path.join(repoDir, 'cmd', 'esbuild'),
|
||||
],
|
||||
@@ -278,7 +279,7 @@ exports.writeFileAtomic = (where, contents) => {
|
||||
}
|
||||
|
||||
exports.buildBinary = () => {
|
||||
childProcess.execFileSync('go', ['build', '-ldflags=-s -w -buildid=', '-trimpath', './cmd/esbuild'], { cwd: repoDir, stdio: 'ignore' })
|
||||
childProcess.execFileSync('go', ['build', '-ldflags=-s -w -buildid=', '-buildvcs=false', '-trimpath', './cmd/esbuild'], { cwd: repoDir, stdio: 'ignore' })
|
||||
return path.join(repoDir, process.platform === 'win32' ? 'esbuild.exe' : 'esbuild')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user