shellchecked .github/scripts/Linux/**/*sh

This commit is contained in:
Martin Pulec
2022-09-08 12:24:11 +02:00
parent 0462aac903
commit f0e3022b70
4 changed files with 29 additions and 34 deletions

View File

@@ -15,7 +15,7 @@ raspbian_build_sdl2() {
tar xaf SDL2-$SDL_VER.tar.gz
cd SDL2-$SDL_VER
./configure --enable-video-kmsdrm
make -j $(nproc) install
make -j "$(nproc)" install
)
}
@@ -32,7 +32,7 @@ apt -y install build-essential git pkg-config autoconf automake libtool
apt -y install portaudio19-dev libglew-dev libcurl4-openssl-dev libglfw3-dev libssl-dev libjack-dev libasound2-dev libglm-dev
# FFmpeg
if [ $ARCH = armhf ]; then # Raspbian - build own FFmpeg with OMX camera patch
if [ "$ARCH" = armhf ]; then # Raspbian - build own FFmpeg with OMX camera patch
apt -y install libraspberrypi-dev libdrm-dev
sed -i '/^deb /p;s/deb /deb-src /' /etc/apt/sources.list
apt -y update && apt -y build-dep ffmpeg
@@ -42,15 +42,11 @@ if [ $ARCH = armhf ]; then # Raspbian - build own FFmpeg with OMX camera patch
git checkout n4.3.3
# apply patches
FF_PATCH_DIR=/ffmpeg-arm-patches
for n in `ls $FF_PATCH_DIR`; do
git apply $FF_PATCH_DIR/$n
done
find /ffmpeg-arm-patches -name '*.patch' -print0 | xargs -0 -n 1 git apply
./configure --enable-gpl --disable-stripping --enable-libaom --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libspeex --enable-libvpx --enable-libwebp --enable-libx265 --enable-omx --enable-neon --enable-libx264 --enable-mmal --enable-omx-rpi --enable-rpi --enable-vout-drm --enable-libdrm --enable-v4l2-request --enable-libudev --cpu=arm1176jzf-s --enable-shared --disable-static
make -j3 install
cd $OLDPWD
cd "$OLDPWD"
else
apt -y install libavcodec-dev libavformat-dev libsdl2-dev libswscale-dev
fi
@@ -63,6 +59,6 @@ cd AppImageKit && patch -N -p1 < /mksquashfs-compilation-fix.patch
cd build
cmake -DAUXILIARY_FILES_DESTINATION= ..
make -j 3 install
cd $OLDPWD
cd "$OLDPWD"
rm -rf FFmpeg AppImageKit

View File

@@ -4,13 +4,12 @@ export CPATH=/usr/local/include${CPATH:+":$CPATH"}
EXTRA_LIB_PATH=/usr/local/cuda/lib64:/usr/local/lib
export LIBRARY_PATH=$EXTRA_LIB_PATH${LIBRARY_PATH:+":$LIBRARY_PATH"}
export LD_LIBRARY_PATH=$EXTRA_LIB_PATH${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}
export PATH=/usr/local/bin:$PATH
export PATH="/usr/local/bin:$PATH"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH:+":$PKG_CONFIG_PATH"}
APPDIR=UltraGrid.AppDir
ARCH=`dpkg --print-architecture`
ARCH=$(dpkg --print-architecture)
APPNAME=UltraGrid-latest-${ARCH}.AppImage
DIR=UltraGrid-AppImage
./autogen.sh --enable-plugins
@@ -19,9 +18,9 @@ mkdir tmpinstall
make DESTDIR=tmpinstall install
mv tmpinstall/usr/local/* $APPDIR
for n in $APPDIR/bin/* $APPDIR/lib/ultragrid/*
for n in "$APPDIR"/bin/* "$APPDIR"/lib/ultragrid/*
do
for lib in `ldd $n | awk '{ print $3 }'`; do [ ! -f $lib ] || cp $lib $APPDIR/lib; done
for lib in $(ldd "$n" | awk '{ print $3 }'); do [ ! -f "$lib" ] || cp "$lib" $APPDIR/lib; done
done
# glibc libraries should not be bundled
@@ -104,5 +103,5 @@ chmod 755 $APPDIR/AppRun
cp data/ultragrid.png $APPDIR/ultragrid.png
cp data/uv-qt.desktop $APPDIR/ultragrid.desktop
appimagetool --comp gzip $APPDIR $APPNAME # --sign
appimagetool --comp gzip $APPDIR "$APPNAME" # --sign

View File

@@ -11,32 +11,35 @@ GLIBCXX_MAX=$2
CXX_MAX=$3
shift 3
SEMVER_CMP=$(dirname $0)/utils/semver.sh
SEMVER_CMP=$(dirname "$0")/utils/semver.sh
if [ ! -x $SEMVER_CMP ]; then
if [ ! -x "$SEMVER_CMP" ]; then
echo "semver.sh script not present!" >&2
exit 2
fi
while test $# -gt 0; do
if [ ! -f $1 ]; then
if [ ! -f "$1" ]; then
shift
continue
fi
GLIBC_CUR=$(ldd -r -v $1 | sed -n 's/.*(GLIBC_\([0-9.]*\)).*/\1/p' | sort -V | tail -n 1)
GLIBC_CUR=$(ldd -r -v "$1" | sed -n 's/.*(GLIBC_\([0-9.]*\)).*/\1/p' | sort -V | tail -n 1)
## @todo
## perpaps use ldd as well for the remaining 2?
GLIBCXX_CUR=$(nm $1 | sed -n 's/.*GLIBCXX_\([0-9.]*\).*/\1/p' | sort -V | tail -n 1)
CXX_CUR=$(nm $1 | sed -n 's/.*CXXABI_\([0-9.]*\).*/\1/p' | sort -V | tail -n 1)
if [ -n "$GLIBC_CUR" -a "$($SEMVER_CMP $GLIBC_CUR $GLIBC_MAX)" -gt 0 ]; then
GLIBCXX_CUR=$(nm "$1" | sed -n 's/.*GLIBCXX_\([0-9.]*\).*/\1/p' | sort -V | tail -n 1)
CXX_CUR=$(nm "$1" | sed -n 's/.*CXXABI_\([0-9.]*\).*/\1/p' | sort -V | tail -n 1)
cmp=$($SEMVER_CMP "$GLIBC_CUR" "$GLIBC_MAX")
if [ -n "$GLIBC_CUR" ] && [ "$cmp" -gt 0 ]; then
echo "$1: GLIBC $GLIBC_CUR ($GLIBC_MAX required)" 1>&2
exit 1
fi
if [ -n "$GLIBCXX_CUR" -a "$($SEMVER_CMP $GLIBCXX_CUR $GLIBCXX_MAX)" -gt 0 ]; then
cmp=$($SEMVER_CMP "$GLIBCXX_CUR" "$GLIBCXX_MAX")
if [ -n "$GLIBCXX_CUR" ] && [ "$cmp" -gt 0 ]; then
echo "$1: GLIBCXX $GLIBCXX_CUR ($GLIBCXX_MAX required)" 1>&2
exit 1
fi
if [ -n "$CXX_CUR" -a "$($SEMVER_CMP $CXX_CUR $CXX_MAX)" -gt 0 ]; then
cmp=$($SEMVER_CMP "$CXX_CUR" "$CXX_MAX")
if [ -n "$CXX_CUR" ] && [ "$cmp" -gt 0 ]; then
echo "$1: CXX $CXX_CUR ($CXX_MAX required)" 1>&2
exit 1
fi

View File

@@ -5,16 +5,16 @@ install_libvpx() {
git clone --depth 1 https://github.com/webmproject/libvpx.git
cd libvpx
./configure --enable-pic --disable-examples --disable-install-bins --disable-install-srcs --enable-vp9-highbitdepth
make -j $(nproc)
make -j "$(nproc)"
sudo make install
)
}
FFMPEG_GIT_DEPTH=5000 # greater depth is useful for 3-way merges
install_svt() {
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-HEVC && cd SVT-HEVC/Build/linux && ./build.sh release && cd Release && make -j $(nproc) && sudo make install || exit 1 )
( git clone --depth 1 https://gitlab.com/AOMediaCodec/SVT-AV1.git && cd SVT-AV1 && cd Build && cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && make -j $(nproc) && sudo make install || exit 1 )
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-VP9.git && cd SVT-VP9/Build && cmake .. -DCMAKE_BUILD_TYPE=Release && make -j $(nproc) && sudo make install || exit 1 )
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-HEVC && cd SVT-HEVC/Build/linux && ./build.sh release && cd Release && make -j "$(nproc)" && sudo make install || exit 1 )
( git clone --depth 1 https://gitlab.com/AOMediaCodec/SVT-AV1.git && cd SVT-AV1 && cd Build && cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release && make -j "$(nproc)" && sudo make install || exit 1 )
( git clone --depth 1 https://github.com/OpenVisualCloud/SVT-VP9.git && cd SVT-VP9/Build && cmake .. -DCMAKE_BUILD_TYPE=Release && make -j "$(nproc)" && sudo make install || exit 1 )
# if patch apply fails, try increasing $FFMPEG_GIT_DEPTH
git apply -3 SVT-HEVC/ffmpeg_plugin/master-*.patch
git apply -3 SVT-VP9/ffmpeg_plugin/master-*.patch
@@ -29,16 +29,13 @@ install_nv_codec_headers() {
rm -rf /var/tmp/ffmpeg
git clone --depth $FFMPEG_GIT_DEPTH https://git.ffmpeg.org/ffmpeg.git /var/tmp/ffmpeg
cd /var/tmp/ffmpeg
( git clone --depth 1 http://git.videolan.org/git/x264.git && cd x264 && ./configure --disable-static --enable-shared && make -j $(nproc) && sudo make install || exit 1 )
( git clone --depth 1 http://git.videolan.org/git/x264.git && cd x264 && ./configure --disable-static --enable-shared && make -j "$(nproc)" && sudo make install || exit 1 )
( git clone --depth 1 https://aomedia.googlesource.com/aom && mkdir -p aom/build && cd aom/build && cmake -DBUILD_SHARED_LIBS=1 .. && cmake --build . --parallel && sudo cmake --install . || exit 1 )
install_libvpx
install_nv_codec_headers
install_svt
# apply patches
FF_PATCH_DIR=$GITHUB_WORKSPACE/.github/scripts/Linux/ffmpeg-patches
for n in `ls $FF_PATCH_DIR`; do
git apply $FF_PATCH_DIR/$n
done
find "$GITHUB_WORKSPACE/.github/scripts/Linux/ffmpeg-patches" -name '*.patch' -print0 | xargs -0 -n 1 git apply
./configure --disable-static --enable-shared --enable-gpl --enable-libx264 --enable-libx265 --enable-libopus --enable-nonfree --enable-nvenc --enable-libaom --enable-libvpx --enable-libspeex --enable-libmp3lame \
--enable-libdav1d \
--enable-librav1e \
@@ -46,6 +43,6 @@ done
--enable-libsvthevc \
--enable-libsvtvp9 \
make -j $(nproc)
make -j "$(nproc)"
sudo make install
sudo ldconfig