Skip to content

Commit

Permalink
close #3974: add support for netbsd on arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Dec 20, 2024
1 parent 3ae3525 commit 7236472
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@

This can sometimes expose additional minification opportunities.

* Experimental support for esbuild on NetBSD ([#3974](https://github.com/evanw/esbuild/pull/3974))

With this release, esbuild now has a published binary executable for [NetBSD](https://www.netbsd.org/) in the [`@esbuild/netbsd-arm64`](https://www.npmjs.com/package/@esbuild/netbsd-arm64) npm package, and esbuild's installer has been modified to attempt to use it when on NetBSD. Hopefully this makes installing esbuild via npm work on NetBSD. This change was contributed by [@bsiegert](https://github.com/bsiegert).

⚠️ Note: NetBSD is not one of [Node's supported platforms](https://nodejs.org/api/process.html#process_process_platform), so installing esbuild may or may not work on NetBSD depending on how Node has been patched. This is not a problem with esbuild. ⚠️

## 0.24.0

**_This release deliberately contains backwards-incompatible changes._** To avoid automatically picking up releases like this, you should either be pinning the exact version of `esbuild` in your `package.json` file (recommended) or be using a version range syntax that only accepts patch upgrades such as `^0.23.0` or `~0.23.0`. See npm's documentation about [semver](https://docs.npmjs.com/cli/v6/using-npm/semver/) for more information.
Expand Down
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ platform-all:
platform-linux-riscv64 \
platform-linux-s390x \
platform-linux-x64 \
platform-netbsd-arm64 \
platform-netbsd-x64 \
platform-neutral \
platform-openbsd-arm64 \
Expand Down Expand Up @@ -361,6 +362,9 @@ platform-freebsd-x64:
platform-freebsd-arm64:
@$(MAKE) --no-print-directory GOOS=freebsd GOARCH=arm64 NPMDIR=npm/@esbuild/freebsd-arm64 platform-unixlike

platform-netbsd-arm64:
@$(MAKE) --no-print-directory GOOS=netbsd GOARCH=amd64 NPMDIR=npm/@esbuild/netbsd-arm64 platform-unixlike

platform-netbsd-x64:
@$(MAKE) --no-print-directory GOOS=netbsd GOARCH=amd64 NPMDIR=npm/@esbuild/netbsd-x64 platform-unixlike

Expand Down Expand Up @@ -442,22 +446,26 @@ publish-all: check-go-version

@echo Enter one-time password:
@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
publish-freebsd-x64 \
publish-freebsd-arm64 \
publish-freebsd-x64 \
publish-openbsd-arm64 \
publish-openbsd-x64 \
publish-openbsd-x64

@echo Enter one-time password:
@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
publish-darwin-arm64 \
publish-darwin-x64 \
publish-netbsd-arm64 \
publish-netbsd-x64

@echo Enter one-time password:
@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
publish-android-x64 \
publish-android-arm \
publish-android-arm64 \
publish-darwin-x64
publish-android-arm64

@echo Enter one-time password:
@read OTP && OTP="$$OTP" $(MAKE) --no-print-directory -j4 \
publish-darwin-arm64 \
publish-linux-x64 \
publish-linux-ia32 \
publish-linux-arm
Expand Down Expand Up @@ -522,6 +530,9 @@ publish-freebsd-x64: platform-freebsd-x64
publish-freebsd-arm64: platform-freebsd-arm64
test -n "$(OTP)" && cd npm/@esbuild/freebsd-arm64 && npm publish --otp="$(OTP)"

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

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

Expand Down Expand Up @@ -619,6 +630,7 @@ validate-builds:
@$(MAKE) --no-print-directory TARGET=platform-linux-riscv64 SCOPE=@esbuild/ PACKAGE=linux-riscv64 SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-linux-s390x SCOPE=@esbuild/ PACKAGE=linux-s390x SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-linux-x64 SCOPE=@esbuild/ PACKAGE=linux-x64 SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-netbsd-arm64 SCOPE=@esbuild/ PACKAGE=netbsd-arm64 SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-netbsd-x64 SCOPE=@esbuild/ PACKAGE=netbsd-x64 SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-openbsd-arm64 SCOPE=@esbuild/ PACKAGE=openbsd-arm64 SUBPATH=bin/esbuild validate-build
@$(MAKE) --no-print-directory TARGET=platform-openbsd-x64 SCOPE=@esbuild/ PACKAGE=openbsd-x64 SUBPATH=bin/esbuild validate-build
Expand Down Expand Up @@ -655,6 +667,7 @@ clean:
rm -rf npm/@esbuild/linux-riscv64/bin
rm -rf npm/@esbuild/linux-s390x/bin
rm -rf npm/@esbuild/linux-x64/bin
rm -rf npm/@esbuild/netbsd-arm64/bin
rm -rf npm/@esbuild/netbsd-x64/bin
rm -rf npm/@esbuild/openbsd-arm64/bin
rm -rf npm/@esbuild/openbsd-x64/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 @@ -41,6 +41,7 @@ export const knownUnixlikePackages: Record<string, string> = {
'linux s390x BE': '@esbuild/linux-s390x',
'linux x64 LE': '@esbuild/linux-x64',
'linux loong64 LE': '@esbuild/linux-loong64',
'netbsd arm64 LE': '@esbuild/netbsd-arm64',
'netbsd x64 LE': '@esbuild/netbsd-x64',
'openbsd arm64 LE': '@esbuild/openbsd-arm64',
'openbsd x64 LE': '@esbuild/openbsd-x64',
Expand Down
5 changes: 5 additions & 0 deletions npm/@esbuild/netbsd-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# esbuild

This is the NetBSD ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.

⚠️ Note: NetBSD is not one of [Node's supported platforms](https://nodejs.org/api/process.html#process_process_platform), so installing esbuild may or may not work on NetBSD depending on how Node has been patched. This is not a problem with esbuild. ⚠️
20 changes: 20 additions & 0 deletions npm/@esbuild/netbsd-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@esbuild/netbsd-arm64",
"version": "0.24.0",
"description": "The NetBSD ARM 64-bit binary for esbuild, a JavaScript bundler.",
"repository": {
"type": "git",
"url": "git+https://github.com/evanw/esbuild.git"
},
"license": "MIT",
"preferUnplugged": true,
"engines": {
"node": ">=18"
},
"os": [
"netbsd"
],
"cpu": [
"arm64"
]
}

0 comments on commit 7236472

Please sign in to comment.