Skip to content

Commit fb4d658

Browse files
PatTheMavRytoEX
authored andcommitted
CI: Update Linux build scripts to use CMake presets
Also adds source package generation and updates Cirrus CI script.
1 parent 53c9f79 commit fb4d658

18 files changed

+96
-737
lines changed

.cirrus.yml

+16-14
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ env:
99

1010
task:
1111
install_script:
12-
- pkg install -y
13-
alsa-lib
14-
v4l_compat swig ffmpeg curl dbus fdk-aac fontconfig
15-
freetype2 jackit jansson luajit mbedtls pulseaudio speexdsp
16-
libpci librist libsysinfo libudev-devd libv4l libx264 cmake ninja
17-
mesa-libs lua52 pkgconf
18-
srt
19-
qt5-svg qt5-qmake qt5-buildtools qt5-x11extras qt5-xml
20-
pipewire
12+
- pkg-install -y
13+
cmake ninja binutils pkgconf curl
14+
ffmpeg qt6-base qt6-svg jansson libsysinfo e2fsprogs-libuuid pulseaudio
15+
alsa-lib pipewire v4l_compat libpci librist srt nlohmann-json uthash
16+
qr-code-generator websocketpp asio vlc swig luajit jackit sndio fdk-aac
2117
script:
22-
- mkdir build
23-
- cd build
2418
- cmake
25-
-DENABLE_AJA=OFF
26-
-GNinja ..
27-
- ninja
19+
-S $(pwd)
20+
-B build
21+
-G Ninja
22+
-DOBS_CMAKE_VERSION=3.0
23+
-DENABLE_JACK:BOOL=ON
24+
-DENABLE_SNDIO:BOOL=ON
25+
-DENABLE_LIBFDK:BOOL=ON
26+
-DENABLE_WEBRTC:BOOL=OFF
27+
- cmake
28+
--build build
29+
--config RelWithDebInfo

.github/actions/build-obs/action.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ runs:
7373
7474
local -a build_args=(
7575
--config ${{ inputs.config }}
76-
--target linux-${{ inputs.target }}
76+
--target ubuntu-${{ inputs.target }}
7777
)
7878
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
7979
8080
git fetch origin --no-tags --no-recurse-submodules -q
81-
.github/scripts/build-linux ${build_args}
81+
.github/scripts/build-ubuntu ${build_args}
8282
8383
- name: Run Windows Build
8484
if: runner.os == 'Windows'

.github/actions/package-obs/action.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ runs:
8181
: Run Ubuntu Packaging
8282
8383
local -a package_args=(
84-
--target linux-${{ inputs.target }}
84+
--target ubuntu-${{ inputs.target }}
8585
--config ${{ inputs.config }}
8686
)
8787
if (( ${+RUNNER_DEBUG} )) build_args+=(--debug)
8888
8989
if [[ '${{ inputs.package }}' == true ]] package_args+=(--package)
9090
91-
${{ inputs.workingDirectory }}/.github/scripts/package-linux ${package_args}
91+
${{ inputs.workingDirectory }}/.github/scripts/package-ubuntu ${package_args}
9292
9393
- name: Run Windows packaging
9494
if: runner.os == 'Windows'

.github/scripts/.build.zsh

+14-14
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ build() {
5656
local -r -a _valid_targets=(
5757
macos-x86_64
5858
macos-arm64
59-
linux-x86_64
59+
ubuntu-x86_64
60+
ubuntu-aarch64
6061
)
6162

6263
local config='RelWithDebInfo'
@@ -66,7 +67,7 @@ build() {
6667
local -a args
6768
while (( # )) {
6869
case ${1} {
69-
-t|--target|--generator|-c|--config)
70+
-t|--target|-c|--config)
7071
if (( # == 1 )) || [[ ${2:0:1} == '-' ]] {
7172
log_error "Missing value for option %B${1}%b"
7273
exit 2
@@ -104,8 +105,8 @@ build() {
104105
check_${host_os}
105106
setup_ccache
106107

107-
if [[ ${host_os} == linux ]] {
108-
autoload -Uz setup_linux && setup_linux
108+
if [[ ${host_os} == ubuntu ]] {
109+
autoload -Uz setup_ubuntu && setup_ubuntu
109110
}
110111

111112
local product_name
@@ -188,21 +189,20 @@ build() {
188189
}
189190
popd
190191
;;
191-
linux-*)
192+
ubuntu-*)
192193
local cmake_bin='/usr/bin/cmake'
193194
cmake_args+=(
194-
-S ${PWD} -B build_${target##*-}
195-
-G Ninja
196-
-DCMAKE_BUILD_TYPE:STRING=${config}
197-
-DCEF_ROOT_DIR:PATH="${project_root}/.deps/cef_binary_${CEF_VERSION}_${target//-/_}"
198-
-DENABLE_AJA:BOOL=OFF
199-
-DENABLE_WEBRTC:BOOL=OFF
200-
-DENABLE_NATIVE_NVENC:BOOL=OFF
195+
--preset ubuntu-ci
196+
--toolchain ${project_root}/cmake/linux/toolchain-${target##*-}-gcc.cmake
197+
-DENABLE_BROWSER:BOOL=ON
198+
-DCEF_ROOT_DIR:PATH="${project_root}/.deps/cef_binary_${CEF_VERSION}_${target//ubuntu-/linux_}"
201199
)
200+
202201
if (( ! UBUNTU_2210_OR_LATER )) cmake_args+=(-DENABLE_NEW_MPEGTS_OUTPUT:BOOL=OFF)
202+
if [[ ${target##*-} == aarch64 ]] cmake-args+=(-DENABLE_QSV11:BOOL=OFF)
203203

204-
cmake_build_args+=(build_${target##*-} --config ${config} --parallel)
205-
cmake_install_args+=(build_${target##*-} --prefix ${project_root}/build_${target##*-}/install/${config})
204+
cmake_build_args+=(build_${target%%-*} --config ${config} --parallel)
205+
cmake_install_args+=(build_${target%%-*} --prefix ${project_root}/build_${target%%-*}/install/${config})
206206

207207
log_group "Configuring ${product_name}..."
208208
${cmake_bin} -S ${project_root} ${cmake_args}

.github/scripts/.package.zsh

+22-9
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ package() {
5151
local -r -a _valid_targets=(
5252
macos-x86_64
5353
macos-arm64
54-
linux-x86_64
54+
ubuntu-x86_64
5555
)
5656

5757
local config='RelWithDebInfo'
@@ -208,32 +208,45 @@ package() {
208208
209209
log_group
210210
211-
} elif [[ ${host_os} == linux ]] {
211+
} elif [[ ${host_os} == ubuntu ]] {
212212
local cmake_bin='/usr/bin/cmake'
213213
local -a cmake_args=()
214214
if (( debug )) cmake_args+=(--verbose)
215215
216216
if (( package )) {
217217
log_group "Packaging obs-studio..."
218218
pushd ${project_root}
219-
${cmake_bin} --build build_${target##*-} --config ${config} -t package ${cmake_args}
220-
output_name="${output_name}-${target##*-}-linux-gnu"
219+
${cmake_bin} --build build_${target%%-*} --config ${config} --target package ${cmake_args}
220+
output_name="${output_name}-${target##*-}-ubuntu-gnu"
221221
222-
pushd ${project_root}/build_${target##*-}
223-
local -a files=(obs-studio-*-Linux*.(ddeb|deb))
222+
pushd ${project_root}/build_${target%%-*}
223+
local -a files=(obs-studio-*-Linux*.(ddeb|deb|ddeb.sha256|deb.sha256))
224224
for file (${files}) {
225225
mv ${file} ${file//obs-studio-*-Linux/${output_name}}
226226
}
227227
popd
228228
popd
229229
} else {
230230
log_group "Archiving obs-studio..."
231-
output_name="${output_name}-${target##*-}-linux-gnu"
231+
output_name="${output_name}-${target##*-}-ubuntu-gnu"
232232
233-
pushd ${project_root}/build_${target##*-}/install/${config}
234-
XZ_OPT=-T0 tar -cvJf ${project_root}/build_${target##*-}/${output_name}.tar.xz (bin|lib|share)
233+
pushd ${project_root}/build_${target%%-*}/install/${config}
234+
XZ_OPT=-T0 tar -cvJf ${project_root}/build_${target%%-*}/${output_name}.tar.xz (bin|lib|share)
235235
popd
236236
}
237+
238+
pushd ${project_root}
239+
${cmake_bin} --build build_${target%%-*} --config ${config} --target package_source ${cmake_args}
240+
output_name="${output_name}-sources"
241+
242+
pushd ${project_root}/build_${target%%-*}
243+
local -a files=(obs-studio-*-sources.tar.*)
244+
for file (${files}) {
245+
mv ${file} ${file//obs-studio-*-sources/${output_name}}
246+
}
247+
popd
248+
popd
249+
237250
log_group
238251
}
239252
}
File renamed without changes.
File renamed without changes.

.github/scripts/utils.zsh/check_linux .github/scripts/utils.zsh/check_ubuntu

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
autoload -Uz log_debug log_group
22

3-
log_group 'Check Linux build requirements'
4-
log_debug 'Checking Linux distribution name and version...'
3+
log_group 'Check Ubuntu build requirements'
4+
log_debug 'Checking Ubuntu distribution name and version...'
55

66
# Check for Ubuntu version 22.10 or later, which have srt and librist available via apt-get
77
typeset -g -i UBUNTU_2210_OR_LATER=0
8-
if [[ -f /etc/os_release ]] {
8+
if [[ -f /etc/os-release ]] {
99
local dist_name
1010
local dist_version
11-
read -r dist_name dist_version <<< "$(source /etc/os_release; print "${NAME} ${VERSION_ID}")"
11+
read -r dist_name dist_version <<< "$(source /etc/os-release; print "${NAME} ${VERSION_ID}")"
12+
13+
if [[ ${dist_name} != Ubuntu ]] {
14+
log_error "Not running on an Ubuntu distribution. Aborting"
15+
log_group
16+
return 2
17+
}
1218

1319
autoload -Uz is-at-least
14-
if [[ ${dist_name} == Ubuntu ]] && is-at-least 22.10 ${dist_version}; then
20+
if is-at-least 22.10 ${dist_version}; then
1521
typeset -g -i UBUNTU_2210_OR_LATER=1
1622
fi
23+
} else {
24+
log_error "Unable to determine local Linux distribution, but Ubuntu is required. Aborting"
25+
log_group
26+
return 2
1727
}
1828

1929
local -a dependencies=("${(fA)$(<${SCRIPT_HOME}/.Aptfile)}")

.github/scripts/utils.zsh/setup_linux .github/scripts/utils.zsh/setup_ubuntu

+8-6
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ if (( ! deps_version )) {
4040
log_group 'Setting up pre-built Chromium Embedded Framework...'
4141

4242
pushd ${project_root}/.deps
43-
local _filename="cef_binary_${deps_version}_${target//-/_}${deps_revision:+"_v${deps_revision}"}.tar.xz"
43+
local _filename="cef_binary_${deps_version}_${target//ubuntu-/linux_}${deps_revision:+"_v${deps_revision}"}.tar.xz"
4444
local _url=${deps_baseurl}/${_filename}
45-
local _target="cef_binary_${deps_version}_${target//-/_}"
45+
local _target="cef_binary_${deps_version}_${target//ubuntu-/linux_}"
4646
typeset -g CEF_VERSION=${deps_version}
4747

4848
log_debug "Running curl ${curl_opts} ${_url}"
@@ -75,14 +75,14 @@ if [[ ${CPUTYPE} != ${target##*-} ]] {
7575
}
7676

7777
sudo apt-get install -y --no-install-recommends \
78-
build-essential \
78+
build-essential libglib2.0-dev \
7979
lsb-release dh-cmake \
8080
libcurl4-openssl-dev \
8181
libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev \
8282
libswresample-dev libswscale-dev \
8383
libjansson-dev \
8484
libx11-xcb-dev \
85-
libgles2-mesa-dev libgles2-mesa \
85+
libgles2-mesa-dev \
8686
libwayland-dev \
8787
libpipewire-0.3-dev \
8888
libpulse-dev \
@@ -95,11 +95,13 @@ sudo apt-get install -y --no-install-recommends \
9595
libx11-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-xinerama0-dev \
9696
libxcb-composite0-dev libxinerama-dev libxcb1-dev libx11-xcb-dev libxcb-xfixes0-dev \
9797
swig libcmocka-dev libxss-dev libglvnd-dev \
98-
libxkbcommon-dev \
98+
libxkbcommon-dev libatk1.0-dev libatk-bridge2.0-dev libxcomposite-dev libxdamage-dev \
9999
libasound2-dev libfdk-aac-dev libfontconfig-dev libfreetype6-dev libjack-jackd2-dev \
100100
libpulse-dev libsndio-dev libspeexdsp-dev libudev-dev libv4l-dev libva-dev libvlc-dev \
101101
libpci-dev libdrm-dev \
102-
nlohmann-json3-dev libwebsocketpp-dev libasio-dev libvpl-dev libvpl2 libqrcodegencpp-dev
102+
nlohmann-json3-dev libwebsocketpp-dev libasio-dev libqrcodegencpp-dev
103+
104+
if [[ ${target##*-} == x86_64 ]] sudo apt-get install -y --no-install-recommends libvpl-dev libvpl2
103105

104106
if (( UBUNTU_2210_OR_LATER )) sudo apt-get install -y --no-install-recommends librist-dev libsrt-openssl-dev
105107

.github/workflows/build-project.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -213,23 +213,22 @@ jobs:
213213

214214
- name: Upload Source Tarball 🗜️
215215
uses: actions/upload-artifact@v4
216-
if: ${{ ! always() }}
217216
with:
218-
name: obs-studio-*-sources-${{ needs.check-event.outputs.commitHash }}
219-
path: ${{ github.workspace }}/build_x86_64/obs-studio-*-sources.*
217+
name: obs-studio-ubuntu-22.04-sources-${{ needs.check-event.outputs.commitHash }}
218+
path: ${{ github.workspace }}/build_ubuntu/obs-studio-*-sources.*
220219

221220
- name: Upload Artifacts 📡
222221
uses: actions/upload-artifact@v4
223222
with:
224223
name: obs-studio-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}
225-
path: ${{ github.workspace }}/build_x86_64/obs-studio-*-x86_64-linux-gnu.*
224+
path: ${{ github.workspace }}/build_ubuntu/obs-studio-*-x86_64-ubuntu-gnu.*
226225

227226
- name: Upload Debug Symbol Artifacts 🪲
228227
uses: actions/upload-artifact@v4
229228
if: ${{ fromJSON(needs.check-event.outputs.package) }}
230229
with:
231230
name: obs-studio-ubuntu-22.04-x86_64-${{ needs.check-event.outputs.commitHash }}-dbgsym
232-
path: ${{ github.workspace }}/build_x86_64/obs-studio-*-x86_64-linux-gnu-dbgsym.ddeb
231+
path: ${{ github.workspace }}/build_ubuntu/obs-studio-*-x86_64-ubuntu-gnu-dbgsym.ddeb
233232

234233
- uses: actions/cache/save@v4
235234
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'

.github/workflows/push.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ jobs:
264264
macos_intel_dsym_artifact_name="obs-studio-macos-x86_64-${commit_hash}-dSYMs"
265265
ubuntu_x86_64_artifact_name="obs-studio-ubuntu-22.04-x86_64-${commit_hash}"
266266
ubuntu_x86_64_debug_name="obs-studio-ubuntu-22.04-x86_64-${commit_hash}-dbgsym"
267+
ubuntu_sources_name="obs-studio-ubuntu-22.04-sources-${commit_hash}"
267268
268269
echo '::group::Renaming Artifacts'
269270
mv -v "${macos_arm64_artifact_name}/"obs-studio-*-macos-apple.dmg \
@@ -278,6 +279,8 @@ jobs:
278279
"${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-x86_64.deb
279280
mv -v "${ubuntu_x86_64_debug_name}/"obs-studio-*-x86_64-linux-gnu-dbgsym.ddeb \
280281
"${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-x86_64-dbsym.ddeb
282+
mv -v "${ubuntu_sources_name}/"obs-studio-*-sources.tar.gz \
283+
"${root_dir}"/OBS-Studio-${{ steps.check.outputs.version }}-Sources.tar.gz
281284
echo '::endgroup::'
282285
283286
- name: Generate Checksums 🪪
@@ -288,7 +291,7 @@ jobs:
288291
shopt -s extglob
289292
290293
echo "### Checksums" > ${{ github.workspace }}/CHECKSUMS.txt
291-
for file in ${{ github.workspace }}/@(*.deb|*.ddeb|*.dmg|*.tar.xz); do
294+
for file in ${{ github.workspace }}/@(*.deb|*.ddeb|*.dmg|*.tar.xz|*.tar.gz); do
292295
echo " ${file##*/}: $(sha256sum "${file}" | cut -d " " -f 1)" >> ${{ github.workspace }}/CHECKSUMS.txt
293296
done
294297
@@ -307,3 +310,4 @@ jobs:
307310
${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-macOS-*-dSYMs.tar.xz
308311
${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-*.deb
309312
${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-Ubuntu-*.ddeb
313+
${{ github.workspace }}/OBS-Studio-${{ steps.check.outputs.version }}-Sources.tar.gz

0 commit comments

Comments
 (0)