From d6cf390388d8f796f6a0f90ff5a3666e49d80363 Mon Sep 17 00:00:00 2001 From: beyond_1234 Date: Wed, 3 Aug 2022 05:19:11 +0800 Subject: [PATCH] Support Loongarch LE architecture (#2373) --- CHANGELOG.md | 4 ++++ Makefile | 28 +++++++++++++++++-------- lib/npm/node-platform.ts | 1 + npm/@esbuild/linux-loong64/README.md | 3 +++ npm/@esbuild/linux-loong64/package.json | 17 +++++++++++++++ npm/esbuild/package.json | 1 + 6 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 npm/@esbuild/linux-loong64/README.md create mode 100644 npm/@esbuild/linux-loong64/package.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ef23ead4d9..c5e64f581a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/Makefile b/Makefile index 63bc8e9c8b2..ada37769925 100644 --- a/Makefile +++ b/Makefile @@ -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 \ @@ -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 @@ -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 @@ -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)" @@ -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 @@ -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 @@ -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 @@ -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/ diff --git a/lib/npm/node-platform.ts b/lib/npm/node-platform.ts index 2a00690a61a..90891df34ff 100644 --- a/lib/npm/node-platform.ts +++ b/lib/npm/node-platform.ts @@ -27,6 +27,7 @@ export const knownUnixlikePackages: Record = { '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', diff --git a/npm/@esbuild/linux-loong64/README.md b/npm/@esbuild/linux-loong64/README.md new file mode 100644 index 00000000000..c64a2b19766 --- /dev/null +++ b/npm/@esbuild/linux-loong64/README.md @@ -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. diff --git a/npm/@esbuild/linux-loong64/package.json b/npm/@esbuild/linux-loong64/package.json new file mode 100644 index 00000000000..fe65323f9af --- /dev/null +++ b/npm/@esbuild/linux-loong64/package.json @@ -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" + ] +} diff --git a/npm/esbuild/package.json b/npm/esbuild/package.json index 471b3cc063e..ec8d18cabac 100644 --- a/npm/esbuild/package.json +++ b/npm/esbuild/package.json @@ -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",