Skip to content

Commit

Permalink
fix #803: add support for android arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Mar 24, 2021
1 parent 0a0cbfb commit 3da3361
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* Add support for Android on ARM 64-bit ([#803](https://github.com/evanw/esbuild/issues/803))

This release includes support for Android in the official `esbuild` package. It should now be possible to install and run esbuild on Android devices through npm.

* Fix incorrect MIME types on Windows ([#1030](https://github.com/evanw/esbuild/issues/1030))

The web server built into esbuild uses the file extension to determine the value of the `Content-Type` header. This was previously done using the `mime.TypeByExtension()` function from Go's standard library. However, this function is apparently broken on Windows because installed programs can change MIME types in the Windows registry: [golang/go#32350](https://github.com/golang/go/issues/32350). This release fixes the problem by using a copy of Go's `mime.TypeByExtension()` function without the part that reads from the Windows registry.
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ platform-all: cmd/esbuild/version.go test-all
make -j8 \
platform-windows \
platform-windows-32 \
platform-android-arm64 \
platform-darwin \
platform-darwin-arm64 \
platform-freebsd \
Expand Down Expand Up @@ -129,6 +130,9 @@ platform-unixlike:
cd "$(NPMDIR)" && npm version "$(ESBUILD_VERSION)" --allow-same-version
GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build "-ldflags=-s -w" -o "$(NPMDIR)/bin/esbuild" ./cmd/esbuild

platform-android-arm64:
make GOOS=android GOARCH=arm64 NPMDIR=npm/esbuild-android-arm64 platform-unixlike

platform-darwin:
make GOOS=darwin GOARCH=amd64 NPMDIR=npm/esbuild-darwin-64 platform-unixlike

Expand Down Expand Up @@ -180,15 +184,14 @@ publish-all: cmd/esbuild/version.go test-prepublish
publish-windows \
publish-windows-32 \
publish-freebsd \
publish-freebsd-arm64
publish-freebsd-arm64 \
publish-darwin \
publish-darwin-arm64
@echo Enter one-time password:
@read OTP && OTP="$$OTP" make -j4 \
publish-darwin \
publish-darwin-arm64 \
publish-android-arm64 \
publish-linux \
publish-linux-32
@echo Enter one-time password:
@read OTP && OTP="$$OTP" make -j4 \
publish-linux-arm \
publish-linux-arm64 \
publish-linux-mips64le \
Expand All @@ -208,6 +211,9 @@ publish-windows: platform-windows
publish-windows-32: platform-windows-32
test -n "$(OTP)" && cd npm/esbuild-windows-32 && npm publish --otp="$(OTP)"

publish-android-arm64: platform-android-arm64
test -n "$(OTP)" && cd npm/esbuild-android-arm64 && npm publish --otp="$(OTP)"

publish-darwin: platform-darwin
test -n "$(OTP)" && cd npm/esbuild-darwin-64 && npm publish --otp="$(OTP)"

Expand Down Expand Up @@ -248,6 +254,7 @@ clean:
rm -f esbuild
rm -f npm/esbuild-windows-32/esbuild.exe
rm -f npm/esbuild-windows-64/esbuild.exe
rm -rf npm/esbuild-android-arm64/bin
rm -rf npm/esbuild-darwin-64/bin
rm -rf npm/esbuild-darwin-arm64/bin
rm -rf npm/esbuild-freebsd-64/bin
Expand Down
3 changes: 2 additions & 1 deletion lib/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@ const knownWindowsPackages: Record<string, string> = {
'win32 x64 LE': 'esbuild-windows-64',
};
const knownUnixlikePackages: Record<string, string> = {
'darwin x64 LE': 'esbuild-darwin-64',
'android arm64 LE': 'esbuild-android-arm64',
'darwin arm64 LE': 'esbuild-darwin-arm64',
'darwin x64 LE': 'esbuild-darwin-64',
'freebsd arm64 LE': 'esbuild-freebsd-arm64',
'freebsd x64 LE': 'esbuild-freebsd-64',
'linux arm LE': 'esbuild-linux-arm',
Expand Down
3 changes: 3 additions & 0 deletions npm/esbuild-android-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# esbuild

This is the Android 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-android-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "esbuild-android-arm64",
"version": "0.9.6",
"description": "The Android ARM 64-bit binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
"os": [
"android"
],
"cpu": [
"arm64"
],
"directories": {
"bin": "bin"
}
}

0 comments on commit 3da3361

Please sign in to comment.