build: add freebsd support

This commit is contained in:
ReenigneArcher
2025-07-04 20:16:38 -04:00
parent 1d4f5c3798
commit 768c995f16
23 changed files with 373 additions and 25 deletions

171
.github/workflows/ci-freebsd.yml vendored Normal file
View File

@@ -0,0 +1,171 @@
---
name: CI-FreeBSD
permissions:
contents: read
on:
workflow_call:
inputs:
release_commit:
required: true
type: string
release_version:
required: true
type: string
env:
FREEBSD_CLANG_VERSION: 19
jobs:
build_freebsd:
name: ${{ matrix.cmake_processor }}-${{ matrix.bsd_release }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- bsd_release: "14.3"
arch: x86_64
cmake_processor: amd64
runner: ubuntu-latest
- bsd_release: "14.3"
arch: aarch64
cmake_processor: aarch64
runner: ubuntu-latest # ubuntu-24.04-arm is slower with the FreeBSD VM
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Get Processor Count
id: processor_count
shell: bash
run: |
PROCESSOR_COUNT=$(nproc)
echo "PROCESSOR_COUNT=${PROCESSOR_COUNT}" >> $GITHUB_OUTPUT
echo "PROCESSOR_COUNT: $PROCESSOR_COUNT"
- name: Setup FreeBSD
uses: vmactions/freebsd-vm@v1.2.1
with:
arch: ${{ matrix.arch }}
cpu: ${{ steps.processor_count.outputs.PROCESSOR_COUNT }}
# TODO: there is no libcap for freebsd... we need graphics/libdrm if we find a way to use libcap
# TODO: docs are off because doxygen is too old: https://www.freshports.org/devel/doxygen/ must be >= 1.10
prepare: |
set -e
pkg update
pkg upgrade -y
pkg install -y \
audio/opus \
audio/pulseaudio \
devel/cmake-core \
devel/evdev-proto \
devel/git \
devel/libayatana-appindicator \
devel/libevdev \
devel/libnotify \
devel/llvm${{ env.FREEBSD_CLANG_VERSION }} \
devel/ninja \
devel/pkgconf \
ftp/curl \
graphics/libdrm \
graphics/wayland \
multimedia/libva \
net/miniupnpc \
ports-mgmt/pkg \
security/openssl \
shells/bash \
www/npm \
x11/libX11 \
x11/libxcb \
x11/libXfixes \
x11/libXrandr \
x11/libXtst
# create symlink for shebang bash compatibility
ln -s /usr/local/bin/bash /bin/bash
release: ${{ matrix.bsd_release }}
run: |
set -e
# fix git safe.directory issues
git config --global --add safe.directory "*"
sync: nfs
- name: Configure
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
BUILD_VERSION: ${{ inputs.release_version }}
COMMIT: ${{ inputs.release_commit }}
shell: freebsd {0}
run: |
set -e
cd $GITHUB_WORKSPACE
export BRANCH=${{ env.BRANCH }}
export BUILD_VERSION=${{ env.BUILD_VERSION }}
export COMMIT=${{ env.COMMIT }}
export CC=$(which clang${{ env.FREEBSD_CLANG_VERSION }})
export CXX=$(which clang++${{ env.FREEBSD_CLANG_VERSION }})
mkdir -p build
cmake \
-B build \
-G Ninja \
-S . \
-DBUILD_DOCS=OFF \
-DBUILD_WERROR=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DSUNSHINE_ASSETS_DIR=share/assets \
-DSUNSHINE_EXECUTABLE_PATH=/usr/local/bin/sunshine \
-DSUNSHINE_ENABLE_CUDA=OFF \
-DSUNSHINE_ENABLE_DRM=OFF \
-DSUNSHINE_ENABLE_WAYLAND=OFF \
-DSUNSHINE_ENABLE_X11=ON \
-DSUNSHINE_PUBLISHER_NAME='${{ github.repository_owner }}' \
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'
- name: Build
shell: freebsd {0}
run: |
set -e
cd $GITHUB_WORKSPACE
ninja -C build
- name: Package
shell: freebsd {0}
run: |
set -e
cd $GITHUB_WORKSPACE
mkdir -p artifacts
cd build
cpack -G FREEBSD --verbose --debug
# move compiled files to artifacts
mv ./cpack_artifacts/Sunshine* ../artifacts/
- name: Debug cpack_artifacts
if: always()
shell: bash
working-directory: build/cpack_artifacts
run: |
ls -R .
# print contents of manifest
echo "Manifest:"
cat ./_CPack_Packages/FreeBSD/FREEBSD/Sunshine/+MANIFEST
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-FreeBSD-${{ matrix.bsd_release }}-${{ matrix.cmake_processor }}
path: artifacts/
if-no-files-found: error

View File

@@ -68,6 +68,14 @@ jobs:
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-freebsd:
name: FreeBSD
needs: release-setup
uses: ./.github/workflows/ci-freebsd.yml
with:
release_commit: ${{ needs.release-setup.outputs.release_commit }}
release_version: ${{ needs.release-setup.outputs.release_version }}
build-homebrew:
name: Homebrew
needs: release-setup