Skip to content

Commit

Permalink
Support Loongarch LE architecture (#2373)
Browse files Browse the repository at this point in the history
  • Loading branch information
beyond-1234 committed Aug 2, 2022
1 parent 296870e commit d6cf390
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@

Previously if you mutate the build results object, you had to overwrite both `contents` and `text` since the value returned from the `text` getter is the original text returned by esbuild. Some people find this confusing so with this release, the getter for `text` has been updated to do the UTF-8 to UTF-16 conversion on the current value of the `contents` property instead of the original value.

* Publish builds for Linux LoongArch 64-bit ([#1804](https://github.com/evanw/esbuild/issues/1804), [#2373](https://github.com/evanw/esbuild/pull/2373))

This release upgrades to [Go 1.19](https://go.dev/doc/go1.19), which now includes support for LoongArch 64-bit processors. LoongArch 64-bit builds of esbuild will now be published to npm, which means that in theory they can now be installed with `npm install esbuild`. This was contributed by [@beyond-1234](https://github.com/beyond-1234).

## 0.14.51

* Add support for React 17's `automatic` JSX transform ([#334](https://github.com/evanw/esbuild/issues/334), [#718](https://github.com/evanw/esbuild/issues/718), [#1172](https://github.com/evanw/esbuild/issues/1172), [#2318](https://github.com/evanw/esbuild/issues/2318), [#2349](https://github.com/evanw/esbuild/pull/2349))
Expand Down
28 changes: 19 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ platform-all:
platform-linux-32 \
platform-linux-arm \
platform-linux-arm64 \
platform-linux-loong64 \
platform-linux-mips64le \
platform-linux-ppc64le \
platform-linux-riscv64 \
Expand Down Expand Up @@ -327,6 +328,9 @@ platform-linux-arm:
platform-linux-arm64:
@$(MAKE) --no-print-directory GOOS=linux GOARCH=arm64 NPMDIR=npm/esbuild-linux-arm64 platform-unixlike

platform-linux-loong64:
@$(MAKE) --no-print-directory GOOS=linux GOARCH=loong64 NPMDIR=npm/@esbuild/linux-loong64 platform-unixlike

platform-linux-mips64le:
@$(MAKE) --no-print-directory GOOS=linux GOARCH=mips64le NPMDIR=npm/esbuild-linux-mips64le platform-unixlike

Expand Down Expand Up @@ -406,6 +410,7 @@ publish-all: check-go-version
@echo Enter one-time password:
@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
publish-linux-arm64 \
publish-linux-loong64 \
publish-linux-mips64le \
publish-linux-ppc64le \
publish-linux-s390x
Expand Down Expand Up @@ -464,6 +469,9 @@ publish-linux-arm: platform-linux-arm
publish-linux-arm64: platform-linux-arm64
test -n "$(OTP)" && cd npm/esbuild-linux-arm64 && npm publish --otp="$(OTP)"

publish-linux-loong64: platform-linux-loong64
test -n "$(OTP)" && cd npm/@esbuild/linux-loong64 && npm publish --otp="$(OTP)"

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

Expand Down Expand Up @@ -498,14 +506,14 @@ validate-build:
@test -n "$(TARGET)" || (echo "The environment variable TARGET must be provided" && false)
@test -n "$(PACKAGE)" || (echo "The environment variable PACKAGE must be provided" && false)
@test -n "$(SUBPATH)" || (echo "The environment variable SUBPATH must be provided" && false)
@echo && echo "🔷 Checking $(PACKAGE)"
@echo && echo "🔷 Checking $(SCOPE)$(PACKAGE)"
@rm -fr validate && mkdir validate
@$(MAKE) --no-print-directory "$(TARGET)"
@curl -s "https://registry.npmjs.org/$(PACKAGE)/-/$(PACKAGE)-$(ESBUILD_VERSION).tgz" > validate/esbuild.tgz
@curl -s "https://registry.npmjs.org/$(SCOPE)$(PACKAGE)/-/$(PACKAGE)-$(ESBUILD_VERSION).tgz" > validate/esbuild.tgz
@cd validate && tar xf esbuild.tgz
@ls -l "npm/$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)" && \
shasum "npm/$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)" && \
cmp "npm/$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)"
@ls -l "npm/$(SCOPE)$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)" && \
shasum "npm/$(SCOPE)$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)" && \
cmp "npm/$(SCOPE)$(PACKAGE)/$(SUBPATH)" "validate/package/$(SUBPATH)"
@rm -fr validate

# This checks that the published binaries are bitwise-identical to the locally-build binaries
Expand All @@ -521,6 +529,7 @@ validate-builds:
@$(MAKE) --no-print-directory TARGET=platform-linux-32 PACKAGE=esbuild-linux-32 SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-linux-arm PACKAGE=esbuild-linux-arm SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-linux-arm64 PACKAGE=esbuild-linux-arm64 SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-linux-loong64 SCOPE=@esbuild/ PACKAGE=linux-loong64 SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-linux-mips64le PACKAGE=esbuild-linux-mips64le SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-linux-ppc64le PACKAGE=esbuild-linux-ppc64le SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-linux-riscv64 PACKAGE=esbuild-linux-riscv64 SUBPATH=bin/esbuild validate-build
Expand All @@ -535,9 +544,12 @@ validate-builds:

clean:
rm -f esbuild
rm -f npm/esbuild-wasm/esbuild.wasm npm/esbuild-wasm/wasm_exec.js npm/esbuild-wasm/exit0.js
rm -f npm/esbuild-windows-32/esbuild.exe
rm -f npm/esbuild-windows-64/esbuild.exe
rm -f npm/esbuild-windows-arm64/esbuild.exe
rm -f npm/esbuild/install.js
rm -rf npm/@esbuild/linux-loong64/bin
rm -rf npm/esbuild-android-64/bin
rm -rf npm/esbuild-android-64/esbuild.wasm npm/esbuild-android-64/wasm_exec.js npm/esbuild-android-64/exit0.js
rm -rf npm/esbuild-android-arm64/bin
Expand All @@ -556,12 +568,10 @@ clean:
rm -rf npm/esbuild-netbsd-64/bin
rm -rf npm/esbuild-openbsd-64/bin
rm -rf npm/esbuild-sunos-64/bin
rm -rf npm/esbuild/bin
rm -f npm/esbuild-wasm/esbuild.wasm npm/esbuild-wasm/wasm_exec.js npm/esbuild-wasm/exit0.js
rm -f npm/esbuild/install.js
rm -rf npm/esbuild/lib
rm -rf npm/esbuild-wasm/esm
rm -rf npm/esbuild-wasm/lib
rm -rf npm/esbuild/bin
rm -rf npm/esbuild/lib
rm -rf require/*/bench/
rm -rf require/*/demo/
rm -rf require/*/node_modules/
Expand Down
1 change: 1 addition & 0 deletions lib/npm/node-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const knownUnixlikePackages: Record<string, string> = {
'linux riscv64 LE': 'esbuild-linux-riscv64',
'linux s390x BE': 'esbuild-linux-s390x',
'linux x64 LE': 'esbuild-linux-64',
'linux loong64 LE': 'esbuild-linux-loong64',
'netbsd x64 LE': 'esbuild-netbsd-64',
'openbsd x64 LE': 'esbuild-openbsd-64',
'sunos x64 LE': 'esbuild-sunos-64',
Expand Down
3 changes: 3 additions & 0 deletions npm/@esbuild/linux-loong64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# esbuild

This is the Linux LoongArch 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
17 changes: 17 additions & 0 deletions npm/@esbuild/linux-loong64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@esbuild/linux-loong64",
"version": "0.0.1",
"description": "The Linux LoongArch 64-bit binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
"preferUnplugged": false,
"engines": {
"node": ">=12"
},
"os": [
"linux"
],
"cpu": [
"loong64"
]
}
1 change: 1 addition & 0 deletions npm/esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"esbuild-linux-64": "0.14.51",
"esbuild-linux-arm": "0.14.51",
"esbuild-linux-arm64": "0.14.51",
"esbuild-linux-loong64": "0.14.51",
"esbuild-linux-mips64le": "0.14.51",
"esbuild-linux-ppc64le": "0.14.51",
"esbuild-linux-riscv64": "0.14.51",
Expand Down

0 comments on commit d6cf390

Please sign in to comment.