Skip to content

Commit e67bda2

Browse files
committed
CI functions: if intended to run subsh, drop {}
The syntax `func() {(); }` is uneeded because the compaund command for function body can be both `( compound-list )` and ` ( compound-list; )` (i.a.). Also changed some of install_ffmpeg.sh functions from {} to () if it was not in subshell (because the most of the others are). Similarly in install_glfw.sh and some others. Those are not expected to change the main shell vars.
1 parent cc22772 commit e67bda2

9 files changed

Lines changed: 79 additions & 81 deletions

File tree

.github/scripts/Linux/install_ffmpeg.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dir=$(dirname "$0")
88
cache_dir=/var/tmp/ffmpeg
99

1010
# install the deps - runs always (regardless the cache)
11-
deps() {
11+
deps() (
1212
ffmpeg_build_dep=$(get_build_deps_excl ffmpeg 'libsdl')
1313
# shellcheck disable=SC2086 # intentional
1414
sudo apt install $ffmpeg_build_dep libde265-dev \
@@ -17,35 +17,35 @@ deps() {
1717

1818
sudo apt-get -y remove 'libavcodec*' 'libavutil*' 'libswscale*' \
1919
libvpx-dev nginx
20-
}
20+
)
2121

22-
install_aom() {(
22+
install_aom() (
2323
git clone --depth 1 https://aomedia.googlesource.com/aom
2424
mkdir -p aom/build
2525
cd aom/build
2626
cmake -DBUILD_SHARED_LIBS=1 ..
2727
cmake --build . --parallel "$(nproc)"
2828
sudo cmake --install .
29-
)}
29+
)
3030

31-
install_dav1d() {(
31+
install_dav1d() (
3232
git clone --depth 1 https://code.videolan.org/videolan/dav1d.git
3333
mkdir -p dav1d/build && cd dav1d/build
3434
meson ..
3535
ninja
3636
sudo ninja install
37-
)}
37+
)
3838

39-
install_libvpx() {(
39+
install_libvpx() (
4040
git clone --depth 1 https://github.com/webmproject/libvpx.git
4141
cd libvpx
4242
./configure --enable-pic --disable-examples --disable-install-bins \
4343
--disable-install-srcs --enable-vp9-highbitdepth
4444
make -j "$(nproc)"
4545
sudo make install
46-
)}
46+
)
4747

48-
install_svt() {
48+
install_svt() (
4949
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-HEVC &&
5050
cd SVT-HEVC/Build/linux && ./build.sh release && cd Release &&
5151
sudo cmake --install . || exit 1 )
@@ -59,33 +59,33 @@ install_svt() {
5959
# libsvtav1 in FFmpeg upstream, for SVT-HEVC now our custom patch in ffmpeg-patches
6060
# if patch apply fails, try increasing $FFMPEG_GIT_DEPTH
6161
git am -3 SVT-VP9/ffmpeg_plugin/master-*.patch
62-
}
62+
)
6363

6464
# The NV Video Codec SDK headers version 12.0 implies driver v520.56.06 in Linux
65-
install_nv_codec_headers() {
65+
install_nv_codec_headers() (
6666
git clone --depth 1 -b sdk/12.0 https://github.com/FFmpeg/nv-codec-headers
6767
( cd nv-codec-headers && make && sudo make install || exit 1 )
68-
}
68+
)
6969

70-
install_oapv() {(
70+
install_oapv() (
7171
git clone --depth 1 https://github.com/AcademySoftwareFoundation/openapv.git
7272
export CFLAGS='-ffat-lto-objects'
7373
cmake -B openapv/build -S openapv \
7474
-DCMAKE_BUILD_TYPE=Release
7575
cmake --build openapv/build --parallel "$(nproc)"
7676
sudo cmake --install openapv/build
77-
)}
77+
)
7878

79-
install_onevpl() {(
79+
install_onevpl() (
8080
git clone --depth 1 https://github.com/oneapi-src/oneVPL
8181
mkdir oneVPL/build
8282
cd oneVPL/build
8383
cmake -DBUILD_TOOLS=OFF ..
8484
cmake --build . --config Release --parallel
8585
sudo cmake --build . --config Release --target install
86-
)}
86+
)
8787

88-
install_rav1e() {(
88+
install_rav1e() (
8989
# TODO: use avx2 later
9090
if expr "${UG_ARCH-}" : '.*avx' >/dev/null; then
9191
avx2=avx2
@@ -98,10 +98,10 @@ install_rav1e() {(
9898
sudo sed -i -e 's-prefix=dist-prefix=/usr/local-' \
9999
-e 's/-lrav1e/-lrav1e -lm -pthread/' \
100100
/usr/local/lib/pkgconfig/rav1e.pc
101-
)}
101+
)
102102

103103
# build FFmpeg deps + FFmpeg itself
104-
build_install() {
104+
build_install() (
105105
rm -rf $cache_dir
106106
FFMPEG_GIT_DEPTH=5000 # greater depth is useful for 3-way merges
107107
git clone --depth $FFMPEG_GIT_DEPTH https://github.com/FFmpeg/FFmpeg.git \
@@ -143,10 +143,10 @@ build_install() {
143143
make -j "$(nproc)"
144144
sudo make install
145145
sudo ldconfig
146-
}
146+
)
147147

148148
# if cache is successfully restored, just install the builds
149-
install_cached() {
149+
install_cached() (
150150
cd $cache_dir
151151
( cd libvpx && sudo make install )
152152
( cd nv-codec-headers && sudo make install )
@@ -161,7 +161,7 @@ install_cached() {
161161

162162
sudo make install
163163
sudo ldconfig
164-
}
164+
)
165165

166166
deps
167167
if [ -d $cache_dir ]; then

.github/scripts/Linux/install_glfw.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ deps() {
1313
}
1414

1515
# build SDL, SDL_ttf and fluidsynth and also install them
16-
build_install() {
16+
build_install() (
1717
mkdir -p $cache_dir
1818
cd $cache_dir
1919

@@ -22,13 +22,13 @@ build_install() {
2222
-DGLFW_BUILD_WAYLAND=ON -DGLFW_BUILD_X11=ON
2323
cmake --build glfw/build -j "$(nproc)"
2424
sudo cmake --install glfw/build
25-
}
25+
)
2626

2727
# if cache is successfully restored, just install the builds
28-
install_cached() {
28+
install_cached() (
2929
cd $cache_dir
3030
sudo cmake --install glfw/build
31-
}
31+
)
3232

3333
deps
3434
if [ -d $cache_dir ]; then

.github/scripts/Linux/install_others.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ if [ "$(id -u)" -eq 0 ]; then
66
alias sudo=
77
fi
88

9-
install_ximea() {
9+
install_ximea() (
1010
filename=XIMEA.tgz
1111
curl -L "$XIMEA_DOWNLOAD_URL" -o "$filename"
1212
tar xzf $filename
1313
cd package
1414
sudo ./install -noudev
15-
}
15+
)
1616

17-
install_gpujpeg() {(
17+
install_gpujpeg() (
1818
curl -LO https://github.com/CESNET/GPUJPEG/releases/download/\
1919
continuous/GPUJPEG-Linux.tar.xz
2020
tar xaf GPUJPEG-Linux.tar.xz
2121
sudo cp -r GPUJPEG/* /usr/local/
2222
sudo ldconfig
23-
)}
23+
)
2424

2525
# Install NDI
26-
install_ndi() {(
26+
install_ndi() (
2727
if [ ! -f Install_NDI_SDK_Linux.tar.gz ]; then
2828
curl -Lf https://downloads.ndi.tv/SDK/NDI_SDK_Linux/\
2929
Install_NDI_SDK_v6_Linux.tar.gz -o /var/tmp/Install_NDI_SDK_Linux.tar.gz
@@ -33,20 +33,20 @@ Install_NDI_SDK_v6_Linux.tar.gz -o /var/tmp/Install_NDI_SDK_Linux.tar.gz
3333
installer=./Install*NDI*sh
3434
yes | PAGER="cat" $installer
3535
sudo cp -r NDI\ SDK\ for\ Linux/include/* /usr/local/include/
36-
)}
36+
)
3737

38-
install_svt_jpegxs() {(
38+
install_svt_jpegxs() (
3939
git clone --depth 1 https://github.com/OpenVisualCloud/SVT-JPEG-XS
4040
# when built in U22.04, the stack is set as executable for some reason,
4141
# not in Arch, eg.
4242
export LDFLAGS="-Wl,-z,noexecstack"
4343
cmake -B SVT-JPEG-XS/build SVT-JPEG-XS
4444
cmake --build SVT-JPEG-XS/build --parallel "$(nproc)"
4545
sudo cmake --install SVT-JPEG-XS/build
46-
)}
46+
)
4747

4848
# FFmpeg master needs at least v1.3.277 as for 6th Mar '25
49-
install_vulkan() {(
49+
install_vulkan() (
5050
sudo apt build-dep libvulkan1
5151
git clone --depth 1 https://github.com/KhronosGroup/Vulkan-Headers
5252
mkdir Vulkan-Headers/build
@@ -60,9 +60,9 @@ install_vulkan() {(
6060
cmake ..
6161
cmake --build . --parallel "$(nproc)"
6262
sudo make install
63-
)}
63+
)
6464

65-
install_omt() {(
65+
install_omt() (
6666
sudo apt install dotnet8
6767

6868
mkdir omt_build
@@ -89,7 +89,7 @@ install_omt() {(
8989
sudo cp libvmx/build/libvmx.so /usr/local/lib/
9090
sudo cp libomt/bin/Release/net8.0/linux-x64/publish/libomt.so /usr/local/lib/
9191
sudo cp libomt/bin/Release/net8.0/linux-x64/publish/libomt.h /usr/local/include/
92-
)}
92+
)
9393

9494
show_help=
9595
if [ $# -eq 1 ] && { [ "$1" = -h ] || [ "$1" = --help ] || [ "$1" = help ]; }; then

.github/scripts/Linux/install_sdl.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ features="-DSDL_KMSDRM=ON\
1313
-DSDL_X11=ON"
1414

1515
# install the deps - runs always (regardless the cache)
16-
deps() {
16+
deps() (
1717
sudo apt build-dep libsdl2
1818
fluidsynth_build_dep=$(get_build_deps_excl libfluidsynth3 libsdl2-dev)
1919
sdl2_ttf_build_dep=$(get_build_deps_excl libsdl2-ttf libsdl2-dev)
2020
# shellcheck disable=SC2086 # intentional
2121
sudo apt install $fluidsynth_build_dep $sdl2_ttf_build_dep libxtst-dev
22-
}
22+
)
2323

2424
# build SDL, SDL_ttf and fluidsynth and also install them
25-
build_install() {
25+
build_install() (
2626
mkdir -p $cache_dir
2727
cd $cache_dir
2828

@@ -42,15 +42,15 @@ build_install() {
4242
cmake $features -S fluidsynth -B fluidsynth/build
4343
cmake --build fluidsynth/build -j "$(nproc)"
4444
sudo cmake --install fluidsynth/build
45-
}
45+
)
4646

4747
# if cache is successfully restored, just install the builds
48-
install_cached() {
48+
install_cached() (
4949
cd $cache_dir
5050
sudo cmake --install SDL/build
5151
sudo cmake --install SDL_ttf/build
5252
sudo cmake --install fluidsynth/build
53-
}
53+
)
5454

5555
deps
5656
if [ -d $cache_dir ]; then

.github/scripts/Windows/install_cineform.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# sed -i "1s-\${prefix}-/usr/local-" lib/pkgconfig/libcineformsdk.pc
1616
#)}
1717

18-
build() {(
18+
build() (
1919
cd /c
2020
rm -rf cineform-sdk
2121
git clone --depth 1 https://github.com/gopro/cineform-sdk
@@ -25,15 +25,15 @@ build() {(
2525
cmake -DBUILD_STATIC=false -DBUILD_TOOLS=false -A x64 .. # assume
2626
# "-G 'Visual Studio 16 2019'"
2727
cmake --build . --config Release --parallel "$(nproc)"
28-
)}
28+
)
2929

30-
install() {(
30+
install() (
3131
mkdir -p /usr/local/bin /usr/local/include /usr/local/lib
3232
cd /c/cineform-sdk/build
3333
cp Release/CFHDCodec.dll /usr/local/bin/
3434
cp Release/CFHDCodec.lib /usr/local/lib/
3535
cp ../Common/* /usr/local/include/
3636
# mkdir /usr/local/lib/pkgconfig; cp libcineformsdk.pc /usr/local/lib/pkgconfig/
37-
)}
37+
)
3838

3939
$1

.github/scripts/Windows/install_spout.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh -eux
22
# Install SPOUT
33

4-
build() {(
4+
build() (
55
cd /c
66
rm -rf Spout2
77
git clone --depth 1 https://github.com/leadedge/Spout2.git
@@ -15,13 +15,13 @@ build() {(
1515
/c/Program\ Files/CMake/bin/cmake.exe -Bbuild2 . # ./BUILD already exists
1616
/c/Program\ Files/CMake/bin/cmake.exe --build build2 --config Release \
1717
-j "$(nproc)"
18-
)}
18+
)
1919

20-
install() {(
20+
install() (
2121
mkdir -p /usr/local/bin /usr/local/include /usr/local/lib
2222
cp /c/Spout2/build2/bin/Release/SpoutLibrary.dll /usr/local/bin/
2323
cp /c/Spout2/build2/lib/Release/SpoutLibrary.lib /usr/local/lib/
2424
cp /c/Spout2/SPOUTSDK/SpoutLibrary/SpoutLibrary.h /usr/local/include/
25-
)}
25+
)
2626

2727
$1

.github/scripts/Windows/prepare_msys.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ $PACMAN_INSTALL $m-imagemagick $m-opencv
6969
$PACMAN_INSTALL libtool # PCP
7070
pacman -Scc --noconfirm
7171

72-
build_aja_wrapper() {(
72+
build_aja_wrapper() (
7373
data/scripts/build_aja_lib_win64.sh
74-
)}
74+
)
7575

76-
install_deltacast() {(
76+
install_deltacast() (
7777
if [ -z "$SDK_URL" ]; then
7878
return
7979
fi
@@ -90,15 +90,15 @@ install_deltacast() {(
9090
fi
9191
cd ..
9292
rm -rf VideoMaster
93-
)}
93+
)
9494

95-
install_gpujpeg() {(
95+
install_gpujpeg() (
9696
fname=GPUJPEG-Windows.zip
9797
wget --no-verbose \
9898
https://github.com/CESNET/GPUJPEG/releases/download/continuous/"$fname"
9999
unzip "./$fname"
100100
cp -r GPUJPEG/* /usr/local/
101-
)}
101+
)
102102

103103
# Install cross-platform deps
104104
"$GITHUB_WORKSPACE/.github/scripts/install-common-deps.sh"

0 commit comments

Comments
 (0)