From 6b6a35335c9064fac2ec6684c4f79808dce59b7d Mon Sep 17 00:00:00 2001 From: Sandy Date: Mon, 21 Mar 2022 22:44:39 -0400 Subject: [PATCH] sdl2: Fix Emscripten declaration-after-statement error (#23678) --- ...pten-declaration-after-statement-err.patch | 45 +++++++++++++++++++ ports/sdl2/portfile.cmake | 3 +- ports/sdl2/vcpkg.json | 1 + versions/baseline.json | 2 +- versions/s-/sdl2.json | 5 +++ 5 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 ports/sdl2/0007-timer-Fix-Emscripten-declaration-after-statement-err.patch diff --git a/ports/sdl2/0007-timer-Fix-Emscripten-declaration-after-statement-err.patch b/ports/sdl2/0007-timer-Fix-Emscripten-declaration-after-statement-err.patch new file mode 100644 index 0000000000..39665a9b84 --- /dev/null +++ b/ports/sdl2/0007-timer-Fix-Emscripten-declaration-after-statement-err.patch @@ -0,0 +1,45 @@ +From 99af3281ee11ff947a82c561c2a275627ccea90c Mon Sep 17 00:00:00 2001 +From: Charlie Birks +Date: Sat, 22 Jan 2022 12:27:43 +0000 +Subject: [PATCH] timer: Fix Emscripten declaration-after-statement error + +--- + src/timer/unix/SDL_systimer.c | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c +index 57fdab09c..2cf26764c 100644 +--- a/src/timer/unix/SDL_systimer.c ++++ b/src/timer/unix/SDL_systimer.c +@@ -187,13 +187,6 @@ SDL_GetPerformanceFrequency(void) + void + SDL_Delay(Uint32 ms) + { +-#ifdef __EMSCRIPTEN__ +- if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { +- /* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */ +- emscripten_sleep(ms); +- return; +- } +-#endif + int was_error; + + #if HAVE_NANOSLEEP +@@ -203,6 +196,14 @@ SDL_Delay(Uint32 ms) + Uint64 then, now, elapsed; + #endif + ++#ifdef __EMSCRIPTEN__ ++ if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) { ++ /* pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent */ ++ emscripten_sleep(ms); ++ return; ++ } ++#endif ++ + /* Set the timeout interval */ + #if HAVE_NANOSLEEP + elapsed.tv_sec = ms / 1000; +-- +2.35.1 + diff --git a/ports/sdl2/portfile.cmake b/ports/sdl2/portfile.cmake index fe845aa97a..67c43d4bbb 100644 --- a/ports/sdl2/portfile.cmake +++ b/ports/sdl2/portfile.cmake @@ -12,6 +12,7 @@ vcpkg_from_github( 0004-Define-crt-macros.patch 0005-Fix-uwp-joystick.patch 0006-Update-SDL_sysurl.cpp.patch + 0007-timer-Fix-Emscripten-declaration-after-statement-err.patch ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SDL_STATIC) @@ -98,4 +99,4 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2 " "-lSDL2d ") endif() -vcpkg_fixup_pkgconfig() \ No newline at end of file +vcpkg_fixup_pkgconfig() diff --git a/ports/sdl2/vcpkg.json b/ports/sdl2/vcpkg.json index dc92992c6a..af00428407 100644 --- a/ports/sdl2/vcpkg.json +++ b/ports/sdl2/vcpkg.json @@ -1,6 +1,7 @@ { "name": "sdl2", "version": "2.0.20", + "port-version": 1, "description": "Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.", "homepage": "https://www.libsdl.org/download-2.0.php", "dependencies": [ diff --git a/versions/baseline.json b/versions/baseline.json index 81331cfe02..6b82616f0d 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6334,7 +6334,7 @@ }, "sdl2": { "baseline": "2.0.20", - "port-version": 0 + "port-version": 1 }, "sdl2-gfx": { "baseline": "1.0.4", diff --git a/versions/s-/sdl2.json b/versions/s-/sdl2.json index 93196b43ed..16b746b1f0 100644 --- a/versions/s-/sdl2.json +++ b/versions/s-/sdl2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "9900463f2847ed86e25bac1688c527ae3486a024", + "version": "2.0.20", + "port-version": 1 + }, { "git-tree": "d5865b5fb9c52f255629f4c015f37df9ca788a33", "version": "2.0.20",