mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-26 17:40:12 -04:00
CI: Update Linux build scripts to use CMake presets
Also adds source package generation and updates Cirrus CI script.
This commit is contained in:
30
.github/scripts/.build.zsh
vendored
30
.github/scripts/.build.zsh
vendored
@@ -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}
|
||||
|
||||
31
.github/scripts/.package.zsh
vendored
31
.github/scripts/.package.zsh
vendored
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)}")
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user