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