Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add initial FreeBSD script & installation doc (#30981)

G36maid65a93a0036ac
diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md
index a5d56d09f8c..2872134102c 100644
--- a/docs/src/SUMMARY.md
+++ b/docs/src/SUMMARY.md
@@ -147,6 +147,7 @@
- [macOS](./development/macos.md)
- [Linux](./development/linux.md)
- [Windows](./development/windows.md)
+ - [FreeBSD}(./development/freebsd.md)]
- [Local Collaboration](./development/local-collaboration.md)
- [Using Debuggers](./development/debuggers.md)
- [Release Process](./development/releases.md)
diff --git a/docs/src/development/freebsd.md b/docs/src/development/freebsd.md
new file mode 100644
index 00000000000..33ff9a56d94
--- /dev/null
+++ b/docs/src/development/freebsd.md
@@ -0,0 +1,30 @@
+# Building Zed for FreeBSD
+
+Note, FreeBSD is not currently a supported platform, and so this is a work-in-progress.
+
+## Repository
+
+Clone the [Zed repository](https://github.com/zed-industries/zed).
+
+## Dependencies
+
+- Install the necessary system packages and rustup:
+
+ ```sh
+ script/freebsd
+ ```
+
+ If preferred, you can inspect [`script/freebsd`](https://github.com/zed-industries/zed/blob/main/script/freebsd) and perform the steps manually.
+
+---
+
+### ⚠️ WebRTC Notice
+
+Currently, building `webrtc-sys` on FreeBSD fails due to missing upstream support and unavailable prebuilt binaries.
+This is actively being worked on.
+
+More progress and discussion can be found in [Zed’s GitHub Discussions](https://github.com/zed-industries/zed/discussions/29550).
+
+_Environment:
+FreeBSD 14.2-RELEASE
+Architecture: amd64 (x86_64)_
diff --git a/docs/src/system-requirements.md b/docs/src/system-requirements.md
index fd96bd7c47b..46c559c507a 100644
--- a/docs/src/system-requirements.md
+++ b/docs/src/system-requirements.md
@@ -45,6 +45,10 @@ Zed requires a Vulkan 1.3 driver, and the following desktop portals:
Not yet available as an official download. Can be built [from source](./development/windows.md).
+## FreeBSD
+
+Not yet available as an official download. Can be built [from source](./development/freebsd.md).
+
## Web
Not supported at this time. See our [Platform Support issue](https://github.com/zed-industries/zed/issues/5391).
diff --git a/script/freebsd b/script/freebsd
new file mode 100755
index 00000000000..58579d8ac9c
--- /dev/null
+++ b/script/freebsd
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+set -xeuo pipefail
+
+# if root or if sudo/unavailable, define an empty variable
+if [ "$(id -u)" -eq 0 ]; then
+ maysudo=''
+else
+ maysudo="$(command -v sudo || command -v doas || true)"
+fi
+
+function finalize {
+ # after packages install (curl, etc), get the rust toolchain
+ which rustup >/dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+ echo "Finished installing FreeBSD dependencies with script/freebsd"
+}
+
+# FreeBSD
+# https://www.freebsd.org/ports/
+pkg=$(command -v pkg || true)
+if [[ -n $pkg ]]; then
+ deps=(
+ cmake
+ gcc
+ git
+ llvm
+ protobuf
+ rustup-init
+ libx11
+ alsa-lib
+ )
+ $maysudo "$pkg" install "${deps[@]}"
+ finalize
+ exit 0
+fi