Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for ARM64 #125

Merged
merged 2 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ update-version-go:
echo "package main\n\nconst esbuildVersion = \"$(ESBUILD_VERSION)\"" > cmd/esbuild/version.go

platform-all: update-version-go test test-wasm
make -j5 platform-windows platform-darwin platform-linux platform-wasm platform-neutral
make -j6 platform-windows platform-darwin platform-linux platform-linux-arm64 platform-wasm platform-neutral

platform-windows:
cd npm/esbuild-windows-64 && npm version "$(ESBUILD_VERSION)" --allow-same-version
Expand All @@ -39,6 +39,11 @@ platform-linux:
cd npm/esbuild-linux-64 && npm version "$(ESBUILD_VERSION)" --allow-same-version
GOOS=linux GOARCH=amd64 go build -o npm/esbuild-linux-64/bin/esbuild ./cmd/esbuild

platform-linux-arm64:
mkdir -p npm/esbuild-linux-arm64/bin
cd npm/esbuild-linux-arm64 && npm version "$(ESBUILD_VERSION)" --allow-same-version
GOOS=linux GOARCH=arm64 go build -o npm/esbuild-linux-arm64/bin/esbuild ./cmd/esbuild

platform-wasm:
GOOS=js GOARCH=wasm go build -o npm/esbuild-wasm/esbuild.wasm ./cmd/esbuild
cd npm/esbuild-wasm && npm version "$(ESBUILD_VERSION)" --allow-same-version
Expand All @@ -50,7 +55,7 @@ platform-neutral:
cd npm/esbuild && npm version "$(ESBUILD_VERSION)" --allow-same-version

publish-all: update-version-go test test-wasm
make -j5 publish-windows publish-darwin publish-linux publish-wasm publish-neutral
make -j6 publish-windows publish-darwin publish-linux publish-linux-arm64 publish-wasm publish-neutral
git commit -am "publish $(ESBUILD_VERSION) to npm"
git tag "v$(ESBUILD_VERSION)"
git push origin master "v$(ESBUILD_VERSION)"
Expand All @@ -64,6 +69,9 @@ publish-darwin: platform-darwin
publish-linux: platform-linux
[ ! -z "$(OTP)" ] && cd npm/esbuild-linux-64 && npm publish --otp="$(OTP)"

publish-linux-arm64: platform-linux-arm64
[ ! -z "$(OTP)" ] && cd npm/esbuild-linux-arm64 && npm publish --otp="$(OTP)"

publish-wasm: platform-wasm
[ ! -z "$(OTP)" ] && cd npm/esbuild-wasm && npm publish --otp="$(OTP)"

Expand Down
3 changes: 3 additions & 0 deletions npm/esbuild-linux-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# esbuild

This is the Linux ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
16 changes: 16 additions & 0 deletions npm/esbuild-linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "esbuild-linux-arm64",
"version": "0.3.5",
"description": "The Linux ARM 64-bit binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"directories": {
"bin": "bin"
}
}
2 changes: 2 additions & 0 deletions npm/esbuild/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ child_process.spawnSync(esbuild_exe, process.argv.slice(2), { stdio: 'inherit' }
// Pick a package to install
if (process.platform === 'linux' && os.arch() === 'x64') {
installOnUnix('esbuild-linux-64');
} else if (process.platform === 'linux' && os.arch() === 'arm64') {
installOnUnix('esbuild-linux-arm64');
} else if (process.platform === 'darwin' && os.arch() === 'x64') {
installOnUnix('esbuild-darwin-64');
} else if (process.platform === 'win32' && os.arch() === 'x64') {
Expand Down
7 changes: 7 additions & 0 deletions npm/esbuild/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ function esbuildSpawn({ flags, stdio }) {
});
}

if (process.platform === 'linux' && os.arch() === 'arm64') {
return child_process.spawn(path.join(__dirname, '..', 'bin', 'esbuild'), flags, {
cwd: process.cwd(),
stdio,
});
}

if (process.platform === 'win32' && os.arch() === 'x64') {
if (WASM) {
return child_process.spawn('node', [path.join(__dirname, '..', 'bin', 'esbuild')].concat(flags), {
Expand Down