From 86772dbf6d7b5475896e9f9c835435eb74ee0b3f Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 30 Oct 2022 13:01:51 +0100 Subject: [PATCH] (macOS) Improved error handling for the dependency build scripts. --- tools/macOS_dependencies_build.sh | 63 ++++++++++++++++++++++++++++++ tools/macOS_dependencies_setup.sh | 65 ++++++++++++++++++++++++++++++- 2 files changed, 127 insertions(+), 1 deletion(-) diff --git a/tools/macOS_dependencies_build.sh b/tools/macOS_dependencies_build.sh index 7cbc3ac76..d75f0b2b0 100755 --- a/tools/macOS_dependencies_build.sh +++ b/tools/macOS_dependencies_build.sh @@ -34,6 +34,12 @@ echo "Building all dependencies in the ./external directory...\n" export PKG_CONFIG_PATH=$(pwd)/../local_install/lib/pkgconfig echo "Building libpng" + +if [ ! -d libpng ]; then + echo "libpng directory is missing, aborting." + exit +fi + cd libpng rm -f CMakeCache.txt if [ $(uname -m) == "arm64" ]; then @@ -47,6 +53,12 @@ make install cd .. echo "\nBuilding FreeType" + +if [ ! -d freetype/build ]; then + echo "FreeType directory is missing, aborting." + exit +fi + cd freetype/build rm -f CMakeCache.txt cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=on -DBUILD_SHARED_LIBS=on -DCMAKE_MACOSX_RPATH=on -DCMAKE_INSTALL_PREFIX=$(pwd)/../../local_install -S .. -B . @@ -56,6 +68,12 @@ cp libfreetype.6.18.0.dylib ../../../libfreetype.6.dylib cd ../.. echo "\nBuilding FreeImage" + +if [ ! -d freeimage/FreeImage ]; then + echo "FreeImage directory is missing, aborting." + exit +fi + cd freeimage/FreeImage make clean make -j${JOBS} @@ -63,6 +81,12 @@ cp libfreeimage.a ../../.. cd ../.. echo "\nBuilding pugixml" + +if [ ! -d pugixml ]; then + echo "pugixml directory is missing, aborting." + exit +fi + cd pugixml rm -f CMakeCache.txt cmake -DCMAKE_BUILD_TYPE=Release . @@ -72,6 +96,12 @@ cp libpugixml.a ../.. cd .. echo "\nBuilding SDL" + +if [ ! -d SDL/build ]; then + echo "SDL directory is missing, aborting." + exit +fi + cd SDL/build rm -f CMakeCache.txt cmake -DCMAKE_BUILD_TYPE=Release -S .. -B . @@ -81,6 +111,12 @@ cp libSDL2-2.0.dylib ../../.. cd ../.. echo "\nBuilding libvpx" + +if [ ! -d libvpx ]; then + echo "libvpx directory is missing, aborting." + exit +fi + cd libvpx ./configure --disable-examples --disable-docs --enable-pic --enable-vp9-highbitdepth --prefix=$(pwd)/../local_install make clean @@ -89,6 +125,12 @@ make install cd .. echo "\nBuilding Ogg" + +if [ ! -d ogg ]; then + echo "Ogg directory is missing, aborting." + exit +fi + cd ogg rm -f CMakeCache.txt cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/../local_install . @@ -98,6 +140,12 @@ make install cd .. echo "\nBuilding Vorbis" + +if [ ! -d vorbis ]; then + echo "Vorbis directory is missing, aborting." + exit +fi + cd vorbis rm -f CMakeCache.txt cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=on -DCMAKE_MACOSX_RPATH=on -DCMAKE_INSTALL_PREFIX=$(pwd)/../local_install . @@ -109,6 +157,12 @@ cp lib/libvorbis.0.4.9.dylib ../.. cd .. echo "\nBuilding Opus" + +if [ ! -d opus ]; then + echo "Opus directory is missing, aborting." + exit +fi + cd opus rm -f CMakeCache.txt cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/../local_install . @@ -118,6 +172,12 @@ make install cd .. echo "\nBuilding FFmpeg" + +if [ ! -d FFmpeg ]; then + echo "FFmpeg directory is missing, aborting." + exit +fi + cd FFmpeg PKG_CONFIG_PATH=$(pwd)/../local_install/lib/pkgconfig ./configure --prefix=/usr/local --enable-rpath --install-name-dir=@rpath --disable-doc --enable-gpl --enable-shared --enable-libvorbis --enable-libopus --enable-libvpx --enable-postproc @@ -139,3 +199,6 @@ install_name_tool -rpath /usr/local/lib @executable_path libswscale/libswscale.6 cp libswscale/libswscale.6.dylib ../.. unset PKG_CONFIG_PATH + +echo +echo "Done building all dependencies." diff --git a/tools/macOS_dependencies_setup.sh b/tools/macOS_dependencies_setup.sh index 3f8f1eb95..05e7b8194 100755 --- a/tools/macOS_dependencies_setup.sh +++ b/tools/macOS_dependencies_setup.sh @@ -22,8 +22,14 @@ rm -rf local_install mkdir local_install echo "Setting up libpng" -rm -rf libpng +rm -rf libpng code git clone https://git.code.sf.net/p/libpng/code.git + +if [ ! -d code ]; then + echo "libpng directory is missing, aborting." + exit +fi + mv code libpng cd libpng git checkout v1.6.37 @@ -32,6 +38,12 @@ cd .. echo "\nSetting up FreeType" rm -rf freetype git clone https://github.com/freetype/freetype.git + +if [ ! -d freetype ]; then + echo "FreeType directory is missing, aborting." + exit +fi + cd freetype git checkout VER-2-11-0 mkdir build @@ -43,6 +55,12 @@ mkdir freeimage cd freeimage curl -LO https://downloads.sourceforge.net/project/freeimage/Source%20Distribution/3.18.0/FreeImage3180.zip unzip FreeImage3180.zip + +if [ ! -d FreeImage ]; then + echo "FreeImage directory is missing, aborting." + exit +fi + cd FreeImage # We need to set the LC_CTYPE variable to C or we won't be able to strip out multi-byte characters using "tr". @@ -149,6 +167,12 @@ cd ../.. echo "\nSetting up pugixml" rm -rf pugixml git clone https://github.com/zeux/pugixml.git + +if [ ! -d pugixml ]; then + echo "pugixml directory is missing, aborting." + exit +fi + cd pugixml git checkout v1.11.4 cd .. @@ -156,6 +180,12 @@ cd .. echo "\nSetting up SDL" rm -rf SDL git clone https://github.com/libsdl-org/SDL.git + +if [ ! -d SDL ]; then + echo "SDL directory is missing, aborting." + exit +fi + cd SDL git checkout release-2.24.0 ln -s include SDL2 @@ -165,6 +195,12 @@ cd .. echo "\nSetting up libvpx" rm -rf libvpx git clone https://github.com/webmproject/libvpx.git + +if [ ! -d libvpx ]; then + echo "libvpx directory is missing, aborting." + exit +fi + cd libvpx git checkout v1.11.0 cd .. @@ -172,6 +208,12 @@ cd .. echo "\nSetting up Ogg" rm -rf ogg git clone https://github.com/xiph/ogg.git + +if [ ! -d ogg ]; then + echo "Ogg directory is missing, aborting." + exit +fi + cd ogg git checkout v1.3.5 cd .. @@ -179,6 +221,12 @@ cd .. echo "\nSetting up Vorbis" rm -rf vorbis git clone https://gitlab.xiph.org/xiph/vorbis.git + +if [ ! -d vorbis ]; then + echo "Vorbis directory is missing, aborting." + exit +fi + cd vorbis git checkout v1.3.7 cd .. @@ -186,6 +234,12 @@ cd .. echo "\nSetting up Opus" rm -rf opus git clone https://gitlab.xiph.org/xiph/opus.git + +if [ ! -d opus ]; then + echo "Opus directory is missing, aborting." + exit +fi + cd opus git checkout v1.3.1 cd .. @@ -193,5 +247,14 @@ cd .. echo "\nSetting up FFmpeg" rm -rf FFmpeg git clone https://github.com/FFmpeg/FFmpeg.git + +if [ ! -d FFmpeg ]; then + echo "FFmpeg directory is missing, aborting." + exit +fi + cd FFmpeg git checkout n5.1.2 + +echo +echo "Done setting up all dependencies."