Path: blob/main/lang/bun/files/patch-scripts_build_tools.ts
46591 views
-- Add FreeBSD support to LLVM toolchain resolution:1-- 1. llvmSearchPaths: add /usr/local/llvmNN/bin (FreeBSD ports layout)2-- 2. resolveLlvmToolchain: use ld.lld for FreeBSD (same as Linux)3-- 3. llvmInstallHint: add FreeBSD install hint4--- scripts/build/tools.ts.orig 2026-04-27 08:09:39 UTC5+++ scripts/build/tools.ts6@@ -312,6 +312,12 @@ function llvmSearchPaths(os: OS, arch: Arch): string[]7paths.push(`/usr/lib/llvm${LLVM_MAJOR}/bin`);8}910+ if (os === "freebsd") {11+ // FreeBSD ports install LLVM under /usr/local/llvm${MAJOR}/bin12+ paths.push(`/usr/local/llvm${LLVM_MAJOR}/bin`);13+ paths.push(`/usr/local/llvm-${LLVM_MAJOR}/bin`);14+ }15+16return paths;17}1819@@ -332,6 +338,7 @@ function llvmInstallHint(os: OS): string {20if (os === "darwin") return `Install with: brew install llvm@${LLVM_MAJOR}`;21if (os === "linux")22return `Install with: apt install clang-${LLVM_MAJOR} lld-${LLVM_MAJOR} (or equivalent for your distro)`;23+ if (os === "freebsd") return `Install with: pkg install llvm${LLVM_MAJOR}`;24if (os === "windows") return `Install LLVM ${LLVM_VERSION} from https://github.com/llvm/llvm-project/releases`;25return "";26}27@@ -419,7 +426,7 @@ export function resolveLlvmToolchain(28let ld: string;29if (os === "windows") {30ld = findLlvmTool("lld-link", paths, os, { checkVersion: false, required: true })?.path ?? "";31- } else if (os === "linux") {32+ } else if (os === "linux" || os === "freebsd") {33ld = findLlvmTool("ld.lld", paths, os, { checkVersion: true, required: true })?.path ?? "";34} else {35ld = ""; // darwin: unused363738