Files
UltraGrid/.github/scripts/install-common-deps.sh
Martin Pulec 2eef4963ef CI Linux: current live555 build fix
Version 2024-10-24 expects std::atomic_flag::test(), which is a C++20
feature but can be omitted if NO_STD_LIB is defined. (passing -std=c++2a
won't help because U20.04 libstdc++ doesn't contain that method).
2024-10-30 13:25:20 +01:00

134 lines
3.7 KiB
Bash
Executable File

#!/bin/sh -eux
curdir=$(cd "$(dirname "$0")"; pwd)
readonly curdir
win=no
case "$(uname -s)" in
CYGWIN*|MINGW32*|MSYS*|MINGW*)
win=yes
;;
esac
if ! command -v nproc >/dev/null; then
nproc() { sysctl -n hw.logicalcpu; } # mac
fi
is_arm() {
uname_m=$(uname -m)
expr "$uname_m" : arm > /dev/null || [ "$uname_m" = aarch64 ]
}
is_win() { [ "$win" = yes ]; }
if is_win || [ "$(id -u)" -eq 0 ]; then
alias sudo=
fi
download_install_cineform() {(
git clone --depth 1 https://github.com/gopro/cineform-sdk
cd cineform-sdk
git apply "$curdir/0001-CMakeList.txt-remove-output-lib-name-force-UNIX.patch"
mkdir build && cd build
cmake -DBUILD_TOOLS=OFF ..
cmake --build . --parallel "$(nproc)"
sudo cmake --install .
)}
download_build_aja() {
git clone --depth 1 https://github.com/aja-video/libajantv2.git
export MACOSX_DEPLOYMENT_TARGET=10.13 # needed for arm64 mac
cmake -DAJANTV2_DISABLE_DEMOS=ON -DAJANTV2_DISABLE_DRIVER=ON \
-DAJANTV2_DISABLE_TOOLS=ON -DAJANTV2_DISABLE_TESTS=ON \
-DAJANTV2_DISABLE_PLUGIN_LOAD=ON -DAJANTV2_BUILD_SHARED=ON \
-DCMAKE_BUILD_TYPE=Release -Blibajantv2/build -Slibajantv2
cmake --build libajantv2/build --config Release -j "$(nproc)"
}
install_aja() {(
if [ ! -d libajantv2 ]; then
download_build_aja
fi
if is_win; then
cd libajantv2/build/ajantv2/Release
cp ajantv2*.dll /usr/local/bin/
cp ajantv2*.lib /usr/local/lib/
else
sudo cmake --install libajantv2/build
fi
)}
install_ews() {
sudo mkdir -p /usr/local/include
sudo curl -LS https://raw.githubusercontent.com/hellerf/\
EmbeddableWebServer/master/EmbeddableWebServer.h -o \
/usr/local/include/EmbeddableWebServer.h
}
install_juice() {
(
git clone https://github.com/paullouisageneau/libjuice.git
mkdir libjuice/build
cd libjuice/build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G "Unix Makefiles" ..
make -j "$(nproc)"
sudo make install
)
}
download_build_live555() {(
git clone --depth 1 https://github.com/xanview/live555/
cd live555
if is_win; then
./genMakefiles mingw
PATH=/usr/bin:$PATH
# ensure binutils ld is used (not lld)
pacman -Sy --noconfirm binutils
make -j "$(nproc)" CXX="c++ -DNO_GETIFADDRS -DNO_OPENSSL"
pacman -Rs --noconfirm binutils
elif [ "$(uname -s)" = Linux ]; then
./genMakefiles linux-with-shared-libraries
make -j "$(nproc)" CPLUSPLUS_COMPILER="c++ -DNO_STD_LIB"
else
./genMakefiles macosx-no-openssl
make -j "$(nproc)" CPLUSPLUS_COMPILER="c++ -std=c++11"
fi
)}
install_live555() {(
if [ ! -d live555 ]; then
download_build_live555
fi
sudo make -C live555 install
)}
install_pcp() {
git clone https://github.com/libpcp/pcp.git
(
cd pcp
./autogen.sh || true # autogen exits with 1
CFLAGS=-fPIC ./configure --disable-shared
make -j "$(nproc)"
sudo make install
)
rm -rf pcp
}
install_zfec() {(
git clone --depth 1 https://github.com/tahoe-lafs/zfec zfec
sudo mkdir -p /usr/local/src
sudo mv zfec/zfec /usr/local/src
)}
if ! is_arm && ! is_win; then
download_install_cineform
fi
install_aja
install_ews
install_juice
install_live555
install_pcp
install_zfec