From 86a2f0bf55ed0902988f81f4441315bb91beade6 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Wed, 18 Oct 2023 22:18:09 +1000 Subject: [PATCH] autobuild SDL2 for Windows --- misc/buildsrc/dlls.sh | 20 ++++++++++++++++++++ misc/tools/all/release.subr | 8 +++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/misc/buildsrc/dlls.sh b/misc/buildsrc/dlls.sh index 697cd253..1a46c419 100755 --- a/misc/buildsrc/dlls.sh +++ b/misc/buildsrc/dlls.sh @@ -261,6 +261,22 @@ build_curl () { make install } +build_libsdl2 () +{ + fetch_source libsdl2 || true + + # this subdir will be made available to DP's linker + mkdir -p "$pkg_dir/sdl" + + mkcd "$work_dir/libsdl2" + cmake -DCMAKE_TOOLCHAIN_FILE="$toolchain_file" \ + -DCMAKE_SYSTEM_PROCESSOR="$ARCH" \ + -DCMAKE_INSTALL_PREFIX="$pkg_dir/sdl" \ + -G"Unix Makefiles" "$this_src" + make + make install +} + build_all () { build_zlib build_gmp @@ -272,6 +288,7 @@ build_all () { build_libpng16 build_libjpeg build_curl + build_libsdl2 } install () { @@ -290,6 +307,7 @@ install () { cp -v "$pkg_dir/bin/libpng16.dll" "$out_dir" cp -v "$pkg_dir/bin/libjpeg-62.dll" "$out_dir/libjpeg.dll" cp -v "$pkg_dir/bin/libcurl.dll" "$out_dir/libcurl-4.dll" +# cp -v "$pkg_dir/sdl/bin/SDL2.dll" "$out_dir" # Required for win32 builds if [ "$ARCH" = "i686" ]; then @@ -320,6 +338,7 @@ list () { echo libpng16 echo libjpeg echo curl + echo libsdl2 } usage () { @@ -358,6 +377,7 @@ case $step in libpng16) prepare && build_libpng16 ;; libjpeg) prepare && build_libjpeg ;; curl) prepare && build_curl ;; + libsdl2) prepare && build_libsdl2 ;; build_all) prepare && build_all ;; install) prepare && install ;; all) prepare && build_all && install ;; diff --git a/misc/tools/all/release.subr b/misc/tools/all/release.subr index 4b85e2eb..4d7f78c9 100644 --- a/misc/tools/all/release.subr +++ b/misc/tools/all/release.subr @@ -282,13 +282,15 @@ case "$cmd" in arch=$1 buildpath=$2 targetdir=$3 - mkdir -p "$targetdir" + verbose mkdir -p "$targetdir" ( cd "misc/buildsrc" verbose ./dlls.sh clean "$buildpath" verbose ./dlls.sh all "$buildpath" "$arch" ) verbose cp -v $buildpath/out/$arch/* "$targetdir" + verbose mkdir -p "$d0/misc/builddeps/$arch/" + verbose rsync --delete -avP "$buildpath/pkg/$arch/sdl" "$d0/misc/builddeps/$arch/" ;; release-dlls-win32) release_common @@ -311,7 +313,7 @@ case "$cmd" in #verbose "$SELF" release-getbinary Xonotic/xonotic-x86-dedicated.exe || good=false #$good verbose "$SELF" release-compile win32 \ - 'DP_MAKE_TARGET=mingw WIN32RELEASE=1 CC="i686-w64-mingw32-gcc -static -flto=auto -mstackrealign -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib" WINDRES="i686-w64-mingw32-windres" SDL_CONFIG="../../../.deps/bin/sdl2-config" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=dlopen' \ + 'DP_MAKE_TARGET=mingw WIN32RELEASE=1 CC="i686-w64-mingw32-gcc -static -flto=auto -mstackrealign -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib" WINDRES="i686-w64-mingw32-windres" DP_LINK_SDL=static SDL_CONFIG="../../../.deps/bin/sdl2-config" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=dlopen' \ release 'darkplaces-sdl.exe:Xonotic/xonotic-x86.exe darkplaces-dedicated.exe:Xonotic/xonotic-x86-dedicated.exe' ;; release-engine-win64) @@ -321,7 +323,7 @@ case "$cmd" in #verbose "$SELF" release-getbinary Xonotic/xonotic-dedicated.exe || good=false #$good verbose "$SELF" release-compile win64 \ - 'DP_MAKE_TARGET=mingw WIN64RELEASE=1 CC="x86_64-w64-mingw32-gcc -static -flto=auto -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib" WINDRES="x86_64-w64-mingw32-windres" SDL_CONFIG="../../../.deps/bin/sdl2-config" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=dlopen' \ + 'DP_MAKE_TARGET=mingw WIN64RELEASE=1 CC="x86_64-w64-mingw32-gcc -static -flto=auto -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib" WINDRES="x86_64-w64-mingw32-windres" DP_LINK_SDL=static SDL_CONFIG="../../../.deps/bin/sdl2-config" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=dlopen' \ release 'darkplaces-sdl.exe:Xonotic/xonotic.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe' ;; release-engine-osx) -- 2.39.2