From 65a93a0036acfa680dbf2ba859d8641876ea6057 Mon Sep 17 00:00:00 2001 From: G36maid <53391375+G36maid@users.noreply.github.com> Date: Sat, 7 Jun 2025 07:14:25 +0800 Subject: [PATCH] Add initial FreeBSD script & installation doc (#30981) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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(+) create mode 100644 docs/src/development/freebsd.md create mode 100755 script/freebsd diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index a5d56d09f8..2872134102 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 0000000000..33ff9a56d9 --- /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 fd96bd7c47..46c559c507 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 0000000000..58579d8ac9 --- /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