From fb4d65875e27ed58ce545875b2591c46fc324d12 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Mon, 26 Feb 2024 16:37:48 +0100 Subject: [PATCH] CI: Update Linux build scripts to use CMake presets Also adds source package generation and updates Cirrus CI script. --- .cirrus.yml | 30 +-- .github/actions/build-obs/action.yaml | 4 +- .github/actions/package-obs/action.yaml | 4 +- .github/scripts/.build.zsh | 30 +-- .github/scripts/.package.zsh | 31 ++- .github/scripts/{build-linux => build-ubuntu} | 0 .../scripts/{package-linux => package-ubuntu} | 0 .../utils.zsh/{check_linux => check_ubuntu} | 20 +- .../utils.zsh/{setup_linux => setup_ubuntu} | 14 +- .github/workflows/build-project.yaml | 9 +- .github/workflows/push.yaml | 6 +- CI/build-freebsd.sh | 98 -------- CI/freebsd/01_install_dependencies.sh | 106 --------- CI/freebsd/02_build_obs.sh | 126 ---------- CI/freebsd/03_package_obs.sh | 78 ------- CI/include/build_support.sh | 219 ------------------ CI/include/build_support_freebsd.sh | 42 ---- buildspec.json | 18 +- 18 files changed, 97 insertions(+), 738 deletions(-) rename .github/scripts/{build-linux => build-ubuntu} (100%) rename .github/scripts/{package-linux => package-ubuntu} (100%) rename .github/scripts/utils.zsh/{check_linux => check_ubuntu} (64%) rename .github/scripts/utils.zsh/{setup_linux => setup_ubuntu} (86%) delete mode 100755 CI/build-freebsd.sh delete mode 100644 CI/freebsd/01_install_dependencies.sh delete mode 100644 CI/freebsd/02_build_obs.sh delete mode 100644 CI/freebsd/03_package_obs.sh delete mode 100644 CI/include/build_support.sh delete mode 100644 CI/include/build_support_freebsd.sh diff --git a/.cirrus.yml b/.cirrus.yml index 69ab5c145..c2d2ca7d9 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -9,19 +9,21 @@ env: task: install_script: - - pkg install -y - alsa-lib - v4l_compat swig ffmpeg curl dbus fdk-aac fontconfig - freetype2 jackit jansson luajit mbedtls pulseaudio speexdsp - libpci librist libsysinfo libudev-devd libv4l libx264 cmake ninja - mesa-libs lua52 pkgconf - srt - qt5-svg qt5-qmake qt5-buildtools qt5-x11extras qt5-xml - pipewire + - pkg-install -y + cmake ninja binutils pkgconf curl + ffmpeg qt6-base qt6-svg jansson libsysinfo e2fsprogs-libuuid pulseaudio + alsa-lib pipewire v4l_compat libpci librist srt nlohmann-json uthash + qr-code-generator websocketpp asio vlc swig luajit jackit sndio fdk-aac script: - - mkdir build - - cd build - cmake - -DENABLE_AJA=OFF - -GNinja .. - - ninja + -S $(pwd) + -B build + -G Ninja + -DOBS_CMAKE_VERSION=3.0 + -DENABLE_JACK:BOOL=ON + -DENABLE_SNDIO:BOOL=ON + -DENABLE_LIBFDK:BOOL=ON + -DENABLE_WEBRTC:BOOL=OFF + - cmake + --build build + --config RelWithDebInfo diff --git a/.github/actions/build-obs/action.yaml b/.github/actions/build-obs/action.yaml index 16a657639..bfe88ac52 100644 --- a/.github/actions/build-obs/action.yaml +++ b/.github/actions/build-obs/action.yaml @@ -73,12 +73,12 @@ runs: local -a build_args=( --config ${{ inputs.config }} - --target linux-${{ inputs.target }} + --target ubuntu-${{ inputs.target }} ) if (( ${+RUNNER_DEBUG} )) build_args+=(--debug) git fetch origin --no-tags --no-recurse-submodules -q - .github/scripts/build-linux ${build_args} + .github/scripts/build-ubuntu ${build_args} - name: Run Windows Build if: runner.os == 'Windows' diff --git a/.github/actions/package-obs/action.yaml b/.github/actions/package-obs/action.yaml index 0c5fa42e5..7247e4697 100644 --- a/.github/actions/package-obs/action.yaml +++ b/.github/actions/package-obs/action.yaml @@ -81,14 +81,14 @@ runs: : Run Ubuntu Packaging local -a package_args=( - --target linux-${{ inputs.target }} + --target ubuntu-${{ inputs.target }} --config ${{ inputs.config }} ) if (( ${+RUNNER_DEBUG} )) build_args+=(--debug) if [[ '${{ inputs.package }}' == true ]] package_args+=(--package) - ${{ inputs.workingDirectory }}/.github/scripts/package-linux ${package_args} + ${{ inputs.workingDirectory }}/.github/scripts/package-ubuntu ${package_args} - name: Run Windows packaging if: runner.os == 'Windows' diff --git a/.github/scripts/.build.zsh b/.github/scripts/.build.zsh index b54ec882f..1f9d69033 100755 --- a/.github/scripts/.build.zsh +++ b/.github/scripts/.build.zsh @@ -56,7 +56,8 @@ build() { local -r -a _valid_targets=( macos-x86_64 macos-arm64 - linux-x86_64 + ubuntu-x86_64 + ubuntu-aarch64 ) local config='RelWithDebInfo' @@ -66,7 +67,7 @@ build() { local -a args while (( # )) { case ${1} { - -t|--target|--generator|-c|--config) + -t|--target|-c|--config) if (( # == 1 )) || [[ ${2:0:1} == '-' ]] { log_error "Missing value for option %B${1}%b" exit 2 @@ -104,8 +105,8 @@ build() { check_${host_os} setup_ccache - if [[ ${host_os} == linux ]] { - autoload -Uz setup_linux && setup_linux + if [[ ${host_os} == ubuntu ]] { + autoload -Uz setup_ubuntu && setup_ubuntu } local product_name @@ -188,21 +189,20 @@ build() { } popd ;; - linux-*) + ubuntu-*) local cmake_bin='/usr/bin/cmake' cmake_args+=( - -S ${PWD} -B build_${target##*-} - -G Ninja - -DCMAKE_BUILD_TYPE:STRING=${config} - -DCEF_ROOT_DIR:PATH="${project_root}/.deps/cef_binary_${CEF_VERSION}_${target//-/_}" - -DENABLE_AJA:BOOL=OFF - -DENABLE_WEBRTC:BOOL=OFF - -DENABLE_NATIVE_NVENC:BOOL=OFF + --preset ubuntu-ci + --toolchain ${project_root}/cmake/linux/toolchain-${target##*-}-gcc.cmake + -DENABLE_BROWSER:BOOL=ON + -DCEF_ROOT_DIR:PATH="${project_root}/.deps/cef_binary_${CEF_VERSION}_${target//ubuntu-/linux_}" ) - if (( ! UBUNTU_2210_OR_LATER )) cmake_args+=(-DENABLE_NEW_MPEGTS_OUTPUT:BOOL=OFF) - cmake_build_args+=(build_${target##*-} --config ${config} --parallel) - cmake_install_args+=(build_${target##*-} --prefix ${project_root}/build_${target##*-}/install/${config}) + if (( ! UBUNTU_2210_OR_LATER )) cmake_args+=(-DENABLE_NEW_MPEGTS_OUTPUT:BOOL=OFF) + if [[ ${target##*-} == aarch64 ]] cmake-args+=(-DENABLE_QSV11:BOOL=OFF) + + cmake_build_args+=(build_${target%%-*} --config ${config} --parallel) + cmake_install_args+=(build_${target%%-*} --prefix ${project_root}/build_${target%%-*}/install/${config}) log_group "Configuring ${product_name}..." ${cmake_bin} -S ${project_root} ${cmake_args} diff --git a/.github/scripts/.package.zsh b/.github/scripts/.package.zsh index b9411bec1..85c23bfd2 100755 --- a/.github/scripts/.package.zsh +++ b/.github/scripts/.package.zsh @@ -51,7 +51,7 @@ package() { local -r -a _valid_targets=( macos-x86_64 macos-arm64 - linux-x86_64 + ubuntu-x86_64 ) local config='RelWithDebInfo' @@ -208,7 +208,7 @@ package() { log_group - } elif [[ ${host_os} == linux ]] { + } elif [[ ${host_os} == ubuntu ]] { local cmake_bin='/usr/bin/cmake' local -a cmake_args=() if (( debug )) cmake_args+=(--verbose) @@ -216,11 +216,11 @@ package() { if (( package )) { log_group "Packaging obs-studio..." pushd ${project_root} - ${cmake_bin} --build build_${target##*-} --config ${config} -t package ${cmake_args} - output_name="${output_name}-${target##*-}-linux-gnu" + ${cmake_bin} --build build_${target%%-*} --config ${config} --target package ${cmake_args} + output_name="${output_name}-${target##*-}-ubuntu-gnu" - pushd ${project_root}/build_${target##*-} - local -a files=(obs-studio-*-Linux*.(ddeb|deb)) + pushd ${project_root}/build_${target%%-*} + local -a files=(obs-studio-*-Linux*.(ddeb|deb|ddeb.sha256|deb.sha256)) for file (${files}) { mv ${file} ${file//obs-studio-*-Linux/${output_name}} } @@ -228,12 +228,25 @@ package() { popd } else { log_group "Archiving obs-studio..." - output_name="${output_name}-${target##*-}-linux-gnu" + output_name="${output_name}-${target##*-}-ubuntu-gnu" - pushd ${project_root}/build_${target##*-}/install/${config} - XZ_OPT=-T0 tar -cvJf ${project_root}/build_${target##*-}/${output_name}.tar.xz (bin|lib|share) + pushd ${project_root}/build_${target%%-*}/install/${config} + XZ_OPT=-T0 tar -cvJf ${project_root}/build_${target%%-*}/${output_name}.tar.xz (bin|lib|share) popd } + + pushd ${project_root} + ${cmake_bin} --build build_${target%%-*} --config ${config} --target package_source ${cmake_args} + output_name="${output_name}-sources" + + pushd ${project_root}/build_${target%%-*} + local -a files=(obs-studio-*-sources.tar.*) + for file (${files}) { + mv ${file} ${file//obs-studio-*-sources/${output_name}} + } + popd + popd + log_group } } diff --git a/.github/scripts/build-linux b/.github/scripts/build-ubuntu similarity index 100% rename from .github/scripts/build-linux rename to .github/scripts/build-ubuntu diff --git a/.github/scripts/package-linux b/.github/scripts/package-ubuntu similarity index 100% rename from .github/scripts/package-linux rename to .github/scripts/package-ubuntu diff --git a/.github/scripts/utils.zsh/check_linux b/.github/scripts/utils.zsh/check_ubuntu similarity index 64% rename from .github/scripts/utils.zsh/check_linux rename to .github/scripts/utils.zsh/check_ubuntu index dc35be12b..bb6509cf7 100644 --- a/.github/scripts/utils.zsh/check_linux +++ b/.github/scripts/utils.zsh/check_ubuntu @@ -1,19 +1,29 @@ autoload -Uz log_debug log_group -log_group 'Check Linux build requirements' -log_debug 'Checking Linux distribution name and version...' +log_group 'Check Ubuntu build requirements' +log_debug 'Checking Ubuntu distribution name and version...' # Check for Ubuntu version 22.10 or later, which have srt and librist available via apt-get typeset -g -i UBUNTU_2210_OR_LATER=0 -if [[ -f /etc/os_release ]] { +if [[ -f /etc/os-release ]] { local dist_name local dist_version - read -r dist_name dist_version <<< "$(source /etc/os_release; print "${NAME} ${VERSION_ID}")" + read -r dist_name dist_version <<< "$(source /etc/os-release; print "${NAME} ${VERSION_ID}")" + + if [[ ${dist_name} != Ubuntu ]] { + log_error "Not running on an Ubuntu distribution. Aborting" + log_group + return 2 + } autoload -Uz is-at-least - if [[ ${dist_name} == Ubuntu ]] && is-at-least 22.10 ${dist_version}; then + if is-at-least 22.10 ${dist_version}; then typeset -g -i UBUNTU_2210_OR_LATER=1 fi +} else { + log_error "Unable to determine local Linux distribution, but Ubuntu is required. Aborting" + log_group + return 2 } local -a dependencies=("${(fA)$(<${SCRIPT_HOME}/.Aptfile)}") diff --git a/.github/scripts/utils.zsh/setup_linux b/.github/scripts/utils.zsh/setup_ubuntu similarity index 86% rename from .github/scripts/utils.zsh/setup_linux rename to .github/scripts/utils.zsh/setup_ubuntu index fa7ec3549..b8df08346 100644 --- a/.github/scripts/utils.zsh/setup_linux +++ b/.github/scripts/utils.zsh/setup_ubuntu @@ -40,9 +40,9 @@ if (( ! deps_version )) { log_group 'Setting up pre-built Chromium Embedded Framework...' pushd ${project_root}/.deps -local _filename="cef_binary_${deps_version}_${target//-/_}${deps_revision:+"_v${deps_revision}"}.tar.xz" +local _filename="cef_binary_${deps_version}_${target//ubuntu-/linux_}${deps_revision:+"_v${deps_revision}"}.tar.xz" local _url=${deps_baseurl}/${_filename} -local _target="cef_binary_${deps_version}_${target//-/_}" +local _target="cef_binary_${deps_version}_${target//ubuntu-/linux_}" typeset -g CEF_VERSION=${deps_version} log_debug "Running curl ${curl_opts} ${_url}" @@ -75,14 +75,14 @@ if [[ ${CPUTYPE} != ${target##*-} ]] { } sudo apt-get install -y --no-install-recommends \ - build-essential \ + build-essential libglib2.0-dev \ lsb-release dh-cmake \ libcurl4-openssl-dev \ libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev \ libswresample-dev libswscale-dev \ libjansson-dev \ libx11-xcb-dev \ - libgles2-mesa-dev libgles2-mesa \ + libgles2-mesa-dev \ libwayland-dev \ libpipewire-0.3-dev \ libpulse-dev \ @@ -95,11 +95,13 @@ sudo apt-get install -y --no-install-recommends \ libx11-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-xinerama0-dev \ libxcb-composite0-dev libxinerama-dev libxcb1-dev libx11-xcb-dev libxcb-xfixes0-dev \ swig libcmocka-dev libxss-dev libglvnd-dev \ - libxkbcommon-dev \ + libxkbcommon-dev libatk1.0-dev libatk-bridge2.0-dev libxcomposite-dev libxdamage-dev \ libasound2-dev libfdk-aac-dev libfontconfig-dev libfreetype6-dev libjack-jackd2-dev \ libpulse-dev libsndio-dev libspeexdsp-dev libudev-dev libv4l-dev libva-dev libvlc-dev \ libpci-dev libdrm-dev \ - nlohmann-json3-dev libwebsocketpp-dev libasio-dev libvpl-dev libvpl2 libqrcodegencpp-dev + nlohmann-json3-dev libwebsocketpp-dev libasio-dev libqrcodegencpp-dev + +if [[ ${target##*-} == x86_64 ]] sudo apt-get install -y --no-install-recommends libvpl-dev libvpl2 if (( UBUNTU_2210_OR_LATER )) sudo apt-get install -y --no-install-recommends librist-dev libsrt-openssl-dev diff --git a/.github/workflows/build-project.yaml b/.github/workflows/build-project.yaml index 41d11aa0b..63bd85ad6 100644 --- a/.github/workflows/build-project.yaml +++ b/.github/workflows/build-project.yaml @@ -213,23 +213,22 @@ jobs: - name: Upload Source Tarball 🗜️ uses: actions/upload-artifact@v4 - if: ${{ ! always() }} with: - name: obs-studio-*-sources-${{ needs.check-event.outputs.commitHash }} - path: ${{ github.workspace }}/build_x86_64/obs-studio-*-sources.* + name: obs-studio-ubuntu-22.04-sources-${{ needs.check-event.outputs.commitHash }} + path: ${{ github.workspace }}/build_ubuntu/obs-studio-*-sources.* - name: Upload Artifacts 📡 uses: actions/upload-artifact@v4 with: name: obs-studio-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }} - path: ${{ github.workspace }}/build_x86_64/obs-studio-*-x86_64-linux-gnu.* + path: ${{ github.workspace }}/build_ubuntu/obs-studio-*-x86_64-ubuntu-gnu.* - name: Upload Debug Symbol Artifacts 🪲 uses: actions/upload-artifact@v4 if: ${{ fromJSON(needs.check-event.outputs.package) }} with: name: obs-studio-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}-dbgsym - path: ${{ github.workspace }}/build_x86_64/obs-studio-*-x86_64-linux-gnu-dbgsym.ddeb + path: ${{ github.workspace }}/build_ubuntu/obs-studio-*-x86_64-ubuntu-gnu-dbgsym.ddeb - uses: actions/cache/save@v4 if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 1dbda16d3..1bcd71fc6 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -264,6 +264,7 @@ jobs: macos_intel_dsym_artifact_name="obs-studio-macos-x86_64-${commit_hash}-dSYMs" ubuntu_x86_64_artifact_name="obs-studio-ubuntu-22.04-x86_64-${commit_hash}" ubuntu_x86_64_debug_name="obs-studio-ubuntu-22.04-x86_64-${commit_hash}-dbgsym" + ubuntu_sources_name="obs-studio-ubuntu-22.04-sources-${commit_hash}" echo '::group::Renaming Artifacts' mv -v "${macos_arm64_artifact_name}/"obs-studio-*-macos-apple.dmg \ @@ -278,6 +279,8 @@ jobs: "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-x86_64.deb mv -v "${ubuntu_x86_64_debug_name}/"obs-studio-*-x86_64-linux-gnu-dbgsym.ddeb \ "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-x86_64-dbsym.ddeb + mv -v "${ubuntu_sources_name}/"obs-studio-*-sources.tar.gz \ + "${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-Sources.tar.gz echo '::endgroup::' - name: Generate Checksums 🪪 @@ -288,7 +291,7 @@ jobs: shopt -s extglob echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt - for file in ${{ github.workspace }}/@(*.deb|*.ddeb|*.dmg|*.tar.xz); do + for file in ${{ github.workspace }}/@(*.deb|*.ddeb|*.dmg|*.tar.xz|*.tar.gz); do echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt done @@ -307,3 +310,4 @@ jobs: ${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-macOS-*-dSYMs.tar.xz ${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-*.deb ${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-*.ddeb + ${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-Sources.tar.gz diff --git a/CI/build-freebsd.sh b/CI/build-freebsd.sh deleted file mode 100755 index 36b615a4c..000000000 --- a/CI/build-freebsd.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -# FreeBSD full build script -############################################################################## -# -# This script contains all steps necessary to: -# -# * Build OBS with all default plugins and dependencies -# * Package a FreeBSD package -# -# Parameters: -# -h, --help : Print usage help -# -q, --quiet : Suppress most build process output -# -v, --verbose : Enable more verbose build process output -# -d, --skip-dependency-checks : Skip dependency checks (default: off) -# -p, --portable : Create portable build (default: off) -# -pkg, --package : Create distributable archive -# (default: off) -# --build-dir : Specify alternative build directory -# (default: build)" -# -############################################################################## - -# Halt on errors -set -eE - -## SET UP ENVIRONMENT ## -_RUN_OBS_BUILD_SCRIPT=TRUE -PRODUCT_NAME="OBS-Studio" - -CHECKOUT_DIR="$(git rev-parse --show-toplevel)" -DEPS_BUILD_DIR="${CHECKOUT_DIR}/../obs-build-dependencies" -source "${CHECKOUT_DIR}/CI/include/build_support.sh" -source "${CHECKOUT_DIR}/CI/include/build_support_freebsd.sh" - -## DEPENDENCY INSTALLATION -source "${CHECKOUT_DIR}/CI/freebsd/01_install_dependencies.sh" - -## BUILD OBS ## -source "${CHECKOUT_DIR}/CI/freebsd/02_build_obs.sh" - -## PACKAGE OBS AND NOTARIZE ## -source "${CHECKOUT_DIR}/CI/freebsd/03_package_obs.sh" - -## MAIN SCRIPT FUNCTIONS ## -print_usage() { - echo "build-linux.sh - Build script for OBS-Studio\n" - echo -e "Usage: ${0}\n" \ - "-h, --help : Print this help\n" \ - "-q, --quiet : Suppress most build process output\n" \ - "-v, --verbose : Enable more verbose build process output\n" \ - "-d, --skip-dependency-checks : Skip dependency checks (default: off)\n" \ - "-p, --portable : Create portable build (default: off)\n" \ - "-pkg, --package : Create distributable disk image (default: off)\n" \ - "--build-dir : Specify alternative build directory (default: build)\n" -} - -obs-build-main() { - while true; do - case "${1}" in - -h | --help ) print_usage; exit 0 ;; - -q | --quiet ) export QUIET=TRUE; shift ;; - -v | --verbose ) export VERBOSE=TRUE; shift ;; - -d | --skip-dependency-checks ) SKIP_DEP_CHECKS=TRUE; shift ;; - -p | --portable ) PORTABLE=TRUE; shift ;; - -pkg | --package ) PACKAGE=TRUE; shift ;; - --disable-pipewire ) DISABLE_PIPEWIRE=TRUE; shift ;; - --build-dir ) BUILD_DIR="${2}"; shift 2 ;; - -- ) shift; break ;; - * ) break ;; - esac - done - - ensure_dir "${CHECKOUT_DIR}" - step "Fetching OBS tags..." - git fetch origin --tags - - GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - GIT_HASH=$(git rev-parse --short HEAD) - GIT_TAG=$(git describe --tags --abbrev=0) - - FILE_NAME="obs-studio-${GIT_TAG}-${GIT_HASH}-FreeBSD" - - if [ -z "${SKIP_DEP_CHECKS}" ]; then - install_dependencies - fi - - build_obs - - if [ "${PACKAGE}" ]; then - package_obs - fi - - cleanup -} - -obs-build-main $* diff --git a/CI/freebsd/01_install_dependencies.sh b/CI/freebsd/01_install_dependencies.sh deleted file mode 100644 index bfd0252e7..000000000 --- a/CI/freebsd/01_install_dependencies.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -# FreeBSD dependency management function -############################################################################## -# -# This script file can be included in build scripts or run directly -# -############################################################################## - -# Halt on errors -set -eE - -install_build-deps() { - shift - status "Install OBS build dependencies" - trap "caught_error 'install_build-deps'" ERR - - sudo pkg install -U -y $@ -} - -install_obs-deps() { - shift - status "Install OBS dependencies" - trap "caught_error 'install_obs-deps'" ERR - - if [ -z "${DISABLE_PIPEWIRE}" ]; then - sudo pkg install -U -y $@ pipewire - else - sudo pkg install -U -y $@ - fi -} - -install_qt-deps() { - shift - status "Install Qt dependencies" - trap "caught_error 'install_qt-deps'" ERR - - sudo pkg install -U -y $@ -} - -install_plugin-deps() { - shift - status "Install plugin dependencies" - trap "caught_error 'install_plugin-deps'" ERR - - sudo pkg install -U -y $@ -} - -install_dependencies() { - status "Set up apt" - trap "caught_error 'install_dependencies'" ERR - - BUILD_DEPS=( - "build-deps cmake ninja pkgconf curl ccache" - "obs-deps ffmpeg libx264 mbedtls mesa-libs jansson lua52 luajit python37 libX11 xorgproto libxcb \ - libXcomposite libXext libXfixes libXinerama libXrandr swig dbus jansson libICE libSM libsysinfo" - "qt-deps qt5-buildtools qt5-qmake qt5-imageformats qt5-core qt5-gui qt5-svg qt5-widgets qt5-xml" - "plugin-deps v4l_compat fdk-aac fontconfig freetype2 speexdsp libudev-devd libv4l vlc audio/jack pulseaudio sndio" - ) - - for DEPENDENCY in "${BUILD_DEPS[@]}"; do - set -- ${DEPENDENCY} - trap "caught_error ${DEPENDENCY}" ERR - FUNC_NAME="install_${1}" - ${FUNC_NAME} ${@} - done -} - -install-dependencies-standalone() { - CHECKOUT_DIR="$(git rev-parse --show-toplevel)" - PRODUCT_NAME="OBS-Studio" - DEPS_BUILD_DIR="${CHECKOUT_DIR}/../obs-build-dependencies" - source "${CHECKOUT_DIR}/CI/include/build_support.sh" - source "${CHECKOUT_DIR}/CI/include/build_support_freebsd.sh" - - status "Setup of OBS build dependencies" - install_dependencies -} - -print_usage() { - echo -e "Usage: ${0}\n" \ - "-h, --help : Print this help\n" \ - "-q, --quiet : Suppress most build process output\n" \ - "-v, --verbose : Enable more verbose build process output\n" - "--disable-pipewire : Disable building with PipeWire support (default: off)\n" -} - -install-dependencies-main() { - if [ -z "${_RUN_OBS_BUILD_SCRIPT}" ]; then - while true; do - case "${1}" in - -h | --help ) print_usage; exit 0 ;; - -q | --quiet ) export QUIET=TRUE; shift ;; - -v | --verbose ) export VERBOSE=TRUE; shift ;; - --disable-pipewire ) DISABLE_PIPEWIRE=TRUE; shift ;; - -- ) shift; break ;; - * ) break ;; - esac - done - - install-dependencies-standalone - fi -} - -install-dependencies-main $* diff --git a/CI/freebsd/02_build_obs.sh b/CI/freebsd/02_build_obs.sh deleted file mode 100644 index 8563cefea..000000000 --- a/CI/freebsd/02_build_obs.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -# FreeBSD build function -############################################################################## -# -# This script file can be included in build scripts for FreeBSD or run -# directly -# -############################################################################## - -# Halt on errors -set -eE - -build_obs() { - status "Build OBS" - if [ -z "${CI}" ]; then - _backup_artifacts - fi - - step "Configure OBS..." - _configure_obs - - ensure_dir "${CHECKOUT_DIR}/" - step "Build OBS targets..." - cmake --build ${BUILD_DIR} -} - -# Function to configure OBS build -_configure_obs() { - ensure_dir "${CHECKOUT_DIR}" - status "Configuration of OBS build system..." - check_ccache - - if [ "${TWITCH_CLIENTID}" -a "${TWITCH_HASH}" ]; then - TWITCH_OPTIONS="-DTWITCH_CLIENTID='${TWITCH_CLIENTID}' -DTWITCH_HASH='${TWITCH_HASH}'" - fi - - if [ "${RESTREAM_CLIENTID}" -a "${RESTREAM_HASH}" ]; then - RESTREAM_OPTIONS="-DRESTREAM_CLIENTID='${RESTREAM_CLIENTID}' -DRESTREAM_HASH='${RESTREAM_HASH}'" - fi - - if [ "${YOUTUBE_CLIENTID}" -a "${YOUTUBE_CLIENTID_HASH}" -a "${YOUTUBE_SECRET}" -a "{YOUTUBE_SECRET_HASH}" ]; then - YOUTUBE_OPTIONS="-DYOUTUBE_CLIENTID='${YOUTUBE_CLIENTID}' -DYOUTUBE_CLIENTID_HASH='${YOUTUBE_CLIENTID_HASH}' -DYOUTUBE_SECRET='${YOUTUBE_SECRET}' -DYOUTUBE_SECRET_HASH='${YOUTUBE_SECRET_HASH}'" - fi - - if [ "${PORTABLE}" ]; then - PORTABLE_BUILD="ON" - fi - - if [ "${DISABLE_PIPEWIRE}" ]; then - PIPEWIRE_OPTION="-DENABLE_PIPEWIRE=OFF" - fi - - cmake -S . -B ${BUILD_DIR} -G Ninja \ - -DCMAKE_BUILD_TYPE=${BUILD_CONFIG} \ - -DLINUX_PORTABLE=${PORTABLE_BUILD:-OFF} \ - ${PIPEWIRE_OPTION} \ - ${CCACHE_OPTIONS} \ - ${TWITCH_OPTIONS} \ - ${YOUTUBE_OPTIONS} \ - ${RESTREAM_OPTIONS} \ - ${CI:+-DENABLE_UNIT_TESTS=ON -DBUILD_FOR_DISTRIBUTION=${BUILD_FOR_DISTRIBUTION} -DOBS_BUILD_NUMBER=${GITHUB_RUN_ID}} \ - ${QUIET:+-Wno-deprecated -Wno-dev --log-level=ERROR} -} - -# Function to backup previous build artifacts -_backup_artifacts() { - ensure_dir "${CHECKOUT_DIR}" - if [ -d "${BUILD_DIR}" ]; then - status "Backup of old OBS build artifacts" - - CUR_DATE=$(/bin/date +"%Y-%m-%d@%H%M%S") - NIGHTLY_DIR="${CHECKOUT_DIR}/nightly-${CUR_DATE}" - PACKAGE_NAME=$(/usr/bin/find ${BUILD_DIR} -maxdepth 1 -name "*.tar.gz" | sort -rn | head -1) - - if [ "${PACKAGE_NAME}" ]; then - step "Back up $(basename "${PACKAGE_NAME}")..." - ensure_dir "${NIGHTLY_DIR}" - ensure_dir "${CHECKOUT_DIR}" - /usr/bin/find "${BUILD_DIR}" -maxdepth 1 \( -name "obs-studio-*.sh" -o -name "obs-studio-*.tar.gz" -o -name "obs-studio-*.tar.Z" \) -print0 | /usr/bin/xargs -0 -I {} /bin/mv {} ${NIGHTLY_DIR}/ - info "You can find $(basename "${PACKAGE_NAME}") in ${NIGHTLY_DIR}" - fi - fi -} - -build-obs-standalone() { - CHECKOUT_DIR="$(git rev-parse --show-toplevel)" - PRODUCT_NAME="OBS-Studio" - DEPS_BUILD_DIR="${CHECKOUT_DIR}/../obs-build-dependencies" - source "${CHECKOUT_DIR}/CI/include/build_support.sh" - source "${CHECKOUT_DIR}/CI/include/build_support_freebsd.sh" - - build_obs -} - -print_usage() { - echo -e "Usage: ${0}\n" \ - "-h, --help : Print this help\n" \ - "-q, --quiet : Suppress most build process output\n" \ - "-v, --verbose : Enable more verbose build process output\n" \ - "-p, --portable : Create portable build (default: off)\n" \ - "--disable-pipewire : Disable building with PipeWire support (default: off)\n" \ - "--build-dir : Specify alternative build directory (default: build)\n" -} - -build-obs-main() { - if [ -z "${_RUN_OBS_BUILD_SCRIPT}" ]; then - while true; do - case "${1}" in - -h | --help ) print_usage; exit 0 ;; - -q | --quiet ) export QUIET=TRUE; shift ;; - -v | --verbose ) export VERBOSE=TRUE; shift ;; - -p | --portable ) export PORTABLE=TRUE; shift ;; - --disable-pipewire ) DISABLE_PIPEWIRE=TRUE; shift ;; - --build-dir ) BUILD_DIR="${2}"; shift 2 ;; - -- ) shift; break ;; - * ) break ;; - esac - done - - build-obs-standalone - fi -} - -build-obs-main $* diff --git a/CI/freebsd/03_package_obs.sh b/CI/freebsd/03_package_obs.sh deleted file mode 100644 index 99faeca59..000000000 --- a/CI/freebsd/03_package_obs.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -# FreeBSD OBS package function -############################################################################## -# -# This script file can be included in build scripts for FreeBSD or run directly -# -############################################################################## - -# Halt on errors -set -eE - -package_obs() { - status "Create FreeBSD debian package" - trap "caught_error 'package app'" ERR - - ensure_dir "${CHECKOUT_DIR}" - - step "Package OBS..." - cmake --build ${BUILD_DIR} -t package - - ZIP_NAME="$(/usr/bin/find "${BUILD_DIR}" -maxdepth 1 -type f -name "obs-studio-*.sh" | sort -rn | head -1)" - - if [ "${ZIP_NAME}" ]; then - mv "${ZIP_NAME%.*}.sh" "${BUILD_DIR}/${FILE_NAME}.sh" - mv "${ZIP_NAME%.*}.tar.gz" "${BUILD_DIR}/${FILE_NAME}.tar.gz" - mv "${ZIP_NAME%.*}.tar.Z" "${BUILD_DIR}/${FILE_NAME}.tar.Z" - else - error "ERROR No suitable OBS debian package generated" - fi -} - -package-obs-standalone() { - PRODUCT_NAME="OBS-Studio" - - CHECKOUT_DIR="$(git rev-parse --show-toplevel)" - DEPS_BUILD_DIR="${CHECKOUT_DIR}/../obs-build-dependencies" - source ${CHECKOUT_DIR}/CI/include/build_support.sh - source ${CHECKOUT_DIR}/CI/include/build_support_freebsd.sh - - step "Fetch OBS tags..." - git fetch origin --tags - - GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - GIT_HASH=$(git rev-parse --short=9 HEAD) - GIT_TAG=$(git describe --tags --abbrev=0) - - FILE_NAME="obs-studio-${GIT_TAG}-${GIT_HASH}-freebsd" - package_obs -} - -print_usage() { - echo -e "Usage: ${0}\n" \ - "-h, --help : Print this help\n" \ - "-q, --quiet : Suppress most build process output\n" \ - "-v, --verbose : Enable more verbose build process output\n" \ - "--build-dir : Specify alternative build directory (default: build)\n" -} - -package-obs-main() { - if [ -z "${_RUN_OBS_BUILD_SCRIPT}" ]; then - while true; do - case "${1}" in - -h | --help ) print_usage; exit 0 ;; - -q | --quiet ) export QUIET=TRUE; shift ;; - -v | --verbose ) export VERBOSE=TRUE; shift ;; - --build-dir ) BUILD_DIR="${2}"; shift 2 ;; - -- ) shift; break ;; - * ) break ;; - esac - done - - package-obs-standalone - fi -} - -package-obs-main $* diff --git a/CI/include/build_support.sh b/CI/include/build_support.sh deleted file mode 100644 index 736782ffa..000000000 --- a/CI/include/build_support.sh +++ /dev/null @@ -1,219 +0,0 @@ -#!/bin/bash - -############################################################################## -# Unix support functions -############################################################################## -# -# This script file can be included in build scripts for UNIX-compatible -# shells to compose build scripts. -# -############################################################################## - -## DEFINE UTILITIES ## - -if [ -z "${QUIET}" ]; then - status() { - echo -e "${COLOR_BLUE}[${PRODUCT_NAME}] ${1}${COLOR_RESET}" - } - - step() { - echo -e "${COLOR_GREEN} + ${1}${COLOR_RESET}" - } - - info() { - echo -e "${COLOR_ORANGE} + ${1}${COLOR_RESET}" - } - - error() { - echo -e "${COLOR_RED} + ${1}${COLOR_RESET}" - } -else - status() { - : - } - - step() { - : - } - - info() { - : - } - - error() { - echo -e "${COLOR_RED} + ${1}${COLOR_RESET}" - } -fi - -exists() { - /usr/bin/command -v "$1" >/dev/null 2>&1 -} - -ensure_dir() { - [ -n "${1}" ] && /bin/mkdir -p "${1}" && builtin cd "${1}" -} - -cleanup() { - : -} - -caught_error() { - error "ERROR during build step: ${1}" - cleanup - exit 1 -} - -# Setup build environment -BUILD_DIR="${BUILD_DIR:-build}" -BUILD_CONFIG="${BUILD_CONFIG:-RelWithDebInfo}" -CI_WORKFLOW="${CHECKOUT_DIR}/.github/workflows/main.yml" -CURRENT_ARCH="$(uname -m)" -CURRENT_DATE="$(date +"%Y-%m-%d")" - -## Utility functions ## - -check_ccache() { - step "Check CCache..." - if ccache -V >/dev/null 2>&1; then - info "CCache available" - CMAKE_CCACHE_OPTIONS="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache" - - if [ "${CI}" ]; then - ccache --set-config=compiler_check=content - ccache --set-config=cache_dir=${GITHUB_WORKSPACE:-${HOME}}/.ccache - ccache --set-config=max_size=${CCACHE_SIZE:-1G} - ccache --set-config=compression=false - ccache --set-config=sloppiness=include_file_mtime,include_file_ctime,file_stat_matches,system_headers - ccache -z - fi - else - info "CCache not available" - fi -} - -safe_fetch() { - if [ $# -lt 2 ]; then - error "Usage: safe_fetch URL HASH" - return 1 - fi - - while true; do - case "${1}" in - -n | --nocontinue ) NOCONTINUE=TRUE; shift ;; - -- ) shift; break ;; - * ) break ;; - esac - done - - DOWNLOAD_URL="${1}" - DOWNLOAD_HASH="${2}" - DOWNLOAD_FILE="$(basename ${DOWNLOAD_URL})" - CURLCMD=${CURLCMD:-curl} - - if [ "${NOCONTINUE}" ]; then - ${CURLCMD/--continue-at -/} "${DOWNLOAD_URL}" - else - ${CURLCMD} "${DOWNLOAD_URL}" - fi - - if [ "${DOWNLOAD_HASH}" = "$(sha256sum "${DOWNLOAD_FILE}" | cut -d " " -f 1)" ]; then - info "${DOWNLOAD_FILE} downloaded successfully and passed hash check" - return 0 - else - error "${DOWNLOAD_FILE} downloaded successfully and failed hash check" - return 1 - fi -} - -check_and_fetch() { - if [ $# -lt 2 ]; then - caught_error "Usage: check_and_fetch URL HASH" - fi - - while true; do - case "${1}" in - -n | --nocontinue ) NOCONTINUE=TRUE; shift ;; - -- ) shift; break ;; - * ) break ;; - esac - done - - DOWNLOAD_URL="${1}" - DOWNLOAD_HASH="${2}" - DOWNLOAD_FILE="$(basename "${DOWNLOAD_URL}")" - - if [ -f "${DOWNLOAD_FILE}" ] && [ "${DOWNLOAD_HASH}" = "$(sha256sum "${DOWNLOAD_FILE}" | cut -d " " -f 1)" ]; then - info "${DOWNLOAD_FILE} exists and passed hash check" - return 0 - else - safe_fetch "${DOWNLOAD_URL}" "${DOWNLOAD_HASH}" - fi -} - -github_fetch() { - if [ $# -ne 3 ]; then - error "Usage: github_fetch GITHUB_USER GITHUB_REPOSITORY GITHUB_COMMIT_HASH" - return 1 - fi - - GH_USER="${1}" - GH_REPO="${2}" - GH_REF="${3}" - - if [ -d "./.git" ]; then - info "Repository ${GH_USER}/${GH_REPO} already exists, updating..." - git config advice.detachedHead false - git config remote.origin.url "https://github.com/${GH_USER}/${GH_REPO}.git" - git config remote.origin.fetch "+refs/heads/master:refs/remotes/origin/master" - git config remote.origin.tapOpt --no-tags - - if ! git rev-parse -q --verify "${GH_COMMIT}^{commit}"; then - git fetch origin - fi - - git checkout -f "${GH_REF}" -- - git reset --hard "${GH_REF}" -- - if [ -d "./.gitmodules" ]; then - git submodule foreach --recursive git submodule sync - git submodule update --init --recursive - fi - - else - git clone "https://github.com/${GH_USER}/${GH_REPO}.git" "$(pwd)" - git config advice.detachedHead false - info "Checking out commit ${GH_REF}..." - git checkout -f "${GH_REF}" -- - - if [ -d "./.gitmodules" ]; then - git submodule foreach --recursive git submodule sync - git submodule update --init --recursive - fi - fi -} - -apply_patch() { - if [ $# -ne 2 ]; then - error "Usage: apply_patch PATCH_URL PATCH_HASH" - return 1 - fi - - COMMIT_URL="${1}" - COMMIT_HASH="${2}" - PATCH_FILE="$(basename ${COMMIT_URL})" - - if [ "${COMMIT_URL:0:5}" = "https" ]; then - ${CURLCMD:-curl} "${COMMIT_URL}" - if [ "${COMMIT_HASH}" = "$(sha256sum ${PATCH_FILE} | cut -d " " -f 1)" ]; then - info "${PATCH_FILE} downloaded successfully and passed hash check" - else - error "${PATCH_FILE} downloaded successfully and failed hash check" - return 1 - fi - - info "Applying patch ${COMMIT_URL}" - else - PATCH_FILE="${COMMIT_URL}" - fi - - patch -g 0 -f -p1 -i "${PATCH_FILE}" -} diff --git a/CI/include/build_support_freebsd.sh b/CI/include/build_support_freebsd.sh deleted file mode 100644 index 67209416b..000000000 --- a/CI/include/build_support_freebsd.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -# FreeBSD support functions -############################################################################## -# -# This script file can be included in build scripts for FreeBSD. -# -############################################################################## - -# Setup build environment - -if [ "${TERM-}" -a -x /usr/local/bin/tput ]; then - COLOR_RED=$(/usr/local/bin/tput setaf 1) - COLOR_GREEN=$(/usr/local/bin/tput setaf 2) - COLOR_BLUE=$(/usr/local/bin/tput setaf 4) - COLOR_ORANGE=$(/usr/local/bin/tput setaf 3) - COLOR_RESET=$(/usr/local/bin/tput sgr0) -else - COLOR_RED="" - COLOR_GREEN="" - COLOR_BLUE="" - COLOR_ORANGE="" - COLOR_RESET="" -fi - -if [ "${CI}" -o "${QUIET}" ]; then - export CURLCMD="curl --silent --show-error --location -O" -else - export CURLCMD="curl --progress-bar --location --continue-at - -O" -fi - -_add_ccache_to_path() { - if [ "${CMAKE_CCACHE_OPTIONS}" ]; then - PATH="/usr/local/opt/ccache/libexec:${PATH}" - status "Compiler Info:" - local IFS=$'\n' - for COMPILER_INFO in $(type cc c++ gcc g++ clang clang++ || true); do - info "${COMPILER_INFO}" - done - fi -} diff --git a/buildspec.json b/buildspec.json index da45f724e..2832be1bd 100644 --- a/buildspec.json +++ b/buildspec.json @@ -29,15 +29,15 @@ "hashes": { "macos-x86_64": "140bfd517b4b9d12343ac000abba7bb16eecefe80ecbd7225993d03f0b9c0603", "macos-arm64": "3970a781132b033bb9be6a9fe328a07e97fa7737fdf1575b1c5db24a3e130da1", - "linux-x86_64": "1253a6a36c3b8ac5b5ece9bfdb6eae6ab75e49516375fc475e2e871795ad9bea", - "linux-aarch64": "66ebcfce94a4527c8dd085a685691d0c43291adab9f2be4f8a0762f4a614083a", + "ubuntu-x86_64": "1253a6a36c3b8ac5b5ece9bfdb6eae6ab75e49516375fc475e2e871795ad9bea", + "ubuntu-aarch64": "66ebcfce94a4527c8dd085a685691d0c43291adab9f2be4f8a0762f4a614083a", "windows-x64": "7480e9ed5688e09919db67237d130eef9a4c24df32ba2a7b8a5587de45ff8e69" }, "revision": { "macos-x86_64": 4, "macos-arm64": 4, - "linux-x86_64": 3, - "linux-aarch64": 3, + "ubuntu-x86_64": 3, + "ubuntu-aarch64": 3, "windows-x64": 3 } } @@ -57,13 +57,11 @@ } }, "platformConfig": { - "macos-universal": { - "qtVersion": 6 + "ubuntu-x86_64": { + "qtVersion": 6, + "generator": "Ninja" }, - "windows-x64": { - "qtVersion": 6 - }, - "linux-x86_64": { + "ubuntu-aarch64": { "qtVersion": 6, "generator": "Ninja" }