From c679c07301000b781edb0552060c113b10ce11f1 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 30 Oct 2022 12:34:57 +0100 Subject: [PATCH] (Windows) Improved error handling for the dependency build scripts. --- tools/Windows_dependencies_build_MSVC.bat | 16 ++++++- tools/Windows_dependencies_build_MinGW.sh | 20 +++++++++ tools/Windows_dependencies_setup_MSVC.bat | 52 +++++++++++++++++++++++ tools/Windows_dependencies_setup_MinGW.sh | 39 +++++++++++++++++ 4 files changed, 126 insertions(+), 1 deletion(-) diff --git a/tools/Windows_dependencies_build_MSVC.bat b/tools/Windows_dependencies_build_MSVC.bat index 465b56cd0..4a15cc5d7 100644 --- a/tools/Windows_dependencies_build_MSVC.bat +++ b/tools/Windows_dependencies_build_MSVC.bat @@ -28,6 +28,12 @@ cd external echo Building FreeType +if not exist freetype\build\ ( + echo FreeType directory is missing, aborting. + cd .. + goto end +) + cd freetype\build if exist CMakeCache.txt ( nmake clean @@ -43,8 +49,13 @@ cd ..\.. echo: echo Building pugixml -cd pugixml +if not exist pugixml\ ( + echo pugixml directory is missing, aborting. + cd .. + goto end +) +cd pugixml if exist CMakeCache.txt ( nmake clean del CMakeCache.txt @@ -59,4 +70,7 @@ cd.. :: Return to the root of the repository. cd .. +echo: +echo Done building all dependencies. + :end diff --git a/tools/Windows_dependencies_build_MinGW.sh b/tools/Windows_dependencies_build_MinGW.sh index 8fad8bf74..78f0bfb04 100644 --- a/tools/Windows_dependencies_build_MinGW.sh +++ b/tools/Windows_dependencies_build_MinGW.sh @@ -29,6 +29,12 @@ fi echo "Building all dependencies in the ./external directory..." echo -e "\nBuilding GLEW" + +if [ ! -d glew-2.1.0 ]; then + echo "GLEW directory is missing, aborting." + exit +fi + cd glew-2.1.0 make clean make -j${JOBS} 2>/dev/null @@ -37,6 +43,11 @@ cd .. echo -e "\nBuilding FreeType" +if [ ! -d freetype/build ]; then + echo "FreeType directory is missing, aborting." + exit +fi + cd freetype/build rm -f CMakeCache.txt cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .. @@ -47,6 +58,12 @@ cp libfreetype.dll ../../.. cd ../.. echo -e "\nBuilding pugixml" + +if [ ! -d pugixml ]; then + echo "pugixml directory is missing, aborting." + exit +fi + cd pugixml rm -f CMakeCache.txt cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON . @@ -55,3 +72,6 @@ make -j${JOBS} strip libpugixml.dll cp libpugixml.dll ../.. cd .. + +echo +echo "Done building all dependencies." diff --git a/tools/Windows_dependencies_setup_MSVC.bat b/tools/Windows_dependencies_setup_MSVC.bat index 826ce25a1..e05a48c65 100644 --- a/tools/Windows_dependencies_setup_MSVC.bat +++ b/tools/Windows_dependencies_setup_MSVC.bat @@ -41,6 +41,13 @@ if exist curl-7.80.0-win64-mingw\ ( curl -O https://curl.se/windows/dl-7.80.0_2/curl-7.80.0_2-win64-mingw.zip 7z x curl-7.80.0_2-win64-mingw.zip + +if not exist curl-7.80.0-win64-mingw\bin\ ( + echo curl directory is missing, aborting. + cd .. + goto end +) + cd curl-7.80.0-win64-mingw\bin dumpbin /exports libcurl-x64.dll > exports.txt @@ -62,6 +69,13 @@ if exist glew-2.1.0\ ( curl -LO https://downloads.sourceforge.net/project/glew/glew/2.1.0/glew-2.1.0-win32.zip 7z x glew-2.1.0-win32.zip + +if not exist glew-2.1.0\ ( + echo GLEW directory is missing, aborting. + cd .. + goto end +) + copy /Y glew-2.1.0\bin\Release\x64\glew32.dll .. copy /Y glew-2.1.0\lib\Release\x64\glew32.lib .. @@ -73,6 +87,13 @@ if exist freetype\ ( ) git clone https://github.com/freetype/freetype.git + +if not exist freetype\ ( + echo FreeType directory is missing, aborting. + cd .. + goto end +) + cd freetype git checkout VER-2-11-1 mkdir build @@ -87,6 +108,13 @@ if exist FreeImage\ ( curl -LO https://downloads.sourceforge.net/project/freeimage/Binary%%20Distribution/3.18.0/FreeImage3180Win32Win64.zip 7z x FreeImage3180Win32Win64.zip + +if not exist FreeImage\ ( + echo FreeImage directory is missing, aborting. + cd .. + goto end +) + copy /Y FreeImage\Dist\x64\FreeImage.dll .. copy /Y FreeImage\Dist\x64\FreeImage.lib .. @@ -98,6 +126,13 @@ if exist pugixml\ ( ) git clone https://github.com/zeux/pugixml.git + +if not exist pugixml\ ( + echo pugixml directory is missing, aborting. + cd .. + goto end +) + cd pugixml git checkout v1.10 cd .. @@ -112,6 +147,13 @@ if exist SDL2-2.24.0\ ( curl -LO https://libsdl.org/release/SDL2-devel-2.24.0-VC.zip 7z x SDL2-devel-2.24.0-VC.zip + +if not exist SDL2-2.24.0\ ( + echo SDL directory is missing, aborting. + cd .. + goto end +) + cd SDL2-2.24.0 rename include SDL2 cd .. @@ -129,6 +171,13 @@ if exist ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1\ ( :: This package should be available for download for two years. curl -LO https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-09-30-12-41/ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1.zip 7z x ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1.zip + +if not exist ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1\ ( + echo FFmpeg directory is missing, aborting. + cd .. + goto end +) + copy /Y ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1\bin\avcodec-59.dll .. copy /Y ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1\bin\avfilter-8.dll .. copy /Y ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1\bin\avformat-59.dll .. @@ -168,4 +217,7 @@ copy /Y C:\Windows\System32\VCOMP140.DLL copy /Y C:\Windows\System32\VCRUNTIME140.dll copy /Y C:\Windows\System32\VCRUNTIME140_1.dll +echo: +echo Done setting up all dependencies. + :end diff --git a/tools/Windows_dependencies_setup_MinGW.sh b/tools/Windows_dependencies_setup_MinGW.sh index c4ee6139c..f8d2b5989 100644 --- a/tools/Windows_dependencies_setup_MinGW.sh +++ b/tools/Windows_dependencies_setup_MinGW.sh @@ -24,6 +24,12 @@ rm -rf curl-* curl -O https://curl.se/windows/dl-7.80.0_2/curl-7.80.0_2-win64-mingw.zip unzip curl-7.80.0_2-win64-mingw.zip + +if [ ! -d curl-7.80.0-win64-mingw ]; then + echo "curl directory is missing, aborting." + exit +fi + cp -p curl-7.80.0-win64-mingw/bin/libcurl-x64.dll .. echo -e "\nSetting up GLEW" @@ -36,6 +42,12 @@ echo -e "\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-1 mkdir build @@ -46,12 +58,24 @@ rm -rf FreeImage curl -LO https://downloads.sourceforge.net/project/freeimage/Binary%20Distribution/3.18.0/FreeImage3180Win32Win64.zip unzip FreeImage3180Win32Win64.zip + +if [ ! -d FreeImage ]; then + echo "FreeImage directory is missing, aborting." + exit +fi + cp -p FreeImage/Dist/x64/FreeImage.dll .. echo -e "\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 .. @@ -64,6 +88,12 @@ curl -O https://libsdl.org/release/SDL2-devel-2.24.0-mingw.tar.gz tar xvzf SDL2-devel-2.24.0-mingw.tar.gz # Needed due to some kind of file system race condition that sometimes occurs on Windows. sleep 1 + +if [ ! -d SDL2-2.24.0 ]; then + echo "SDL directory is missing, aborting." + exit +fi + mv SDL2-2.24.0/x86_64-w64-mingw32/include/SDL2 SDL2-2.24.0/ cp -p SDL2-2.24.0/x86_64-w64-mingw32/lib/libSDL2main.a .. cp -p SDL2-2.24.0/x86_64-w64-mingw32/bin/SDL2.dll .. @@ -74,6 +104,12 @@ rm -rf ffmpeg-* # This package should be available for download for two years. curl -LO https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-09-30-12-41/ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1.zip unzip ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1.zip + +if [ ! -d ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1 ]; then + echo "FFmpeg directory is missing, aborting." + exit +fi + cp -p ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1/bin/avcodec-59.dll .. cp -p ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1/bin/avfilter-8.dll .. cp -p ffmpeg-n5.1.2-1-g05d6157aab-win64-gpl-shared-5.1/bin/avformat-59.dll .. @@ -99,3 +135,6 @@ cp -p /c/Program\ Files/OpenSSL-Win64/libssl-1_1-x64.dll . echo -e "\nCopying DLL files from Windows\System32" cp /c/Windows/System32/vcomp140.dll . + +echo +echo "Done setting up all dependencies."