diff --git a/tools/Windows_dependencies_build_MSVC.bat b/tools/Windows_dependencies_build_MSVC.bat index 211e35346..6fe8179d6 100644 --- a/tools/Windows_dependencies_build_MSVC.bat +++ b/tools/Windows_dependencies_build_MSVC.bat @@ -4,7 +4,7 @@ :: Windows_dependencies_build_MSVC.bat :: :: Builds the external dependencies in-tree using MSVC. -:: The Windows_dependencies_setup_MSVC.bat script must have been executed before this one. +:: The Windows_dependencies_setup_MSVC.bat script must have been executed prior to this. :: All libraries will be recompiled from scratch every time. :: :: This script needs to run from the root of the repository. diff --git a/tools/Windows_dependencies_build_MinGW.sh b/tools/Windows_dependencies_build_MinGW.sh new file mode 100644 index 000000000..6b1edf1ef --- /dev/null +++ b/tools/Windows_dependencies_build_MinGW.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# +# EmulationStation Desktop Edition +# Windows_dependencies_build_MinGW.sh +# +# Builds the external dependencies in-tree. +# The Windows_dependencies_setup_MinGW.sh script must have been executed prior to this. +# All libraries will be recompiled from scratch every time. +# +# This script needs to run from the root of the repository. +# + +# How many CPU threads to use for the compilation. +JOBS=4 + +if [ ! -f .clang-format ]; then + echo "You need to run this script from the root of the repository." + exit +fi + +cd external + +if [ ! -d pugixml ]; then + echo "You need to first run tools/Windows_dependencies_setup_MinGW.sh to download and configure the dependencies." + exit +fi + +echo "Building all dependencies in the ./external directory..." + +echo -e "\nBuilding GLEW" +cd glew-2.1.0 +make clean +make -j${JOBS} 2>/dev/null +cp lib/glew32.dll ../.. +cd .. + +echo -e "\nBuilding FreeType" + +cd freetype/build +rm -f CMakeCache.txt +cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=ON .. +make clean +make -j${JOBS} +cp libfreetype.dll ../../.. +cd ../.. + +echo -e "\nBuilding pugixml" +cd pugixml +rm -f CMakeCache.txt +cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=ON . +make clean +make -j${JOBS} +cp libpugixml.dll ../.. +cd .. diff --git a/tools/Windows_dependencies_setup_MSVC.bat b/tools/Windows_dependencies_setup_MSVC.bat index fe20a06d6..3e2b5e9e5 100644 --- a/tools/Windows_dependencies_setup_MSVC.bat +++ b/tools/Windows_dependencies_setup_MSVC.bat @@ -145,9 +145,9 @@ echo: echo Setting up OpenSSL if not exist "C:\Program Files\OpenSSL-Win64\libcrypto-1_1-x64.dll" ( - curl -O https://slproweb.com/download/Win64OpenSSL_Light-1_1_1m.msi + curl -O https://slproweb.com/download/Win64OpenSSL_Light-1_1_1m.exe :: Run the installer. - .\Win64OpenSSL_Light-1_1_1m.msi + .\Win64OpenSSL_Light-1_1_1m.exe ) :: Return to the root of the repository. diff --git a/tools/Windows_dependencies_setup_MinGW.sh b/tools/Windows_dependencies_setup_MinGW.sh new file mode 100644 index 000000000..a5747813a --- /dev/null +++ b/tools/Windows_dependencies_setup_MinGW.sh @@ -0,0 +1,97 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# +# EmulationStation Desktop Edition +# Windows_dependencies_setup_MinGW.sh +# +# Downloads and prepares the external dependencies for building in-tree. +# If the directories already exist they will be removed and the libraries will be downloaded again. +# +# This script needs to run from the root of the repository. +# + +if [ ! -f .clang-format ]; then + echo "You need to run this script from the root of the repository." + exit +fi + +echo -e "Setting up dependencies in the ./external directory..." + +cd external + +echo -e "\nSetting up cURL" +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 +cp -p curl-7.80.0-win64-mingw/bin/libcurl-x64.dll .. + +echo -e "\nSetting up GLEW" +rm -rf glew-* + +curl -LO https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.zip +unzip glew-2.1.0.zip + +echo -e "\nSetting up FreeType" +rm -rf freetype + +git clone https://github.com/freetype/freetype.git +cd freetype +git checkout VER-2-11-0 +mkdir build +cd .. + +echo -e "\nSetting up FreeImage" +rm -rf FreeImage + +curl -LO https://downloads.sourceforge.net/project/freeimage/Binary%20Distribution/3.18.0/FreeImage3180Win32Win64.zip +7z x FreeImage3180Win32Win64.zip +cp -p FreeImage/Dist/x64/FreeImage.dll .. + +echo -e "\nSetting up pugixml" +rm -rf pugixml + +git clone git://github.com/zeux/pugixml.git +cd pugixml +git checkout v1.11.4 +cd .. + +echo -e "\nSetting up SDL" +rm -rf SDL2-* + +curl -O https://www.libsdl.org/release/SDL2-devel-2.0.18-mingw.tar.gz +tar xvzf SDL2-devel-2.0.18-mingw.tar.gz +mv SDL2-2.0.18/x86_64-w64-mingw32/include/SDL2 SDL2-2.0.18/ +cp -p SDL2-2.0.18/x86_64-w64-mingw32/lib/libSDL2main.a .. +cp -p SDL2-2.0.18/x86_64-w64-mingw32/bin/SDL2.dll .. + +echo -e "\nSetting up FFmpeg" +rm -rf ffmpeg-* + +curl -LO https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n4.4-latest-win64-gpl-shared-4.4.zip +unzip ffmpeg-n4.4-latest-win64-gpl-shared-4.4.zip +cp -p ffmpeg-n4.4-latest-win64-gpl-shared-4.4/bin/avcodec-58.dll .. +cp -p ffmpeg-n4.4-latest-win64-gpl-shared-4.4/bin/avfilter-7.dll .. +cp -p ffmpeg-n4.4-latest-win64-gpl-shared-4.4/bin/avformat-58.dll .. +cp -p ffmpeg-n4.4-latest-win64-gpl-shared-4.4/bin/avutil-56.dll .. +cp -p ffmpeg-n4.4-latest-win64-gpl-shared-4.4/bin/postproc-55.dll .. +cp -p ffmpeg-n4.4-latest-win64-gpl-shared-4.4/bin/swresample-3.dll .. +cp -p ffmpeg-n4.4-latest-win64-gpl-shared-4.4/bin/swscale-5.dll .. + +echo -e "\nSetting up OpenSSL" + +if [ ! -f /c/Program\ Files/OpenSSL-Win64/libcrypto-1_1-x64.dll ]; then + curl -O https://slproweb.com/download/Win64OpenSSL_Light-1_1_1m.exe + # Run the installer. + ./Win64OpenSSL_Light-1_1_1m.exe +fi + +# Return to the root of the repository. +cd .. + +cp -p /c/Program\ Files/OpenSSL-Win64/libcrypto-1_1-x64.dll . +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 .