Skip to content

feat: support linux riscv64 LE architecture #2000

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

Merged
merged 1 commit into from
Feb 9, 2022
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: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ platform-all:
platform-linux-32 \
platform-linux-arm \
platform-linux-arm64 \
platform-linux-riscv64 \
platform-linux-mips64le \
platform-linux-ppc64le \
platform-linux-s390x \
Expand Down Expand Up @@ -300,6 +301,9 @@ platform-linux-arm:
platform-linux-arm64:
@$(MAKE) --no-print-directory GOOS=linux GOARCH=arm64 NPMDIR=npm/esbuild-linux-arm64 platform-unixlike

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

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

Expand Down Expand Up @@ -374,8 +378,12 @@ publish-all: check-go-version
@echo Enter one-time password:
@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
publish-linux-arm64 \
publish-linux-riscv64 \
publish-linux-mips64le \
publish-linux-ppc64le \

@echo Enter one-time password:
@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
publish-linux-s390x

# Do these last to avoid race conditions
Expand Down Expand Up @@ -429,6 +437,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-riscv64: platform-linux-riscv64
test -n "$(OTP)" && cd npm/esbuild-linux-riscv64 && 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 @@ -471,6 +482,7 @@ clean:
rm -rf npm/esbuild-linux-64/bin
rm -rf npm/esbuild-linux-arm/bin
rm -rf npm/esbuild-linux-arm64/bin
rm -rf npm/esbuild-linux-riscv64/bin
rm -rf npm/esbuild-linux-mips64le/bin
rm -rf npm/esbuild-linux-ppc64le/bin
rm -rf npm/esbuild-linux-s390x/bin
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 @@ -22,6 +22,7 @@ export const knownUnixlikePackages: Record<string, string> = {
'linux arm LE': 'esbuild-linux-arm',
'linux arm64 LE': 'esbuild-linux-arm64',
'linux ia32 LE': 'esbuild-linux-32',
'linux riscv64 LE': 'esbuild-linux-riscv64',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

riscv64 is not documented as something node ever returns for process.arch: https://nodejs.org/api/process.html#processarch:

process.arch

The operating system CPU architecture for which the Node.js binary was compiled. Possible values are: 'arm', 'arm64', 'ia32', 'mips','mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.

I'm wondering if node's documentation is wrong because this PR appears to indicate that node supports this architecture. I asked about that here: nodejs/node#41900.

'linux mips64el LE': 'esbuild-linux-mips64le',
'linux ppc64 LE': 'esbuild-linux-ppc64le',
'linux s390x BE': 'esbuild-linux-s390x',
Expand Down
3 changes: 3 additions & 0 deletions npm/esbuild-linux-riscv64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# esbuild

This is the Linux RISC-V 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-riscv64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "esbuild-linux-riscv64",
"version": "0.14.20",
"description": "The Linux RISC-V 64-bit binary for esbuild, a JavaScript bundler.",
"repository": "https://github.com/evanw/esbuild",
"license": "MIT",
"preferUnplugged": false,
"engines": {
"node": ">=12"
},
"os": [
"linux"
],
"cpu": [
"riscv64"
]
}
1 change: 1 addition & 0 deletions npm/esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"esbuild-linux-64": "0.14.20",
"esbuild-linux-arm": "0.14.20",
"esbuild-linux-arm64": "0.14.20",
"esbuild-linux-riscv64": "0.14.20",
"esbuild-linux-mips64le": "0.14.20",
"esbuild-linux-ppc64le": "0.14.20",
"esbuild-linux-s390x": "0.14.20",
Expand Down