@@ -8,7 +8,7 @@ dir=$(dirname "$0")
88cache_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
166166deps
167167if [ -d $cache_dir ]; then
0 commit comments