Add initial FreeBSD script & installation doc (#30981)

G36maid and Peter Tripp created

This PR adds initial FreeBSD support for building Zed:

*  Adds `script/freebsd` to install required dependencies on FreeBSD
*  Adds `docs/freebsd.md` with build instructions and notes
* ⚠️ Mentions that `webrtc` is still **work-in-progress** on FreeBSD.

Related to : #15309 
I’m currently working at discussions :
[Discussions](https://github.com/zed-industries/zed/discussions/29550)

Release Notes:

- N/A

---------

Co-authored-by: Peter Tripp <peter@zed.dev>

Change summary

docs/src/SUMMARY.md             |  1 +
docs/src/development/freebsd.md | 30 ++++++++++++++++++++++++++++++
docs/src/system-requirements.md |  4 ++++
script/freebsd                  | 35 +++++++++++++++++++++++++++++++++++
4 files changed, 70 insertions(+)

Detailed changes

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)

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)_

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).

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