EasyRPG / packaging

Config files used for different distributions to build EasyRPG packages
7 stars 2 forks source link

debian 9/xUbuntu_16.04 build errors in easyrpg-player (too old SDL2?) #10

Closed carstene1ns closed 4 years ago

carstene1ns commented 4 years ago

has: 2.0.2 (should be ours) needs: 2.0.5

Stretch has 2.0.5 already, but ours is used Xenial has 2.0.4, update needed.

[  241s] src/sdl2_ui.cpp: In function 'uint32_t GetDefaultFormat()':
[  241s] src/sdl2_ui.cpp:63:9: error: 'SDL_PIXELFORMAT_RGBA32' was not declared in this scope
[  241s]   return SDL_PIXELFORMAT_RGBA32;
[  241s]          ^~~~~~~~~~~~~~~~~~~~~~
[  241s] src/sdl2_ui.cpp: In function 'int GetFormatRank(uint32_t)':
[  241s] src/sdl2_ui.cpp:73:8: error: 'SDL_PIXELFORMAT_RGBA32' was not declared in this scope
[  241s]    case SDL_PIXELFORMAT_RGBA32:
[  241s]         ^~~~~~~~~~~~~~~~~~~~~~
[  241s] src/sdl2_ui.cpp:75:8: error: 'SDL_PIXELFORMAT_BGRA32' was not declared in this scope
[  241s]    case SDL_PIXELFORMAT_BGRA32:
[  241s]         ^~~~~~~~~~~~~~~~~~~~~~
[  241s] src/sdl2_ui.cpp:77:8: error: 'SDL_PIXELFORMAT_ARGB32' was not declared in this scope
[  241s]    case SDL_PIXELFORMAT_ARGB32:
[  241s]         ^~~~~~~~~~~~~~~~~~~~~~
[  241s] src/sdl2_ui.cpp:79:8: error: 'SDL_PIXELFORMAT_ABGR32' was not declared in this scope
[  241s]    case SDL_PIXELFORMAT_ABGR32:
[  241s]         ^~~~~~~~~~~~~~~~~~~~~~
[  241s] src/sdl2_ui.cpp: In function 'DynamicFormat GetDynamicFormat(uint32_t)':
[  241s] src/sdl2_ui.cpp:88:8: error: 'SDL_PIXELFORMAT_RGBA32' was not declared in this scope
[  241s]    case SDL_PIXELFORMAT_RGBA32:
[  241s]         ^~~~~~~~~~~~~~~~~~~~~~
[  241s] src/sdl2_ui.cpp:90:8: error: 'SDL_PIXELFORMAT_BGRA32' was not declared in this scope
[  241s]    case SDL_PIXELFORMAT_BGRA32:
[  241s]         ^~~~~~~~~~~~~~~~~~~~~~
[  241s] src/sdl2_ui.cpp:92:8: error: 'SDL_PIXELFORMAT_ARGB32' was not declared in this scope
[  241s]    case SDL_PIXELFORMAT_ARGB32:
[  241s]         ^~~~~~~~~~~~~~~~~~~~~~
[  241s] src/sdl2_ui.cpp:94:8: error: 'SDL_PIXELFORMAT_ABGR32' was not declared in this scope
[  241s]    case SDL_PIXELFORMAT_ABGR32:
[  241s]         ^~~~~~~~~~~~~~~~~~~~~~
[  241s] Makefile:3340: recipe for target 'src/libeasyrpg_player_a-sdl2_ui.o' failed

Might patch this out or upgrade sdl2, if possible.

carstene1ns commented 4 years ago

untested patch:

diff --git a/src/sdl2_ui.cpp b/src/sdl2_ui.cpp
index a2fb09b8..761c57a0 100644
--- a/src/sdl2_ui.cpp
+++ b/src/sdl2_ui.cpp
@@ -59,6 +59,20 @@ AudioInterface& Sdl2Ui::GetAudio() {
 }
 #endif

+#if ! SDL_VERSION_ATLEAST(2,0,5)
+   #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+       #define SDL_PIXELFORMAT_RGBA32 SDL_PIXELFORMAT_RGBA8888
+       #define SDL_PIXELFORMAT_ARGB32 SDL_PIXELFORMAT_ARGB8888
+       #define SDL_PIXELFORMAT_BGRA32 SDL_PIXELFORMAT_BGRA8888
+       #define SDL_PIXELFORMAT_ABGR32 SDL_PIXELFORMAT_ABGR8888
+   #else
+       #define SDL_PIXELFORMAT_RGBA32 SDL_PIXELFORMAT_ABGR8888
+       #define SDL_PIXELFORMAT_ARGB32 SDL_PIXELFORMAT_BGRA8888
+       #define SDL_PIXELFORMAT_BGRA32 SDL_PIXELFORMAT_ARGB8888
+       #define SDL_PIXELFORMAT_ABGR32 SDL_PIXELFORMAT_RGBA8888
+   #endif
+#endif
+
 static uint32_t GetDefaultFormat() {
    return SDL_PIXELFORMAT_RGBA32;
 }