diff --git a/scripts/mingw.sh b/scripts/mingw.sh index 7f28573de..a18b1e54d 100755 --- a/scripts/mingw.sh +++ b/scripts/mingw.sh @@ -20,6 +20,7 @@ FFMPEG=0 OPENH264=0 ARG_SHARED=1 +ARG_STATIC=0 CMAKE_DEFAULT_FLAGS="" ARG_SHARED_MESON="-Ddefault_library=shared" ARG_SHARED_FFMPEG="--disable-static --enable-shared" @@ -45,6 +46,7 @@ for i in "$@"; do ;; -s | --static) ARG_SHARED=0 + ARG_STATIC=1 CMAKE_DEFAULT_FLAGS="-static -static-libgcc -static-libstdc++" ARG_SHARED_MESON="-Ddefault_library=static" ARG_SHARED_FFMPEG="" @@ -87,6 +89,37 @@ function do_clone { fi } +function do_download { + url=$1 + file=$2 + hash=$3 + dir=$4 + + if [ ! -f $file ]; then + if command -v curl 2>&1 >/dev/null + then + curl -o $file $url/$file + elif command -v wget 2>&1 >/dev/null + then + wget -O $file $url/$file + else + echo "Could not find wget or curl, exiting" + exit 1 + fi + fi + + if [ ! -f $file.sha256sum ]; then + echo "$hash $file" > $file.sha256sum + fi + + sha256sum -c $file.sha256sum + if [ -d $dir ]; then + rm -rf $dir + fi + mkdir $dir + tar xf $file --strip-components=1 -C $dir +} + function do_cmake_build { cmake \ -GNinja \ @@ -109,22 +142,20 @@ cd "$SRC_BASE" if [ $CLONE -ne 0 ]; then do_clone v1.3.1 https://github.com/madler/zlib.git zlib do_clone uriparser-0.9.8 https://github.com/uriparser/uriparser.git uriparser - do_clone v1.7.18 https://github.com/DaveGamble/cJSON.git cJSON - do_clone release-3.2.4 https://github.com/libsdl-org/SDL.git SDL + do_clone json-c-0.18-20240915 https://github.com/json-c/json-c.git json-c + do_clone release-3.2.10 https://github.com/libsdl-org/SDL.git SDL if [ $FFMPEG -ne 0 ]; then - do_clone n7.1 https://github.com/FFmpeg/FFmpeg.git FFmpeg + do_clone n7.1.1 https://github.com/FFmpeg/FFmpeg.git FFmpeg fi if [ $OPENH264 -ne 0 ]; then do_clone v2.6.0 https://github.com/cisco/openh264.git openh264 fi - do_clone v1.0.27-1 https://github.com/libusb/libusb-cmake.git libusb-cmake - do_clone release-3.2.0 https://github.com/libsdl-org/SDL_image.git SDL_image - do_clone prerelease-3.1.2 https://github.com/libsdl-org/SDL_ttf.git SDL_ttf - do_clone v3.9.2 https://github.com/libressl/portable.git libressl - ( - cd libressl - ./update.sh - ) + do_clone v1.0.28-0 https://github.com/libusb/libusb-cmake.git libusb-cmake + do_clone release-3.2.4 https://github.com/libsdl-org/SDL_image.git SDL_image + do_clone release-3.2.2 https://github.com/libsdl-org/SDL_ttf.git SDL_ttf + do_clone v2.0.3 https://github.com/mstorsjo/fdk-aac.git fdk-aac + do_clone v1.5.2 https://gitlab.xiph.org/xiph/opus.git opus + do_download https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ libressl-4.0.0.tar.gz 4d841955f0acc3dfc71d0e3dd35f283af461222350e26843fea9731c0246a1e4 libressl fi if [ $BUILD -eq 0 ]; then @@ -151,13 +182,12 @@ if [ $DEPS -ne 0 ]; then -DURIPARSER_BUILD_TESTS=OFF do_cmake_build \ - "$BUILD_BASE/cJSON" \ - -S cJSON \ - -DENABLE_CJSON_TEST=OFF \ - -DENABLE_CUSTOM_COMPILER_FLAGS=OFF \ - -DENABLE_HIDDEN_SYMBOLS=ON \ - -DBUILD_SHARED_AND_STATIC_LIBS=OFF \ - -DCJSON_BUILD_SHARED_LIBS=$ARG_SHARED + "$BUILD_BASE/json-c" \ + -S json-c \ + -DBUILD_APPS=OFF \ + -DBUILD_TESTING=OFF \ + -DBUILD_SHARED_LIBS=$ARG_SHARED \ + -DBUILD_STATIC_LIBS=$ARG_STATIC do_cmake_build \ "$BUILD_BASE/SDL" \ @@ -180,7 +210,7 @@ if [ $DEPS -ne 0 ]; then "$BUILD_BASE/SDL_image" \ -S SDL_image \ -DSDLIMAGE_SAMPLES=OFF \ - -DSDLIMAGE_DEPS_SHARED=OFF + -DSDLIMAGE_DEPS_SHARED=$ARG_SHARED do_cmake_build \ "$BUILD_BASE/libusb-cmake" \ @@ -189,6 +219,16 @@ if [ $DEPS -ne 0 ]; then -DLIBUSB_BUILD_TESTING=OFF \ -DLIBUSB_ENABLE_DEBUG_LOGGING=OFF + do_cmake_build \ + "$BUILD_BASE/fdk-aac" \ + -S fdk-aac \ + -DBUILD_PROGRAMS=OFF + + do_cmake_build \ + "$BUILD_BASE/opus" \ + -S opus \ + -DOPUS_BUILD_SHARED_LIBRARY=$ARG_SHARED + # TODO: This takes ages to compile, disable if [ $FFMPEG -ne 0 ]; then ( @@ -245,4 +285,7 @@ do_cmake_build \ -DWITH_OPENH264=$OPENH264 \ -DWITH_WEBVIEW=OFF \ -DWITH_LIBRESSL=ON \ + -DWITH_OPUS=ON \ + -DWITH_JSONC_REQUIRED=ON \ + -DWITH_FDK_AAC=ON \ -DWITH_MANPAGES=OFF