git: 47e931b8d1f4 - main - lang/bun-linux: New port: Linux version of Bun JavaScript runtime and package manager

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 21 Jul 2026 02:55:57 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=47e931b8d1f48a0865adfd9801be41323fb2f90c

commit 47e931b8d1f48a0865adfd9801be41323fb2f90c
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-07-21 00:29:23 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-07-21 02:55:13 +0000

    lang/bun-linux: New port: Linux version of Bun JavaScript runtime and package manager
---
 lang/Makefile              |  1 +
 lang/bun-linux/Makefile    | 64 ++++++++++++++++++++++++++++++++++++++++++++++
 lang/bun-linux/distinfo    |  5 ++++
 lang/bun-linux/pkg-descr   | 14 ++++++++++
 lang/bun-linux/pkg-message | 14 ++++++++++
 5 files changed, 98 insertions(+)

diff --git a/lang/Makefile b/lang/Makefile
index e7c57e2bdabf..ca10ae43302b 100644
--- a/lang/Makefile
+++ b/lang/Makefile
@@ -18,6 +18,7 @@
     SUBDIR += bend
     SUBDIR += bsh
     SUBDIR += bun
+    SUBDIR += bun-linux
     SUBDIR += bwbasic
     SUBDIR += c
     SUBDIR += c3c
diff --git a/lang/bun-linux/Makefile b/lang/bun-linux/Makefile
new file mode 100644
index 000000000000..4c05e87c6b32
--- /dev/null
+++ b/lang/bun-linux/Makefile
@@ -0,0 +1,64 @@
+PORTNAME=	bun-linux
+DISTVERSION=	1.3.14
+CATEGORIES=	lang
+MASTER_SITES=	https://github.com/oven-sh/bun/releases/download/bun-v${DISTVERSION}/:amd64 \
+		https://github.com/oven-sh/bun/releases/download/bun-v${DISTVERSION}/:aarch64
+DISTFILES=	bun-linux-x64-baseline.zip:amd64 \
+		bun-linux-aarch64.zip:aarch64
+DIST_SUBDIR=	${PORTNAME}-${DISTVERSION}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Linux version of Bun JavaScript runtime and package manager
+WWW=		https://bun.com/ \
+		https://github.com/oven-sh/bun
+
+LICENSE=	LGPL20
+
+ONLY_FOR_ARCHS=		aarch64 amd64
+ONLY_FOR_ARCHS_REASON=	is a Linux binary with a limited platform support
+
+USES=		linux:rl9 zip
+USE_LINUX=	base
+
+NO_BUILD=	yes
+NO_WRKSUBDIR=	yes
+STRIP=		# elftoolchain strip fails on these Linux binaries
+
+CONFLICTS_INSTALL=	bun
+
+PLIST_FILES=	bin/bun \
+		libexec/bun
+
+find-new-version:
+	@TAB=$$(printf '\t'); \
+	new_ver=$$(fetch -q -o - https://api.github.com/repos/oven-sh/bun/releases/latest 2>/dev/null | \
+		${GREP} '"tag_name":' | head -1 | ${SED} 's/.*"bun-v\([^"]*\)".*/\1/'); \
+	current_ver=$$(make -V DISTVERSION); \
+	if [ "$$new_ver" != "$$current_ver" ] && [ -n "$$new_ver" ]; then \
+		${SED} -i '' "s/^DISTVERSION=.*/DISTVERSION=$${TAB}$$new_ver/" ${.CURDIR}/Makefile; \
+		echo "=> New version available: $$current_ver -> $$new_ver"; \
+	else \
+		echo "=> No new version available (current: $$current_ver)"; \
+	fi
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == aarch64
+BUN_DISTDIR=	bun-linux-aarch64
+.else
+BUN_DISTDIR=	bun-linux-x64-baseline
+.endif
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/${BUN_DISTDIR}/bun ${STAGEDIR}${PREFIX}/libexec/bun
+	( \
+		${ECHO}	"#!/bin/sh"; \
+		${ECHO}	"if [ ! -d /compat/linux/proc ]; then"; \
+		${ECHO}	"  echo 'Error: /compat/linux/proc is not mounted. Please run \"sudo mount -t linprocfs linprocfs /compat/linux/proc\" to mount it.'"; \
+		${ECHO}	"  exit 1"; \
+		${ECHO}	"fi"; \
+		${ECHO}	"exec ${PREFIX}/libexec/bun \"\$$@\"" \
+	) > ${WRKSRC}/bun-wrapper.sh
+	${INSTALL_SCRIPT} ${WRKSRC}/bun-wrapper.sh ${STAGEDIR}${PREFIX}/bin/bun
+
+.include <bsd.port.post.mk>
diff --git a/lang/bun-linux/distinfo b/lang/bun-linux/distinfo
new file mode 100644
index 000000000000..a2c4a8dfc6b8
--- /dev/null
+++ b/lang/bun-linux/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1784592947
+SHA256 (bun-linux-1.3.14/bun-linux-x64-baseline.zip) = a063908ae08b7852ca10939bbdc6ceed3ddabce8fb9402dce83d65d73b36e6c7
+SIZE (bun-linux-1.3.14/bun-linux-x64-baseline.zip) = 35595658
+SHA256 (bun-linux-1.3.14/bun-linux-aarch64.zip) = a27ffb63a8310375836e0d6f668ae17fa8d8d18b88c37c821c65331973a19a3b
+SIZE (bun-linux-1.3.14/bun-linux-aarch64.zip) = 35700603
diff --git a/lang/bun-linux/pkg-descr b/lang/bun-linux/pkg-descr
new file mode 100644
index 000000000000..b54b257b8911
--- /dev/null
+++ b/lang/bun-linux/pkg-descr
@@ -0,0 +1,14 @@
+Bun is a fast JavaScript runtime, bundler, transpiler, and
+package manager -- all in one.
+
+This port installs the Linux binary of bun, which runs on FreeBSD
+through the Linuxulator compatibility layer.
+
+Key features:
+- Up to 4x faster startup time than Node.js
+- Native TypeScript and JSX support (no separate transpilation step)
+- Built-in package manager (npm-compatible) with global caching
+- Built-in test runner, bundler, and transpiler
+- Web-standard APIs: fetch, WebSocket, ReadableStream, etc.
+- Node.js compatibility: most Node.js built-in modules work out of the box
+- Zig, C++, and Rust -- for maximum performance
diff --git a/lang/bun-linux/pkg-message b/lang/bun-linux/pkg-message
new file mode 100644
index 000000000000..e843388a14cd
--- /dev/null
+++ b/lang/bun-linux/pkg-message
@@ -0,0 +1,14 @@
+[
+{ type: install
+  message: <<EOM
+You installed the Linux version of Bun.
+
+The 'bun' command runs the Linux binary through the Linuxulator.
+Make sure /compat/linux/proc is mounted before using bun:
+
+  sudo mount -t linprocfs linprocfs /compat/linux/proc
+
+Run 'bun --help' to get started.
+EOM
+}
+]