diff --git a/ports/SDL2/build.sh b/ports/SDL2/build.sh deleted file mode 100755 index c00062da..00000000 --- a/ports/SDL2/build.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash ../install.sh - -NAME='SDL2' -VERSION='2.32.8' -DOWNLOAD_URL="https://github.com/libsdl-org/SDL/releases/download/release-$VERSION/SDL2-$VERSION.tar.gz#0ca83e9c9b31e18288c7ec811108e58bac1f1bb5ec6577ad386830eac51c787e" -DEPENDENCIES=('mesa' 'libiconv') - -configure() { - cmake --fresh -S . -B build -G Ninja \ - --toolchain="$BANAN_TOOLCHAIN_DIR/Toolchain.txt" \ - -DCMAKE_INSTALL_PREFIX='/usr' \ - -DCMAKE_BUILD_TYPE=Release \ - -DSDL_LIBSAMPLERATE=OFF \ - -DSDL_STATIC=OFF \ - || exit 1 -} - -build() { - cmake --build build || exit 1 -} - -install() { - DESTDIR="$DESTDIR" cmake --install build || exit 1 -} diff --git a/ports/SDL2/patches/0001-add-banan_os-support.patch b/ports/SDL2/patches/0001-add-banan_os-support.patch deleted file mode 100644 index a9947d4b..00000000 --- a/ports/SDL2/patches/0001-add-banan_os-support.patch +++ /dev/null @@ -1,1668 +0,0 @@ -diff -ruN SDL2-2.32.8/cmake/sdlplatform.cmake SDL2-2.32.8-banan_os/cmake/sdlplatform.cmake ---- SDL2-2.32.8/cmake/sdlplatform.cmake 2024-08-14 13:35:43.000000000 +0300 -+++ SDL2-2.32.8-banan_os/cmake/sdlplatform.cmake 2026-04-03 04:34:27.256800208 +0300 -@@ -28,6 +28,8 @@ - set(SDL_CMAKE_PLATFORM AIX) - elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*") - set(SDL_CMAKE_PLATFORM MINIX) -+ elseif(CMAKE_SYSTEM_NAME MATCHES "banan-os") -+ set(SDL_CMAKE_PLATFORM BANAN_OS) - elseif(CMAKE_SYSTEM_NAME MATCHES "QNX") - set(SDL_CMAKE_PLATFORM QNX) - endif() -diff -ruN SDL2-2.32.8/CMakeLists.txt SDL2-2.32.8-banan_os/CMakeLists.txt ---- SDL2-2.32.8/CMakeLists.txt 2025-06-03 02:00:39.000000000 +0300 -+++ SDL2-2.32.8-banan_os/CMakeLists.txt 2026-04-03 04:34:27.257159543 +0300 -@@ -14,7 +14,7 @@ - set(SDL2_SUBPROJECT ON) - endif() - --if (HAIKU) -+if (HAIKU OR BANAN_OS) - enable_language(CXX) - set(LINKER_LANGUAGE CXX) - endif() -@@ -1462,7 +1462,7 @@ - CheckPTHREAD() - CheckLibUnwind() - --elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) -+elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU AND NOT BANAN_OS) - if(SDL_AUDIO) - if(SYSV5 OR SOLARIS OR HPUX) - set(SDL_AUDIO_DRIVER_SUNAUDIO 1) -@@ -2459,6 +2459,64 @@ - CheckPTHREAD() - list(APPEND EXTRA_LIBS root be media game device textencoding) - -+elseif(BANAN_OS) -+ if(SDL_MISC) -+ file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/banan_os/*.cpp) -+ list(APPEND SOURCE_FILES ${MISC_SOURCES}) -+ set(HAVE_SDL_MISC TRUE) -+ endif() -+ -+ if(SDL_AUDIO) -+ set(SDL_AUDIO_DRIVER_BANANOS 1) -+ file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/banan_os/*.cpp) -+ list(APPEND SOURCE_FILES ${AUDIO_SOURCES}) -+ set(HAVE_SDL_AUDIO TRUE) -+ list(APPEND EXTRA_LIBS audio) -+ endif() -+ -+ if(SDL_JOYSTICK) -+ set(SDL_JOYSTICK_BANANOS 1) -+ file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/banan_os/*.cpp) -+ list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) -+ set(HAVE_SDL_JOYSTICK TRUE) -+ endif() -+ -+ if(SDL_VIDEO) -+ set(SDL_VIDEO_DRIVER_BANANOS 1) -+ file(GLOB VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/banan_os/*.cpp) -+ list(APPEND SOURCE_FILES ${VIDEO_SOURCES}) -+ set(HAVE_SDL_VIDEO TRUE) -+ list(APPEND EXTRA_LIBS gui input clipboard) -+ -+ if(SDL_OPENGL) -+ set(SDL_VIDEO_OPENGL 1) -+ set(SDL_VIDEO_OPENGL_BANANOS 1) -+ set(SDL_VIDEO_RENDER_OGL 1) -+ list(APPEND EXTRA_LIBS OSMesa) -+ set(HAVE_OPENGL TRUE) -+ endif() -+ endif() -+ -+ if(SDL_FILESYSTEM) -+ set(SDL_FILESYSTEM_UNIX 1) -+ file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c) -+ list(APPEND SOURCE_FILES ${FILESYSTEM_SOURCES}) -+ set(HAVE_SDL_FILESYSTEM TRUE) -+ endif() -+ -+ if(SDL_TIMERS) -+ set(SDL_TIMER_UNIX 1) -+ file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) -+ list(APPEND SOURCE_FILES ${TIMER_SOURCES}) -+ set(HAVE_SDL_TIMERS TRUE) -+ -+ if(SDL_CLOCK_GETTIME) -+ set(HAVE_CLOCK_GETTIME 1) -+ endif() -+ endif() -+ -+ CheckPTHREAD() -+ - elseif(RISCOS) - if(SDL_MISC) - file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/riscos/*.c) -diff -ruN SDL2-2.32.8/include/SDL_config.h.cmake SDL2-2.32.8-banan_os/include/SDL_config.h.cmake ---- SDL2-2.32.8/include/SDL_config.h.cmake 2025-01-01 17:47:53.000000000 +0200 -+++ SDL2-2.32.8-banan_os/include/SDL_config.h.cmake 2026-04-03 04:34:27.257563019 +0300 -@@ -307,6 +307,7 @@ - #cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ - #cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ - #cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ -+#cmakedefine SDL_AUDIO_DRIVER_BANANOS @SDL_AUDIO_DRIVER_BANANOS@ - #cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ - #cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ - #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ -@@ -337,6 +338,7 @@ - #cmakedefine SDL_INPUT_WSCONS @SDL_INPUT_WSCONS@ - #cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@ - #cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ -+#cmakedefine SDL_JOYSTICK_BANANOS @SDL_JOYSTICK_BANANOS@ - #cmakedefine SDL_JOYSTICK_WGI @SDL_JOYSTICK_WGI@ - #cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@ - #cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@ -@@ -406,6 +408,7 @@ - #cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@ - #cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@ - #cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@ -+#cmakedefine SDL_VIDEO_DRIVER_BANANOS @SDL_VIDEO_DRIVER_BANANOS@ - #cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@ - #cmakedefine SDL_VIDEO_DRIVER_UIKIT @SDL_VIDEO_DRIVER_UIKIT@ - #cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@ -diff -ruN SDL2-2.32.8/include/SDL_platform.h SDL2-2.32.8-banan_os/include/SDL_platform.h ---- SDL2-2.32.8/include/SDL_platform.h 2025-01-01 17:47:53.000000000 +0200 -+++ SDL2-2.32.8-banan_os/include/SDL_platform.h 2026-04-03 04:34:27.257711782 +0300 -@@ -36,6 +36,10 @@ - #undef __HAIKU__ - #define __HAIKU__ 1 - #endif -+#if defined(__banan_os__) -+#undef __banan_os__ -+#define __banan_os__ 1 -+#endif - #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) - #undef __BSDI__ - #define __BSDI__ 1 -diff -ruN SDL2-2.32.8/src/audio/banan_os/SDL_banan_os_audio.cpp SDL2-2.32.8-banan_os/src/audio/banan_os/SDL_banan_os_audio.cpp ---- SDL2-2.32.8/src/audio/banan_os/SDL_banan_os_audio.cpp 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/audio/banan_os/SDL_banan_os_audio.cpp 2026-04-03 16:06:27.541819001 +0300 -@@ -0,0 +1,134 @@ -+/* -+ Simple DirectMedia Layer -+ Copyright (C) 1997-2019 Sam Lantinga -+ -+ This software is provided 'as-is', without any express or implied -+ warranty. In no event will the authors be held liable for any damages -+ arising from the use of this software. -+ -+ Permission is granted to anyone to use this software for any purpose, -+ including commercial applications, and to alter it and redistribute it -+ freely, subject to the following restrictions: -+ -+ 1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+ 2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+ 3. This notice may not be removed or altered from any source distribution. -+*/ -+#include "../../SDL_internal.h" -+ -+#if SDL_AUDIO_DRIVER_BANANOS -+ -+extern "C" { -+#include "SDL_audio.h" -+#include "../SDL_audio_c.h" -+#include "../SDL_sysaudio.h" -+} -+ -+#include "SDL_banan_os_audio.h" -+ -+#include -+ -+#define DUMP_FUNCTIONS 0 -+ -+#if DUMP_FUNCTIONS -+# define DUMP_FUNCTION() dprintln(__FUNCTION__) -+#else -+# define DUMP_FUNCTION() -+#endif -+ -+static void BANANOS_CloseDevice(_THIS) -+{ -+ DUMP_FUNCTION(); -+ -+ if (!_this->hidden) -+ return; -+ -+ if (_this->hidden->mixbuf) -+ SDL_free(_this->hidden->mixbuf); -+ -+ delete _this->hidden; -+} -+ -+static int BANANOS_OpenDevice(_THIS, char const*) -+{ -+ DUMP_FUNCTION(); -+ -+ // TODO: try to accept already existing spec -+ _this->spec.freq = 48000; -+ _this->spec.format = AUDIO_F32LSB; -+ _this->spec.channels = 2; -+ _this->spec.samples = 2048; -+ SDL_CalculateAudioSpec(&_this->spec); -+ -+ auto audio_or_error = LibAudio::Audio::create(_this->spec.channels, _this->spec.freq, 0x1000); -+ if (audio_or_error.is_error()) -+ return SDL_SetError("failed to create audio device: %s", audio_or_error.error().get_message()); -+ -+ void* mixbuf = SDL_malloc(_this->spec.size); -+ if (mixbuf == nullptr) -+ return SDL_OutOfMemory(); -+ -+ _this->hidden = new SDL_PrivateAudioData(audio_or_error.release_value(), mixbuf); -+ if (!_this->hidden) -+ return SDL_OutOfMemory(); -+ MUST(_this->hidden->audio.start()); -+ -+ return 0; -+} -+ -+static void BANANOS_PlayDevice(_THIS) -+{ -+ DUMP_FUNCTION(); -+ -+ const bool should_play = SDL_AtomicGet(&_this->enabled) && !SDL_AtomicGet(&_this->paused); -+ _this->hidden->audio.set_paused(!should_play); -+ if (!should_play) -+ { -+ usleep(100); -+ return; -+ } -+ -+ auto sample_span = BAN::Span( -+ static_cast(_this->hidden->mixbuf), -+ _this->spec.size / sizeof(float) -+ ); -+ while (!sample_span.empty()) -+ { -+ const size_t queued = _this->hidden->audio.queue_samples(sample_span); -+ if (queued == 0) -+ usleep(100); -+ sample_span = sample_span.slice(queued); -+ } -+} -+ -+static Uint8* BANANOS_GetDeviceBuf(_THIS) -+{ -+ DUMP_FUNCTION(); -+ -+ return static_cast(_this->hidden->mixbuf); -+} -+ -+static SDL_bool BANANOS_Init(SDL_AudioDriverImpl* impl) -+{ -+ impl->OpenDevice = BANANOS_OpenDevice; -+ impl->CloseDevice = BANANOS_CloseDevice; -+ impl->PlayDevice = BANANOS_PlayDevice; -+ impl->GetDeviceBuf = BANANOS_GetDeviceBuf; -+ -+ impl->ProvidesOwnCallbackThread = SDL_FALSE; -+ impl->HasCaptureSupport = SDL_FALSE; -+ impl->OnlyHasDefaultOutputDevice = SDL_TRUE; -+ impl->SupportsNonPow2Samples = SDL_TRUE; -+ -+ return SDL_TRUE; -+} -+ -+AudioBootStrap BANANOSAUDIO_bootstrap = { -+ "banan-os", "banan-os AudioServer", BANANOS_Init, SDL_FALSE -+}; -+ -+#endif -diff -ruN SDL2-2.32.8/src/audio/banan_os/SDL_banan_os_audio.h SDL2-2.32.8-banan_os/src/audio/banan_os/SDL_banan_os_audio.h ---- SDL2-2.32.8/src/audio/banan_os/SDL_banan_os_audio.h 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/audio/banan_os/SDL_banan_os_audio.h 2026-04-03 15:56:58.603415021 +0300 -@@ -0,0 +1,33 @@ -+/* -+ Simple DirectMedia Layer -+ Copyright (C) 1997-2019 Sam Lantinga -+ -+ This software is provided 'as-is', without any express or implied -+ warranty. In no event will the authors be held liable for any damages -+ arising from the use of this software. -+ -+ Permission is granted to anyone to use this software for any purpose, -+ including commercial applications, and to alter it and redistribute it -+ freely, subject to the following restrictions: -+ -+ 1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+ 2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+ 3. This notice may not be removed or altered from any source distribution. -+*/ -+#include "../../SDL_internal.h" -+ -+#pragma once -+ -+#include -+#include -+ -+#define _THIS SDL_AudioDevice* _this -+ -+struct SDL_PrivateAudioData { -+ LibAudio::Audio audio; -+ void* mixbuf { nullptr }; -+}; -diff -ruN SDL2-2.32.8/src/audio/SDL_audio.c SDL2-2.32.8-banan_os/src/audio/SDL_audio.c ---- SDL2-2.32.8/src/audio/SDL_audio.c 2025-01-01 17:47:53.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/audio/SDL_audio.c 2026-04-03 04:34:27.258080476 +0300 -@@ -87,6 +87,9 @@ - #ifdef SDL_AUDIO_DRIVER_HAIKU - &HAIKUAUDIO_bootstrap, - #endif -+#ifdef SDL_AUDIO_DRIVER_BANANOS -+ &BANANOSAUDIO_bootstrap, -+#endif - #ifdef SDL_AUDIO_DRIVER_COREAUDIO - &COREAUDIO_bootstrap, - #endif -diff -ruN SDL2-2.32.8/src/audio/SDL_sysaudio.h SDL2-2.32.8-banan_os/src/audio/SDL_sysaudio.h ---- SDL2-2.32.8/src/audio/SDL_sysaudio.h 2025-01-01 17:47:53.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/audio/SDL_sysaudio.h 2026-04-03 04:34:27.258278128 +0300 -@@ -196,6 +196,7 @@ - extern AudioBootStrap WINMM_bootstrap; - extern AudioBootStrap PAUDIO_bootstrap; - extern AudioBootStrap HAIKUAUDIO_bootstrap; -+extern AudioBootStrap BANANOSAUDIO_bootstrap; - extern AudioBootStrap COREAUDIO_bootstrap; - extern AudioBootStrap DISKAUDIO_bootstrap; - extern AudioBootStrap DUMMYAUDIO_bootstrap; -diff -ruN SDL2-2.32.8/src/joystick/banan_os/SDL_banan_os_joystick.cpp SDL2-2.32.8-banan_os/src/joystick/banan_os/SDL_banan_os_joystick.cpp ---- SDL2-2.32.8/src/joystick/banan_os/SDL_banan_os_joystick.cpp 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/joystick/banan_os/SDL_banan_os_joystick.cpp 2026-04-03 04:34:27.258447075 +0300 -@@ -0,0 +1,296 @@ -+/* -+Simple DirectMedia Layer -+Copyright (C) 1997-2025 Sam Lantinga -+ -+This software is provided 'as-is', without any express or implied -+warranty. In no event will the authors be held liable for any damages -+arising from the use of this software. -+ -+Permission is granted to anyone to use this software for any purpose, -+including commercial applications, and to alter it and redistribute it -+freely, subject to the following restrictions: -+ -+1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+3. This notice may not be removed or altered from any source distribution. -+*/ -+#include "../../SDL_internal.h" -+ -+#ifdef SDL_JOYSTICK_BANANOS -+ -+#include -+ -+#include -+ -+extern "C" -+{ -+ -+#include "SDL_joystick.h" -+#include "../SDL_sysjoystick.h" -+#include "../SDL_joystick_c.h" -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define MAX_JOYSTICKS 16 -+ -+struct joystick_hwdata -+{ -+ int fd; -+}; -+ -+static int s_joystick_count = 0; -+static char* s_joystick_path[MAX_JOYSTICKS]; -+ -+static int BANANOS_JoystickInit(void) -+{ -+ s_joystick_count = 0; -+ -+ for (int i = 0; i < MAX_JOYSTICKS; i++) -+ { -+ char path[PATH_MAX]; -+ sprintf(path, "/dev/joystick%d", i); -+ -+ struct stat st; -+ if (stat(path, &st) == -1) -+ continue; -+ -+ s_joystick_path[i] = SDL_strdup(path); -+ if (s_joystick_path[i] == NULL) -+ continue; -+ s_joystick_count++; -+ } -+ -+ return 0; -+} -+ -+static int BANANOS_JoystickGetCount(void) -+{ -+ return s_joystick_count; -+} -+ -+static void BANANOS_JoystickDetect(void) -+{ -+} -+ -+static const char* BANANOS_JoystickGetDeviceName(int device_index) -+{ -+ return s_joystick_path[device_index] + strlen("/dev/"); -+} -+ -+static const char* BANANOS_JoystickGetDevicePath(int device_index) -+{ -+ return s_joystick_path[device_index]; -+} -+ -+static int BANANOS_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) -+{ -+ (void)device_index; -+ return -1; -+} -+ -+static int BANANOS_JoystickGetDevicePlayerIndex(int device_index) -+{ -+ (void)device_index; -+ return -1; -+} -+ -+static void BANANOS_JoystickSetDevicePlayerIndex(int device_index, int player_index) -+{ -+ (void)device_index; -+ (void)player_index; -+} -+ -+static SDL_JoystickID BANANOS_JoystickGetDeviceInstanceID(int device_index) -+{ -+ return device_index; -+} -+ -+static void BANANOS_JoystickClose(SDL_Joystick* joystick) -+{ -+ if (joystick->hwdata == NULL) -+ return; -+ -+ if (joystick->hwdata->fd != -1) -+ close(joystick->hwdata->fd); -+ SDL_free(joystick->hwdata); -+} -+ -+static int BANANOS_JoystickOpen(SDL_Joystick* joystick, int device_index) -+{ -+ joystick->instance_id = device_index; -+ joystick->hwdata = static_cast(SDL_calloc(1, sizeof(joystick_hwdata))); -+ if (joystick->hwdata == NULL) -+ return SDL_OutOfMemory(); -+ -+ joystick->hwdata->fd = open(s_joystick_path[device_index], O_RDONLY); -+ if (joystick->hwdata->fd == -1) -+ { -+ BANANOS_JoystickClose(joystick); -+ return SDL_SetError("Unable to open joystick"); -+ } -+ -+ joystick->nbuttons = LibInput::JSB_COUNT; -+ joystick->naxes = LibInput::JSA_COUNT; -+ joystick->nhats = 0; -+ -+ return 0; -+} -+ -+static void BANANOS_JoystickUpdate(SDL_Joystick *joystick) -+{ -+ LibInput::JoystickState state; -+ if (read(joystick->hwdata->fd, &state, sizeof(state)) < static_cast(sizeof(state))) -+ return; -+ -+ for (int i = 0; i < joystick->naxes; i++) -+ SDL_PrivateJoystickAxis(joystick, i, state.axis[i]); -+ -+ for (int i = 0; i < joystick->nbuttons; i++) -+ SDL_PrivateJoystickButton(joystick, i, state.buttons[i]); -+} -+ -+static void BANANOS_JoystickQuit(void) -+{ -+ for (int i = 0; i < s_joystick_count; i++) -+ SDL_free(s_joystick_path[i]); -+} -+ -+static SDL_JoystickGUID BANANOS_JoystickGetDeviceGUID(int device_index) -+{ -+ return SDL_CreateJoystickGUIDForName(BANANOS_JoystickGetDeviceName(device_index)); -+} -+ -+static int BANANOS_JoystickRumble(SDL_Joystick* joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) -+{ -+ (void)joystick; -+ (void)low_frequency_rumble; -+ (void)high_frequency_rumble; -+ return SDL_Unsupported(); -+} -+ -+static int BANANOS_JoystickRumbleTriggers(SDL_Joystick* joystick, Uint16 left_rumble, Uint16 right_rumble) -+{ -+ (void)joystick; -+ (void)left_rumble; -+ (void)right_rumble; -+ return SDL_Unsupported(); -+} -+ -+static SDL_bool BANANOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping* out) -+{ -+ using namespace LibInput; -+ -+ (void)device_index; -+ -+ memset(out, 0, sizeof(SDL_GamepadMapping)); -+ -+#define BANANOS_MAP_BUTTON(name, button) \ -+ out->name.kind = EMappingKind_Button; \ -+ out->name.target = button -+ -+#define BANANOS_MAP_AXIS(name, axis) \ -+ out->name.kind = EMappingKind_Axis; \ -+ out->name.target = axis -+ -+ BANANOS_MAP_BUTTON(a, JSB_FACE_DOWN); -+ BANANOS_MAP_BUTTON(b, JSB_FACE_RIGHT); -+ BANANOS_MAP_BUTTON(x, JSB_FACE_LEFT); -+ BANANOS_MAP_BUTTON(y, JSB_FACE_UP); -+ -+ BANANOS_MAP_BUTTON(back, JSB_SELECT); -+ BANANOS_MAP_BUTTON(guide, JSB_MENU); -+ BANANOS_MAP_BUTTON(start, JSB_START); -+ -+ BANANOS_MAP_BUTTON(leftstick, JSB_STICK_LEFT); -+ BANANOS_MAP_BUTTON(rightstick, JSB_STICK_RIGHT); -+ -+ BANANOS_MAP_BUTTON(leftshoulder, JSB_SHOULDER_LEFT); -+ BANANOS_MAP_BUTTON(rightshoulder, JSB_SHOULDER_RIGHT); -+ -+ BANANOS_MAP_BUTTON(dpup, JSB_DPAD_UP); -+ BANANOS_MAP_BUTTON(dpdown, JSB_DPAD_DOWN); -+ BANANOS_MAP_BUTTON(dpleft, JSB_DPAD_LEFT); -+ BANANOS_MAP_BUTTON(dpright, JSB_DPAD_RIGHT); -+ -+ BANANOS_MAP_AXIS(leftx, JSA_STICK_LEFT_X); -+ BANANOS_MAP_AXIS(lefty, JSA_STICK_LEFT_Y); -+ BANANOS_MAP_AXIS(rightx, JSA_STICK_RIGHT_X); -+ BANANOS_MAP_AXIS(righty, JSA_STICK_RIGHT_Y); -+ -+ BANANOS_MAP_AXIS(lefttrigger, JSA_TRIGGER_LEFT); -+ BANANOS_MAP_AXIS(righttrigger, JSA_TRIGGER_RIGHT); -+ -+#undef BANANOS_MAP_BUTTON -+#undef BANANOS_MAP_AXIS -+ -+ return SDL_TRUE; -+} -+ -+static Uint32 BANANOS_JoystickGetCapabilities(SDL_Joystick* joystick) -+{ -+ (void)joystick; -+ return 0; -+} -+ -+static int BANANOS_JoystickSetLED(SDL_Joystick* joystick, Uint8 red, Uint8 green, Uint8 blue) -+{ -+ (void)joystick; -+ (void)red; -+ (void)green; -+ (void)blue; -+ return SDL_Unsupported(); -+} -+ -+static int BANANOS_JoystickSendEffect(SDL_Joystick* joystick, const void* data, int size) -+{ -+ (void)joystick; -+ (void)data; -+ (void)size; -+ return SDL_Unsupported(); -+} -+ -+static int BANANOS_JoystickSetSensorsEnabled(SDL_Joystick* joystick, SDL_bool enabled) -+{ -+ (void)joystick; -+ (void)enabled; -+ return SDL_Unsupported(); -+} -+ -+SDL_JoystickDriver SDL_BANANOS_JoystickDriver = -+{ -+ BANANOS_JoystickInit, -+ BANANOS_JoystickGetCount, -+ BANANOS_JoystickDetect, -+ BANANOS_JoystickGetDeviceName, -+ BANANOS_JoystickGetDevicePath, -+ BANANOS_JoystickGetDeviceSteamVirtualGamepadSlot, -+ BANANOS_JoystickGetDevicePlayerIndex, -+ BANANOS_JoystickSetDevicePlayerIndex, -+ BANANOS_JoystickGetDeviceGUID, -+ BANANOS_JoystickGetDeviceInstanceID, -+ BANANOS_JoystickOpen, -+ BANANOS_JoystickRumble, -+ BANANOS_JoystickRumbleTriggers, -+ BANANOS_JoystickGetCapabilities, -+ BANANOS_JoystickSetLED, -+ BANANOS_JoystickSendEffect, -+ BANANOS_JoystickSetSensorsEnabled, -+ BANANOS_JoystickUpdate, -+ BANANOS_JoystickClose, -+ BANANOS_JoystickQuit, -+ BANANOS_JoystickGetGamepadMapping -+}; -+ -+} // extern "C" -+ -+#endif /* SDL_JOYSTICK_BANANOS */ -+ -+/* vi: set ts=4 sw=4 expandtab: */ -diff -ruN SDL2-2.32.8/src/joystick/SDL_joystick.c SDL2-2.32.8-banan_os/src/joystick/SDL_joystick.c ---- SDL2-2.32.8/src/joystick/SDL_joystick.c 2025-01-01 17:47:53.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/joystick/SDL_joystick.c 2026-04-03 04:34:27.258656321 +0300 -@@ -85,6 +85,9 @@ - #ifdef SDL_JOYSTICK_HAIKU - &SDL_HAIKU_JoystickDriver, - #endif -+#ifdef SDL_JOYSTICK_BANANOS -+ &SDL_BANANOS_JoystickDriver, -+#endif - #ifdef SDL_JOYSTICK_USBHID /* !!! FIXME: "USBHID" is a generic name, and doubly-confusing with HIDAPI next to it. This is the *BSD interface, rename this. */ - &SDL_BSD_JoystickDriver, - #endif -diff -ruN SDL2-2.32.8/src/joystick/SDL_sysjoystick.h SDL2-2.32.8-banan_os/src/joystick/SDL_sysjoystick.h ---- SDL2-2.32.8/src/joystick/SDL_sysjoystick.h 2025-01-01 17:47:53.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/joystick/SDL_sysjoystick.h 2026-04-03 04:34:27.259001479 +0300 -@@ -235,6 +235,7 @@ - - /* The available joystick drivers */ - extern SDL_JoystickDriver SDL_ANDROID_JoystickDriver; -+extern SDL_JoystickDriver SDL_BANANOS_JoystickDriver; - extern SDL_JoystickDriver SDL_BSD_JoystickDriver; - extern SDL_JoystickDriver SDL_DARWIN_JoystickDriver; - extern SDL_JoystickDriver SDL_DUMMY_JoystickDriver; -diff -ruN SDL2-2.32.8/src/misc/banan_os/SDL_sysurl.cpp SDL2-2.32.8-banan_os/src/misc/banan_os/SDL_sysurl.cpp ---- SDL2-2.32.8/src/misc/banan_os/SDL_sysurl.cpp 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/misc/banan_os/SDL_sysurl.cpp 2026-04-03 04:34:27.259173778 +0300 -@@ -0,0 +1,30 @@ -+/* -+ Simple DirectMedia Layer -+ Copyright (C) 1997-2025 Sam Lantinga -+ -+ This software is provided 'as-is', without any express or implied -+ warranty. In no event will the authors be held liable for any damages -+ arising from the use of this software. -+ -+ Permission is granted to anyone to use this software for any purpose, -+ including commercial applications, and to alter it and redistribute it -+ freely, subject to the following restrictions: -+ -+ 1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+ 2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+ 3. This notice may not be removed or altered from any source distribution. -+*/ -+ -+#include "../SDL_sysurl.h" -+ -+int SDL_SYS_OpenURL(const char *url) -+{ -+ return SDL_SetError("SDL_SYS_OpenURL not supported"); -+} -+ -+/* vi: set ts=4 sw=4 expandtab: */ -+ -diff -ruN SDL2-2.32.8/src/video/banan_os/SDL_banan_os_clipboard.cpp SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_clipboard.cpp ---- SDL2-2.32.8/src/video/banan_os/SDL_banan_os_clipboard.cpp 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_clipboard.cpp 2026-04-03 04:34:27.259271557 +0300 -@@ -0,0 +1,51 @@ -+/* -+ Simple DirectMedia Layer -+ Copyright (C) 1997-2025 Sam Lantinga -+ -+ This software is provided 'as-is', without any express or implied -+ warranty. In no event will the authors be held liable for any damages -+ arising from the use of this software. -+ -+ Permission is granted to anyone to use this software for any purpose, -+ including commercial applications, and to alter it and redistribute it -+ freely, subject to the following restrictions: -+ -+ 1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+ 2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+ 3. This notice may not be removed or altered from any source distribution. -+*/ -+#include "../../SDL_internal.h" -+ -+#ifdef SDL_VIDEO_DRIVER_BANANOS -+ -+#include "SDL_banan_os_clipboard.h" -+ -+#include -+ -+int BANANOS_SetClipboardText(_THIS, const char *text) { -+ if (LibClipboard::Clipboard::set_clipboard_text(text).is_error()) -+ return -1; -+ return 0; -+} -+ -+char *BANANOS_GetClipboardText(_THIS) { -+ auto text_or_error = LibClipboard::Clipboard::get_clipboard_text(); -+ if (text_or_error.is_error()) -+ return NULL; -+ return SDL_strdup(text_or_error.value().data()); -+} -+ -+SDL_bool BANANOS_HasClipboardText(_THIS) { -+ auto text_or_error = LibClipboard::Clipboard::get_clipboard_text(); -+ if (text_or_error.is_error()) -+ return SDL_FALSE; -+ return text_or_error.value().empty() ? SDL_FALSE : SDL_TRUE; -+} -+ -+#endif /* SDL_VIDEO_DRIVER_BANANOS */ -+ -+/* vi: set ts=4 sw=4 expandtab: */ -diff -ruN SDL2-2.32.8/src/video/banan_os/SDL_banan_os_clipboard.h SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_clipboard.h ---- SDL2-2.32.8/src/video/banan_os/SDL_banan_os_clipboard.h 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_clipboard.h 2026-04-03 04:34:27.259318700 +0300 -@@ -0,0 +1,43 @@ -+/* -+ Simple DirectMedia Layer -+ Copyright (C) 1997-2025 Sam Lantinga -+ -+ This software is provided 'as-is', without any express or implied -+ warranty. In no event will the authors be held liable for any damages -+ arising from the use of this software. -+ -+ Permission is granted to anyone to use this software for any purpose, -+ including commercial applications, and to alter it and redistribute it -+ freely, subject to the following restrictions: -+ -+ 1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+ 2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+ 3. This notice may not be removed or altered from any source distribution. -+*/ -+ -+#ifndef SDL_BANANOS_CLIPBOARD_H -+#define SDL_BANANOS_CLIPBOARD_H -+ -+#include "../../SDL_internal.h" -+ -+#include "../SDL_sysvideo.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+extern int BANANOS_SetClipboardText(_THIS, const char *text); -+extern char *BANANOS_GetClipboardText(_THIS); -+extern SDL_bool BANANOS_HasClipboardText(_THIS); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif -+ -+/* vi: set ts=4 sw=4 expandtab: */ -diff -ruN SDL2-2.32.8/src/video/banan_os/SDL_banan_os_message_box.cpp SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_message_box.cpp ---- SDL2-2.32.8/src/video/banan_os/SDL_banan_os_message_box.cpp 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_message_box.cpp 2026-04-03 04:34:27.259375481 +0300 -@@ -0,0 +1,60 @@ -+/* -+ Simple DirectMedia Layer -+ Copyright (C) 1997-2025 Sam Lantinga -+ Copyright (C) 2018-2019 EXL -+ -+ This software is provided 'as-is', without any express or implied -+ warranty. In no event will the authors be held liable for any damages -+ arising from the use of this software. -+ -+ Permission is granted to anyone to use this software for any purpose, -+ including commercial applications, and to alter it and redistribute it -+ freely, subject to the following restrictions: -+ -+ 1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+ 2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+ 3. This notice may not be removed or altered from any source distribution. -+*/ -+ -+#include "../../SDL_internal.h" -+ -+#ifdef SDL_VIDEO_DRIVER_BANANOS -+ -+#include "SDL_messagebox.h" -+ -+#include "SDL_banan_os_message_box.h" -+ -+#include -+#include -+ -+int BANANOS_ShowMessageBox(const SDL_MessageBoxData* messageboxdata, int* buttonid) -+{ -+ BAN::Vector buttons; -+ for (int i = 0; i < messageboxdata->numbuttons; i++) { -+ if (buttons.push_back(messageboxdata->buttons[i].text).is_error()) { -+ SDL_OutOfMemory(); -+ return -1; -+ } -+ } -+ -+ if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) -+ buttons.reverse(); -+ -+ auto result = LibGUI::MessageBox::create(messageboxdata->message, messageboxdata->title, buttons.span()); -+ if (result.is_error()) { -+ dwarnln("LibGUI::MessageBox::create: {}", result.error()); -+ return -1; -+ } -+ -+ *buttonid = messageboxdata->buttons[result.value()].buttonid; -+ -+ return 0; -+} -+ -+#endif /* SDL_VIDEO_DRIVER_BANANOS */ -+ -+/* vi: set ts=4 sw=4 expandtab: */ -diff -ruN SDL2-2.32.8/src/video/banan_os/SDL_banan_os_message_box.h SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_message_box.h ---- SDL2-2.32.8/src/video/banan_os/SDL_banan_os_message_box.h 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_message_box.h 2026-04-03 04:34:27.259437082 +0300 -@@ -0,0 +1,45 @@ -+/* -+ Simple DirectMedia Layer -+ Copyright (C) 1997-2025 Sam Lantinga -+ Copyright (C) 2018-2019 EXL -+ -+ This software is provided 'as-is', without any express or implied -+ warranty. In no event will the authors be held liable for any damages -+ arising from the use of this software. -+ -+ Permission is granted to anyone to use this software for any purpose, -+ including commercial applications, and to alter it and redistribute it -+ freely, subject to the following restrictions: -+ -+ 1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+ 2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+ 3. This notice may not be removed or altered from any source distribution. -+*/ -+ -+#ifndef SDL_BANANOS_MESSAGEBOX_H -+#define SDL_BANANOS_MESSAGEBOX_H -+ -+#include "../../SDL_internal.h" -+ -+#ifdef SDL_VIDEO_DRIVER_BANANOS -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+extern int -+BANANOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* SDL_BANANOS_MESSAGEBOX_H */ -+ -+#endif -+ -+/* vi: set ts=4 sw=4 expandtab: */ -diff -ruN SDL2-2.32.8/src/video/banan_os/SDL_banan_os_video.cpp SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_video.cpp ---- SDL2-2.32.8/src/video/banan_os/SDL_banan_os_video.cpp 1970-01-01 02:00:00.000000000 +0200 -+++ SDL2-2.32.8-banan_os/src/video/banan_os/SDL_banan_os_video.cpp 2026-04-03 04:34:27.259503082 +0300 -@@ -0,0 +1,729 @@ -+/* -+ Simple DirectMedia Layer -+ Copyright (C) 1997-2025 Sam Lantinga -+ -+ This software is provided 'as-is', without any express or implied -+ warranty. In no event will the authors be held liable for any damages -+ arising from the use of this software. -+ -+ Permission is granted to anyone to use this software for any purpose, -+ including commercial applications, and to alter it and redistribute it -+ freely, subject to the following restrictions: -+ -+ 1. The origin of this software must not be misrepresented; you must not -+ claim that you wrote the original software. If you use this software -+ in a product, an acknowledgment in the product documentation would be -+ appreciated but is not required. -+ 2. Altered source versions must be plainly marked as such, and must not be -+ misrepresented as being the original software. -+ 3. This notice may not be removed or altered from any source distribution. -+*/ -+#include "../../SDL_internal.h" -+ -+#ifdef SDL_VIDEO_DRIVER_BANANOS -+ -+extern "C" { -+#include "../SDL_sysvideo.h" -+#include "../../events/SDL_events_c.h" -+} -+ -+#include "SDL_banan_os_clipboard.h" -+#include "SDL_banan_os_message_box.h" -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+ -+#define DUMP_FUNCTIONS 0 -+ -+#if DUMP_FUNCTIONS -+# define DUMP_FUNCTION() dprintln(__FUNCTION__) -+#else -+# define DUMP_FUNCTION() -+#endif -+ -+struct banan_os_window -+{ -+ BAN::UniqPtr window; -+ OSMesaContext gl_context { nullptr }; -+ SDL_bool relative { SDL_FALSE }; -+}; -+ -+struct banan_os_video_device_data -+{ -+ BAN::LinkedList windows; -+}; -+ -+struct Keymap -+{ -+ consteval Keymap() -+ { -+ for (auto& scancode : map) -+ scancode = SDL_SCANCODE_UNKNOWN; -+ -+ using LibInput::keycode_normal; -+ using LibInput::keycode_function; -+ using LibInput::keycode_numpad; -+ -+ map[keycode_normal(0, 0)] = SDL_SCANCODE_GRAVE; -+ map[keycode_normal(0, 1)] = SDL_SCANCODE_1; -+ map[keycode_normal(0, 2)] = SDL_SCANCODE_2; -+ map[keycode_normal(0, 3)] = SDL_SCANCODE_3; -+ map[keycode_normal(0, 4)] = SDL_SCANCODE_4; -+ map[keycode_normal(0, 5)] = SDL_SCANCODE_5; -+ map[keycode_normal(0, 6)] = SDL_SCANCODE_6; -+ map[keycode_normal(0, 7)] = SDL_SCANCODE_7; -+ map[keycode_normal(0, 8)] = SDL_SCANCODE_8; -+ map[keycode_normal(0, 9)] = SDL_SCANCODE_9; -+ map[keycode_normal(0, 10)] = SDL_SCANCODE_0; -+ map[keycode_normal(0, 11)] = SDL_SCANCODE_MINUS; -+ map[keycode_normal(0, 12)] = SDL_SCANCODE_EQUALS; -+ map[keycode_normal(0, 13)] = SDL_SCANCODE_BACKSPACE; -+ map[keycode_normal(1, 0)] = SDL_SCANCODE_TAB; -+ map[keycode_normal(1, 1)] = SDL_SCANCODE_Q; -+ map[keycode_normal(1, 2)] = SDL_SCANCODE_W; -+ map[keycode_normal(1, 3)] = SDL_SCANCODE_E; -+ map[keycode_normal(1, 4)] = SDL_SCANCODE_R; -+ map[keycode_normal(1, 5)] = SDL_SCANCODE_T; -+ map[keycode_normal(1, 6)] = SDL_SCANCODE_Y; -+ map[keycode_normal(1, 7)] = SDL_SCANCODE_U; -+ map[keycode_normal(1, 8)] = SDL_SCANCODE_I; -+ map[keycode_normal(1, 9)] = SDL_SCANCODE_O; -+ map[keycode_normal(1, 10)] = SDL_SCANCODE_P; -+ map[keycode_normal(1, 11)] = SDL_SCANCODE_LEFTBRACKET; -+ map[keycode_normal(1, 12)] = SDL_SCANCODE_RIGHTBRACKET; -+ map[keycode_normal(2, 0)] = SDL_SCANCODE_CAPSLOCK; -+ map[keycode_normal(2, 1)] = SDL_SCANCODE_A; -+ map[keycode_normal(2, 2)] = SDL_SCANCODE_S; -+ map[keycode_normal(2, 3)] = SDL_SCANCODE_D; -+ map[keycode_normal(2, 4)] = SDL_SCANCODE_F; -+ map[keycode_normal(2, 5)] = SDL_SCANCODE_G; -+ map[keycode_normal(2, 6)] = SDL_SCANCODE_H; -+ map[keycode_normal(2, 7)] = SDL_SCANCODE_J; -+ map[keycode_normal(2, 8)] = SDL_SCANCODE_K; -+ map[keycode_normal(2, 9)] = SDL_SCANCODE_L; -+ map[keycode_normal(2, 10)] = SDL_SCANCODE_SEMICOLON; -+ map[keycode_normal(2, 11)] = SDL_SCANCODE_APOSTROPHE; -+ map[keycode_normal(2, 12)] = SDL_SCANCODE_BACKSLASH; -+ map[keycode_normal(2, 13)] = SDL_SCANCODE_RETURN; -+ map[keycode_normal(3, 0)] = SDL_SCANCODE_LSHIFT; -+ map[keycode_normal(3, 1)] = SDL_SCANCODE_NONUSBACKSLASH; -+ map[keycode_normal(3, 2)] = SDL_SCANCODE_Z; -+ map[keycode_normal(3, 3)] = SDL_SCANCODE_X; -+ map[keycode_normal(3, 4)] = SDL_SCANCODE_C; -+ map[keycode_normal(3, 5)] = SDL_SCANCODE_V; -+ map[keycode_normal(3, 6)] = SDL_SCANCODE_B; -+ map[keycode_normal(3, 7)] = SDL_SCANCODE_N; -+ map[keycode_normal(3, 8)] = SDL_SCANCODE_M; -+ map[keycode_normal(3, 9)] = SDL_SCANCODE_COMMA; -+ map[keycode_normal(3, 10)] = SDL_SCANCODE_PERIOD; -+ map[keycode_normal(3, 11)] = SDL_SCANCODE_SLASH; -+ map[keycode_normal(3, 12)] = SDL_SCANCODE_RSHIFT; -+ map[keycode_normal(4, 0)] = SDL_SCANCODE_LCTRL; -+ map[keycode_normal(4, 1)] = SDL_SCANCODE_LGUI; -+ map[keycode_normal(4, 2)] = SDL_SCANCODE_LALT; -+ map[keycode_normal(4, 3)] = SDL_SCANCODE_SPACE; -+ map[keycode_normal(4, 5)] = SDL_SCANCODE_RALT; -+ map[keycode_normal(4, 6)] = SDL_SCANCODE_RCTRL; -+ -+ map[keycode_normal(5, 0)] = SDL_SCANCODE_UP; -+ map[keycode_normal(5, 1)] = SDL_SCANCODE_LEFT; -+ map[keycode_normal(5, 2)] = SDL_SCANCODE_DOWN; -+ map[keycode_normal(5, 3)] = SDL_SCANCODE_RIGHT; -+ -+ map[keycode_function(0)] = SDL_SCANCODE_ESCAPE; -+ map[keycode_function(1)] = SDL_SCANCODE_F1; -+ map[keycode_function(2)] = SDL_SCANCODE_F2; -+ map[keycode_function(3)] = SDL_SCANCODE_F3; -+ map[keycode_function(4)] = SDL_SCANCODE_F4; -+ map[keycode_function(5)] = SDL_SCANCODE_F5; -+ map[keycode_function(6)] = SDL_SCANCODE_F6; -+ map[keycode_function(7)] = SDL_SCANCODE_F7; -+ map[keycode_function(8)] = SDL_SCANCODE_F8; -+ map[keycode_function(9)] = SDL_SCANCODE_F9; -+ map[keycode_function(10)] = SDL_SCANCODE_F10; -+ map[keycode_function(11)] = SDL_SCANCODE_F11; -+ map[keycode_function(12)] = SDL_SCANCODE_F12; -+ map[keycode_function(13)] = SDL_SCANCODE_INSERT; -+ map[keycode_function(14)] = SDL_SCANCODE_PRINTSCREEN; -+ map[keycode_function(15)] = SDL_SCANCODE_DELETE; -+ map[keycode_function(16)] = SDL_SCANCODE_HOME; -+ map[keycode_function(17)] = SDL_SCANCODE_END; -+ map[keycode_function(18)] = SDL_SCANCODE_PAGEUP; -+ map[keycode_function(19)] = SDL_SCANCODE_PAGEDOWN; -+ map[keycode_function(20)] = SDL_SCANCODE_SCROLLLOCK; -+ -+ map[keycode_numpad(0, 0)] = SDL_SCANCODE_NUMLOCKCLEAR; -+ map[keycode_numpad(0, 1)] = SDL_SCANCODE_KP_DIVIDE; -+ map[keycode_numpad(0, 2)] = SDL_SCANCODE_KP_MULTIPLY; -+ map[keycode_numpad(0, 3)] = SDL_SCANCODE_KP_MINUS; -+ map[keycode_numpad(1, 0)] = SDL_SCANCODE_KP_7; -+ map[keycode_numpad(1, 1)] = SDL_SCANCODE_KP_8; -+ map[keycode_numpad(1, 2)] = SDL_SCANCODE_KP_9; -+ map[keycode_numpad(1, 3)] = SDL_SCANCODE_KP_PLUS; -+ map[keycode_numpad(2, 0)] = SDL_SCANCODE_KP_4; -+ map[keycode_numpad(2, 1)] = SDL_SCANCODE_KP_5; -+ map[keycode_numpad(2, 2)] = SDL_SCANCODE_KP_6; -+ map[keycode_numpad(3, 0)] = SDL_SCANCODE_KP_1; -+ map[keycode_numpad(3, 1)] = SDL_SCANCODE_KP_2; -+ map[keycode_numpad(3, 2)] = SDL_SCANCODE_KP_3; -+ map[keycode_numpad(3, 3)] = SDL_SCANCODE_KP_ENTER; -+ map[keycode_numpad(4, 0)] = SDL_SCANCODE_KP_0; -+ map[keycode_numpad(4, 1)] = SDL_SCANCODE_KP_COMMA; -+ }; -+ -+ SDL_Scancode map[0x100]; -+}; -+static Keymap s_keymap; -+ -+static int BANANOS_mouse_button_to_sdl(LibInput::MouseButton button) -+{ -+ switch (button) { -+#define BUTTON_CASE(my, sdl) case LibInput::MouseButton::my: return SDL_BUTTON_##sdl -+ BUTTON_CASE(Left, LEFT); -+ BUTTON_CASE(Right, RIGHT); -+ BUTTON_CASE(Middle, MIDDLE); -+ BUTTON_CASE(Extra1, X1); -+ BUTTON_CASE(Extra2, X2); -+#undef BUTTON_CASE -+ } -+ return 0; -+} -+ -+static SDL_VideoDevice* s_video_device = nullptr; -+ -+static SDL_Cursor* BANANOS_CreateSystemCursor(SDL_SystemCursor id) -+{ -+ DUMP_FUNCTION(); -+ -+ // FIXME: support system cursors :) -+ -+ auto* cursor = static_cast(SDL_calloc(1, sizeof(SDL_Cursor))); -+ if (cursor == nullptr) { -+ SDL_OutOfMemory(); -+ return nullptr; -+ } -+ -+ return cursor; -+} -+ -+static void BANANOS_FreeCursor(SDL_Cursor* cursor) -+{ -+ DUMP_FUNCTION(); -+ -+ if (cursor != nullptr) -+ SDL_free(cursor); -+} -+ -+static int BANANOS_ShowCursor(SDL_Cursor* cursor) -+{ -+ DUMP_FUNCTION(); -+ -+ if (s_video_device == nullptr) -+ return 0; -+ -+ auto& ban_video_device_data = *static_cast(s_video_device->driverdata); -+ for (auto it = ban_video_device_data.windows.begin(); it != ban_video_device_data.windows.end(); it++) -+ (*it)->window->set_cursor_visible(!!cursor); -+ -+ return 0; -+} -+ -+static int BANANOS_SetRelativeMouseMode(SDL_bool enabled) -+{ -+ DUMP_FUNCTION(); -+ -+ auto* window = SDL_GetMouseFocus(); -+ if (window == nullptr) -+ return 0; -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ ban_window.window->set_mouse_relative(enabled); -+ ban_window.relative = enabled; -+ -+ return 0; -+} -+ -+static void BANANOS_InitMouse(_THIS) -+{ -+ DUMP_FUNCTION(); -+ -+ auto* mouse = SDL_GetMouse(); -+ mouse->ShowCursor = BANANOS_ShowCursor; -+ mouse->SetRelativeMouseMode = BANANOS_SetRelativeMouseMode; -+ mouse->CreateSystemCursor = BANANOS_CreateSystemCursor; -+ mouse->FreeCursor = BANANOS_FreeCursor; -+ -+ SDL_SetDefaultCursor(BANANOS_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW)); -+} -+ -+static int BANANOS_VideoInit(_THIS) -+{ -+ DUMP_FUNCTION(); -+ -+ BANANOS_InitMouse(_this); -+ -+ int fb_fd = open("/dev/fb0", O_RDONLY); -+ if (fb_fd == -1) { -+ dwarnln("Failed to open framebuffer: {}", strerror(errno)); -+ return -1; -+ } -+ -+ framebuffer_info_t fb_info; -+ const ssize_t nread = pread(fb_fd, &fb_info, sizeof(fb_info), -1); -+ close(fb_fd); -+ -+ if (nread != sizeof(fb_info)) { -+ dwarnln("Failed to get framebuffer info"); -+ return -1; -+ } -+ -+ SDL_DisplayMode mode { -+ .format = SDL_PIXELFORMAT_RGB888, -+ .w = static_cast(fb_info.width), -+ .h = static_cast(fb_info.height), -+ .refresh_rate = 60, -+ .driverdata = nullptr, -+ }; -+ -+ if (SDL_AddBasicVideoDisplay(&mode) < 0) -+ return -1; -+ -+ SDL_AddDisplayMode(&_this->displays[0], &mode); -+ -+ if (s_video_device == nullptr) -+ s_video_device = _this; -+ -+ return 0; -+} -+ -+static void BANANOS_VideoQuit(_THIS) -+{ -+ DUMP_FUNCTION(); -+ -+ if (s_video_device == _this) -+ s_video_device = nullptr; -+} -+ -+static void BANANOS_free(_THIS) -+{ -+ DUMP_FUNCTION(); -+ delete static_cast(_this->driverdata); -+ SDL_free(_this); -+} -+ -+static int BANANOS_CreateSDLWindow(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto attributes = LibGUI::Window::default_attributes; -+ attributes.shown = false; -+ attributes.resizable = false; -+ -+ auto window_or_error = LibGUI::Window::create(window->w, window->h, ""_sv, attributes); -+ if (window_or_error.is_error()) { -+ dwarnln("LibGUI::Window::create: {}", window_or_error.error()); -+ return -1; -+ } -+ -+ auto& ban_video_device_data = *static_cast(_this->driverdata); -+ -+ auto* ban_window = new banan_os_window(window_or_error.release_value()); -+ -+ window->driverdata = ban_window; -+ if (window->driverdata == nullptr) -+ return -1; -+ -+ if (ban_video_device_data.windows.push_back(ban_window).is_error()) { -+ delete ban_window; -+ return -1; -+ } -+ -+ ban_window->window->set_key_event_callback( -+ [](LibGUI::EventPacket::KeyEvent::event_t event) { -+ SDL_SendKeyboardKey(event.pressed() ? SDL_PRESSED : SDL_RELEASED, s_keymap.map[event.scancode]); -+ -+ if (event.pressed()) { -+ if (const char* utf8 = LibInput::key_to_utf8(event.key, event.modifier)) -+ SDL_SendKeyboardText(utf8); -+ } -+ } -+ ); -+ -+ ban_window->window->set_mouse_button_event_callback( -+ [window, ban_window](LibGUI::EventPacket::MouseButtonEvent::event_t event) { -+ const int state = event.pressed ? SDL_PRESSED : SDL_RELEASED; -+ SDL_SendMouseMotion(window, 0, ban_window->relative, event.x, event.y); -+ SDL_SendMouseButton(window, 0, state, BANANOS_mouse_button_to_sdl(event.button)); -+ } -+ ); -+ -+ ban_window->window->set_mouse_move_event_callback( -+ [window, ban_window](LibGUI::EventPacket::MouseMoveEvent::event_t event) { -+ SDL_SendMouseMotion(window, 0, ban_window->relative, event.x, event.y); -+ } -+ ); -+ -+ ban_window->window->set_mouse_scroll_event_callback( -+ [window](LibGUI::EventPacket::MouseScrollEvent::event_t event) { -+ SDL_SendMouseWheel(window, 0, 0.0f, event.scroll, SDL_MOUSEWHEEL_NORMAL); -+ } -+ ); -+ -+ ban_window->window->set_resize_window_event_callback( -+ [window, ban_window]() { -+ const size_t width = ban_window->window->width(); -+ const size_t height = ban_window->window->height(); -+ -+ if (ban_window->gl_context) { -+ OSMesaMakeCurrent( -+ ban_window->gl_context, -+ ban_window->window->texture().pixels().data(), -+ GL_UNSIGNED_BYTE, -+ width, height -+ ); -+ OSMesaPixelStore(OSMESA_Y_UP, 0); -+ } -+ -+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height); -+ } -+ ); -+ -+ ban_window->window->set_window_shown_event_callback( -+ [window](LibGUI::EventPacket::WindowShownEvent::event_t event) { -+ const int state = event.shown ? SDL_WINDOWEVENT_SHOWN : SDL_WINDOWEVENT_HIDDEN; -+ SDL_SendWindowEvent(window, state, 0, 0); -+ } -+ ); -+ -+ ban_window->window->set_window_focus_event_callback( -+ [window](LibGUI::EventPacket::WindowFocusEvent::event_t event) { -+ SDL_SetKeyboardFocus(event.focused ? window : nullptr); -+ } -+ ); -+ -+ ban_window->window->set_close_window_event_callback( -+ [window]() { -+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, 0); -+ } -+ ); -+ -+ return 0; -+} -+ -+static void BANANOS_DestroyWindow(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_video_device_data = *static_cast(_this->driverdata); -+ for (auto it = ban_video_device_data.windows.begin(); it != ban_video_device_data.windows.end(); it++) { -+ if (*it != static_cast(window->driverdata)) -+ continue; -+ ban_video_device_data.windows.remove(it); -+ break; -+ } -+ -+ delete static_cast(window->driverdata); -+ window->driverdata = nullptr; -+} -+ -+static void BANANOS_ShowWindow(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ -+ auto attributes = ban_window.window->get_attributes(); -+ if (attributes.shown) -+ return; -+ attributes.shown = true; -+ -+ ban_window.window->set_attributes(attributes); -+} -+ -+static void BANANOS_HideWindow(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ -+ auto attributes = ban_window.window->get_attributes(); -+ if (!attributes.shown) -+ return; -+ attributes.shown = false; -+ -+ ban_window.window->set_attributes(attributes); -+} -+ -+static void BANANOS_SetWindowTitle(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ ban_window.window->set_title(window->title); -+} -+ -+static void BANANOS_SetWindowPosition(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ ban_window.window->set_position(window->x, window->y); -+} -+ -+static void BANANOS_SetWindowSize(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ ban_window.window->request_resize(window->w, window->h); -+} -+ -+static void BANANOS_SetWindowMinimumSize(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ ban_window.window->set_min_size(window->min_w, window->min_h); -+} -+ -+static void BANANOS_SetWindowMaximumSize(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ ban_window.window->set_max_size(window->min_w, window->min_h); -+} -+ -+static void BANANOS_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) -+{ -+ DUMP_FUNCTION(); -+} -+ -+static void BANANOS_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ if (auto attributes = ban_window.window->get_attributes(); attributes.resizable != resizable) { -+ attributes.resizable = resizable; -+ ban_window.window->set_attributes(attributes); -+ } -+} -+ -+static void BANANOS_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ ban_window.window->set_fullscreen(fullscreen); -+} -+ -+static int BANANOS_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format, void** pixels, int* pitch) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ -+ if (ban_window.gl_context) { -+ dwarnln("CreateWindowFramebuffer with OpenGL context"); -+ return -1; -+ } -+ -+ auto framebuffer_or_error = LibGUI::Texture::create(ban_window.window->width(), ban_window.window->width(), 0x000000); -+ if (framebuffer_or_error.is_error()) { -+ dwarnln("LibGUI::Texture::create: {}", framebuffer_or_error.error()); -+ return -1; -+ } -+ -+ *format = SDL_PIXELFORMAT_BGR888; -+ *pixels = ban_window.window->texture().pixels().data(); -+ *pitch = ban_window.window->texture().width() * sizeof(uint32_t); -+ -+ return 0; -+} -+ -+static int BANANOS_UpdateWindowFramebuffer(_THIS, SDL_Window* window, const SDL_Rect* rects, int numrects) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ -+ for (int i = 0; i < numrects; i++) -+ ban_window.window->invalidate(rects[i].x, rects[i].y, rects[i].w, rects[i].h); -+ -+ return 0; -+} -+ -+static void BANANOS_DestroyWindowFramebuffer(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+} -+ -+static void BANANOS_PumpEvents(_THIS) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_video_device_data = *static_cast(_this->driverdata); -+ for (auto* window : ban_video_device_data.windows) -+ window->window->poll_events(); -+} -+ -+static int BANANOS_GL_LoadLibrary(_THIS, const char* path) -+{ -+ DUMP_FUNCTION(); -+ -+ if (_this->gl_config.driver_loaded) { -+ SDL_SetError("OpenGL library is already loaded"); -+ return -1; -+ } -+ -+ _this->gl_config.driver_loaded = SDL_TRUE; -+ return 0; -+} -+ -+static void* BANANOS_GL_GetProcAddress(_THIS, const char* proc) -+{ -+ DUMP_FUNCTION(); -+ -+ return reinterpret_cast(OSMesaGetProcAddress(proc)); -+} -+ -+static SDL_GLContext BANANOS_GL_CreateContext(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ -+ auto gl_context = OSMesaCreateContext(OSMESA_BGRA, NULL); -+ if (gl_context == nullptr) { -+ dwarnln("OSMesaCreateContext"); -+ return nullptr; -+ } -+ -+ auto& fb = ban_window.window->texture(); -+ if (!OSMesaMakeCurrent(gl_context, fb.pixels().data(), GL_UNSIGNED_BYTE, fb.width(), fb.height())) { -+ OSMesaDestroyContext(gl_context); -+ return nullptr; -+ } -+ OSMesaPixelStore(OSMESA_Y_UP, 0); -+ -+ ban_window.gl_context = gl_context; -+ -+ return gl_context; -+} -+ -+static void BANANOS_GL_DeleteContext(_THIS, SDL_GLContext context) -+{ -+ DUMP_FUNCTION(); -+ -+ auto gl_context = static_cast(context); -+ OSMesaDestroyContext(gl_context); -+} -+ -+static int BANANOS_GL_MakeCurrent(_THIS, SDL_Window* window, SDL_GLContext context) -+{ -+ DUMP_FUNCTION(); -+ -+ if (window == nullptr || context == nullptr) -+ return 0; -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ -+ auto gl_context = static_cast(context); -+ -+ auto& fb = ban_window.window->texture(); -+ if (!OSMesaMakeCurrent(gl_context, fb.pixels().data(), GL_UNSIGNED_BYTE, fb.width(), fb.height())) -+ return -1; -+ OSMesaPixelStore(OSMESA_Y_UP, 0); -+ -+ return 0; -+} -+ -+static int BANANOS_GL_SwapWindow(_THIS, SDL_Window* window) -+{ -+ DUMP_FUNCTION(); -+ -+ static void (*glFinish)() = nullptr; -+ if (glFinish == nullptr) -+ glFinish = OSMesaGetProcAddress("glFinish"); -+ glFinish(); -+ -+ auto& ban_window = *static_cast(window->driverdata); -+ ban_window.window->invalidate(); -+ -+ return 0; -+} -+ -+static SDL_VideoDevice* BANANOS_CreateDevice(void) -+{ -+ DUMP_FUNCTION(); -+ -+ auto* device = static_cast(SDL_calloc(1, sizeof(SDL_VideoDevice))); -+ if (device == nullptr) { -+ SDL_OutOfMemory(); -+ return nullptr; -+ } -+ -+ device->driverdata = new banan_os_video_device_data(); -+ if (device->driverdata == nullptr) { -+ SDL_OutOfMemory(); -+ return nullptr; -+ } -+ -+ device->VideoInit = BANANOS_VideoInit; -+ device->VideoQuit = BANANOS_VideoQuit; -+ -+ device->CreateSDLWindow = BANANOS_CreateSDLWindow; -+ device->DestroyWindow = BANANOS_DestroyWindow; -+ device->ShowWindow = BANANOS_ShowWindow; -+ device->HideWindow = BANANOS_HideWindow; -+ -+ device->SetWindowTitle = BANANOS_SetWindowTitle; -+ device->SetWindowPosition = BANANOS_SetWindowPosition; -+ device->SetWindowSize = BANANOS_SetWindowSize; -+ device->SetWindowMinimumSize = BANANOS_SetWindowMinimumSize; -+ device->SetWindowMaximumSize = BANANOS_SetWindowMaximumSize; -+ device->SetWindowBordered = BANANOS_SetWindowBordered; -+ device->SetWindowResizable = BANANOS_SetWindowResizable; -+ device->SetWindowFullscreen = BANANOS_SetWindowFullscreen; -+ -+ device->CreateWindowFramebuffer = BANANOS_CreateWindowFramebuffer; -+ device->UpdateWindowFramebuffer = BANANOS_UpdateWindowFramebuffer; -+ device->DestroyWindowFramebuffer = BANANOS_DestroyWindowFramebuffer; -+ -+ device->PumpEvents = BANANOS_PumpEvents; -+ -+ device->GL_LoadLibrary = BANANOS_GL_LoadLibrary; -+ device->GL_GetProcAddress = BANANOS_GL_GetProcAddress; -+ device->GL_CreateContext = BANANOS_GL_CreateContext; -+ device->GL_DeleteContext = BANANOS_GL_DeleteContext; -+ device->GL_MakeCurrent = BANANOS_GL_MakeCurrent; -+ device->GL_SwapWindow = BANANOS_GL_SwapWindow; -+ -+ device->SetClipboardText = BANANOS_SetClipboardText; -+ device->GetClipboardText = BANANOS_GetClipboardText; -+ device->HasClipboardText = BANANOS_HasClipboardText; -+ -+ device->free = BANANOS_free; -+ -+ return device; -+} -+ -+VideoBootStrap BANANOS_bootstrap = { -+ "banan-os", "banan-os graphics", -+ BANANOS_CreateDevice, -+ BANANOS_ShowMessageBox -+}; -+ -+#endif /* SDL_VIDEO_DRIVER_BANANOS */ -+ -+/* vi: set ts=4 sw=4 expandtab: */ -diff -ruN SDL2-2.32.8/src/video/SDL_sysvideo.h SDL2-2.32.8-banan_os/src/video/SDL_sysvideo.h ---- SDL2-2.32.8/src/video/SDL_sysvideo.h 2025-05-20 00:24:41.000000000 +0300 -+++ SDL2-2.32.8-banan_os/src/video/SDL_sysvideo.h 2026-04-03 04:34:27.259743826 +0300 -@@ -462,6 +462,7 @@ - extern VideoBootStrap WINDOWS_bootstrap; - extern VideoBootStrap WINRT_bootstrap; - extern VideoBootStrap HAIKU_bootstrap; -+extern VideoBootStrap BANANOS_bootstrap; - extern VideoBootStrap PND_bootstrap; - extern VideoBootStrap UIKIT_bootstrap; - extern VideoBootStrap Android_bootstrap; -diff -ruN SDL2-2.32.8/src/video/SDL_video.c SDL2-2.32.8-banan_os/src/video/SDL_video.c ---- SDL2-2.32.8/src/video/SDL_video.c 2025-05-20 00:24:41.000000000 +0300 -+++ SDL2-2.32.8-banan_os/src/video/SDL_video.c 2026-04-03 04:34:27.260110007 +0300 -@@ -96,6 +96,9 @@ - #ifdef SDL_VIDEO_DRIVER_HAIKU - &HAIKU_bootstrap, - #endif -+#ifdef SDL_VIDEO_DRIVER_BANANOS -+ &BANANOS_bootstrap, -+#endif - #ifdef SDL_VIDEO_DRIVER_PANDORA - &PND_bootstrap, - #endif diff --git a/ports/SDL2_image/build.sh b/ports/SDL2_image/build.sh index 2a814fb5..6b4924ea 100755 --- a/ports/SDL2_image/build.sh +++ b/ports/SDL2_image/build.sh @@ -3,7 +3,7 @@ NAME='SDL2_image' VERSION='2.8.8' DOWNLOAD_URL="https://github.com/libsdl-org/SDL_image/releases/download/release-$VERSION/SDL2_image-$VERSION.tar.gz#2213b56fdaff2220d0e38c8e420cbe1a83c87374190cba8c70af2156097ce30a" -DEPENDENCIES=('SDL2' 'libpng' 'libjpeg' 'libtiff' 'libwebp') +DEPENDENCIES=('sdl2-compat' 'libpng' 'libjpeg' 'libtiff' 'libwebp') configure() { cmake --fresh -S . -B build -G Ninja \ diff --git a/ports/SDL2_mixer/build.sh b/ports/SDL2_mixer/build.sh index 3d6f5738..27c3f9ed 100755 --- a/ports/SDL2_mixer/build.sh +++ b/ports/SDL2_mixer/build.sh @@ -3,7 +3,7 @@ NAME='SDL2_mixer' VERSION='2.8.1' DOWNLOAD_URL="https://github.com/libsdl-org/SDL_mixer/releases/download/release-$VERSION/SDL2_mixer-$VERSION.tar.gz#cb760211b056bfe44f4a1e180cc7cb201137e4d1572f2002cc1be728efd22660" -DEPENDENCIES=('SDL2' 'timidity') +DEPENDENCIES=('sdl2-compat' 'timidity') configure() { cmake --fresh -S . -B build -G Ninja \ diff --git a/ports/SuperTux/build.sh b/ports/SuperTux/build.sh index 56d39361..fe65cb3a 100755 --- a/ports/SuperTux/build.sh +++ b/ports/SuperTux/build.sh @@ -4,7 +4,7 @@ NAME='SuperTux' VERSION='0.6.3' DOWNLOAD_URL="https://github.com/SuperTux/supertux/releases/download/v$VERSION/SuperTux-v$VERSION-Source.tar.gz#f7940e6009c40226eb34ebab8ffb0e3a894892d891a07b35d0e5762dd41c79f6" TAR_CONTENT="SuperTux-v$VERSION-Source" -DEPENDENCIES=('boost' 'SDL2' 'SDL2_image' 'curl' 'openal-soft' 'libvorbis' 'freetype' 'physfs' 'glm') +DEPENDENCIES=('boost' 'sdl2-compat' 'SDL2_image' 'curl' 'openal-soft' 'libvorbis' 'freetype' 'physfs' 'glm') configure() { cmake --fresh -B build -S . -G Ninja \ diff --git a/ports/SuperTux/patches/0001-fix-cmake.patch b/ports/SuperTux/patches/0001-fix-cmake.patch index 1b962263..d902cae7 100644 --- a/ports/SuperTux/patches/0001-fix-cmake.patch +++ b/ports/SuperTux/patches/0001-fix-cmake.patch @@ -1,6 +1,5 @@ -diff -ruN SuperTux-0.6.3/CMakeLists.txt SuperTux-0.6.3-banan_os/CMakeLists.txt ---- SuperTux-0.6.3/CMakeLists.txt 2021-12-23 01:01:57.000000000 +0200 -+++ SuperTux-0.6.3-banan_os/CMakeLists.txt 2025-11-02 20:57:03.725932455 +0200 +--- SuperTux-0.6.3/CMakeLists.txt 2021-12-23 01:01:57.000000000 +0200 ++++ SuperTux-0.6.3-x86_64/CMakeLists.txt 2026-07-04 22:00:48.125314950 +0300 @@ -171,7 +171,7 @@ else(ENABLE_BOOST_STATIC_LIBS) set(Boost_USE_STATIC_LIBS FALSE) @@ -18,35 +17,16 @@ diff -ruN SuperTux-0.6.3/CMakeLists.txt SuperTux-0.6.3-banan_os/CMakeLists.txt -DINSTALL_INC_DIR=include -DCMAKE_POSITION_INDEPENDENT_CODE=ON) -@@ -966,7 +967,7 @@ - endif() - endif() - target_include_directories(supertux2_lib SYSTEM PUBLIC ${SDL_TTF_PREFIX}/include/SDL2) --target_link_libraries(supertux2_lib PUBLIC SDL_ttf_lib) -+target_link_libraries(supertux2_lib PUBLIC libSDL2_ttf.a) - if(VCPKG_BUILD) - target_link_libraries(supertux2_lib PUBLIC freetype) - else() -@@ -977,9 +978,10 @@ - target_link_libraries(supertux2_lib PUBLIC ${HARFBUZZ_LIBRARY} ${FRIBIDI_LIBRARY} ${RAQM_LIBRARY}) - endif() +@@ -1022,11 +1023,7 @@ --target_link_libraries(supertux2_lib PUBLIC squirrel_lib) --target_link_libraries(supertux2_lib PUBLIC sqstdlib_lib) --target_link_libraries(supertux2_lib PUBLIC tinygettext_lib) -+target_link_libraries(supertux2_lib PUBLIC libsquirrel_static.a) -+target_link_libraries(supertux2_lib PUBLIC libsqstdlib_static.a) -+target_link_libraries(supertux2_lib PUBLIC libtinygettext.a) -+ - target_link_libraries(supertux2_lib PUBLIC sexp) - target_link_libraries(supertux2_lib PUBLIC savepng) - target_link_libraries(supertux2_lib PUBLIC partio_zip_lib) -@@ -1025,7 +1027,7 @@ - if(VCPKG_BUILD) - target_link_libraries(supertux2_lib PUBLIC ${CURL_LIBRARIES}) - else() + if(NOT EMSCRIPTEN) + if(HAVE_LIBCURL) +- if(VCPKG_BUILD) +- target_link_libraries(supertux2_lib PUBLIC ${CURL_LIBRARIES}) +- else() - target_link_libraries(supertux2_lib PUBLIC ${CURL_LIBRARY}) -+ target_link_libraries(supertux2_lib PUBLIC ${CURL_LIBRARY} ssl crypto zstd z) - endif() +- endif() ++ target_link_libraries(supertux2_lib PUBLIC ${CURL_LIBRARIES}) endif(HAVE_LIBCURL) endif(NOT EMSCRIPTEN) + diff --git a/ports/SuperTuxKart/build.sh b/ports/SuperTuxKart/build.sh index 0602311b..a391ee1d 100755 --- a/ports/SuperTuxKart/build.sh +++ b/ports/SuperTuxKart/build.sh @@ -4,7 +4,7 @@ NAME='SuperTuxKart' VERSION='1.5' DOWNLOAD_URL="https://github.com/supertuxkart/stk-code/releases/download/$VERSION/SuperTuxKart-$VERSION-src.tar.gz#33cf8841e4ff4082d80b9248014295bbbea61d14683e86dff100e3ab8f7b27cb" TAR_CONTENT="SuperTuxKart-$VERSION-src" -DEPENDENCIES=('SDL2' 'curl' 'openal-soft' 'freetype' 'harfbuzz' 'libvorbis' 'libjpeg' 'libpng' 'zlib') +DEPENDENCIES=('sdl2-compat' 'curl' 'openal-soft' 'freetype' 'harfbuzz' 'libvorbis' 'libjpeg' 'libpng' 'zlib') configure() { cmake --fresh -B build -S . -G Ninja \ diff --git a/ports/bochs/build.sh b/ports/bochs/build.sh index 9aafe6c7..f471e664 100755 --- a/ports/bochs/build.sh +++ b/ports/bochs/build.sh @@ -3,7 +3,7 @@ NAME='bochs' VERSION='3.0' DOWNLOAD_URL="https://sourceforge.net/projects/bochs/files/bochs/$VERSION/bochs-$VERSION.tar.gz#cb6f542b51f35a2cc9206b2a980db5602b7cd1b7cf2e4ed4f116acd5507781aa" -DEPENDENCIES=('SDL2') +DEPENDENCIES=('sdl2-compat') CONFIG_SUB=('config.sub') CONFIGURE_OPTIONS=( '--with-sdl2' diff --git a/ports/doom/build.sh b/ports/doom/build.sh index 45c737b9..8fb1bc6e 100755 --- a/ports/doom/build.sh +++ b/ports/doom/build.sh @@ -3,7 +3,7 @@ NAME='doom' VERSION='git' DOWNLOAD_URL="https://github.com/ozkl/doomgeneric.git#5041246e859052e2e258ca6edb4e1e9bbd98fcf5" -DEPENDENCIES=('SDL2' 'SDL2_mixer' 'timidity') +DEPENDENCIES=('sdl2-compat' 'SDL2_mixer' 'timidity') configure() { rm -rf doomgeneric/build diff --git a/ports/ffmpeg/build.sh b/ports/ffmpeg/build.sh index 024e1c49..d88a5e33 100755 --- a/ports/ffmpeg/build.sh +++ b/ports/ffmpeg/build.sh @@ -3,7 +3,7 @@ NAME='ffmpeg' VERSION='8.0.1' DOWNLOAD_URL="https://ffmpeg.org/releases/ffmpeg-$VERSION.tar.xz#05ee0b03119b45c0bdb4df654b96802e909e0a752f72e4fe3794f487229e5a41" -DEPENDENCIES=('SDL2' 'openssl') +DEPENDENCIES=('sdl2-compat' 'openssl') CONFIGURE_OPTIONS=( '--prefix=/usr' '--target-os=none' diff --git a/ports/qemu/build.sh b/ports/qemu/build.sh index 48651963..78ded24e 100755 --- a/ports/qemu/build.sh +++ b/ports/qemu/build.sh @@ -3,7 +3,7 @@ NAME='qemu' VERSION='10.0.2' DOWNLOAD_URL="https://download.qemu.org/qemu-$VERSION.tar.xz#ef786f2398cb5184600f69aef4d5d691efd44576a3cff4126d38d4c6fec87759" -DEPENDENCIES=('glib' 'SDL2') +DEPENDENCIES=('glib' 'sdl2-compat') MAKE_BUILD_TARGETS=('qemu-system-x86_64') CONFIGURE_OPTIONS=( '--cross-prefix=' diff --git a/ports/quake2/build.sh b/ports/quake2/build.sh index 2e9cfb35..995a28f8 100755 --- a/ports/quake2/build.sh +++ b/ports/quake2/build.sh @@ -3,7 +3,7 @@ NAME='quake2' VERSION='git' DOWNLOAD_URL="https://github.com/ozkl/quake2generic.git#50190797664fd42fc1b0266150c54f76f92bfa15" -DEPENDENCIES=('SDL2' 'SDL2_mixer') +DEPENDENCIES=('sdl2-compat' 'SDL2_mixer') configure() { make clean @@ -26,8 +26,8 @@ build() { exit 1 fi - cflags='-Dstricmp=strcasecmp -Wno-incompatible-pointer-types' - make CC="$CC" BASE_CFLAGS="$cflags" SDL_PATH="$BANAN_SYSROOT/usr/bin/" -j$(nproc) || exit 1 + cflags='-Dstricmp=strcasecmp -O3 -ffast-math -Wno-incompatible-pointer-types -Wno-pointer-to-int-cast' + make CC="$CC" CFLAGS="$cflags" SDL_PATH="$BANAN_SYSROOT/usr/bin/" -j$(nproc) createdirs build/quake2-soft || exit 1 } install() { diff --git a/ports/sdl12-compat/build.sh b/ports/sdl12-compat/build.sh index f3af24e3..3ee7f8d9 100755 --- a/ports/sdl12-compat/build.sh +++ b/ports/sdl12-compat/build.sh @@ -1,18 +1,17 @@ #!/bin/bash ../install.sh NAME='sdl12-compat' -VERSION='1.2.68' -DOWNLOAD_URL="https://github.com/libsdl-org/sdl12-compat/archive/refs/tags/release-$VERSION.tar.gz#63c6e4dcc1154299e6f363c872900be7f3dcb3e42b9f8f57e05442ec3d89d02d" +VERSION='1.2.76' +DOWNLOAD_URL="https://github.com/libsdl-org/sdl12-compat/archive/refs/tags/release-$VERSION.tar.gz#e889ac9c7e8a6bdfc31972bf1f1254b84882cb52931608bada62e8febbf0270b" TAR_CONTENT="sdl12-compat-release-$VERSION" -DEPENDENCIES=('SDL2' 'glu') +DEPENDENCIES=('sdl2-compat') configure() { - sed -i 's/CMAKE_INSTALL_FULL_DATAROOTDIR/CMAKE_INSTALL_FULL_DATADIR/' CMakeLists.txt - - cmake --fresh -B build -S . -G Ninja \ + cmake --fresh -S . -B build -G Ninja \ --toolchain="$BANAN_TOOLCHAIN_DIR/Toolchain.txt" \ - -DCMAKE_INSTALL_PREFIX="$BANAN_SYSROOT/usr" \ - -DSDL2_INCLUDE_DIR="$BANAN_SYSROOT/usr/include/SDL2" + -DCMAKE_INSTALL_PREFIX='/usr' \ + -DCMAKE_BUILD_TYPE=Release \ + || exit 1 } build() { @@ -21,4 +20,5 @@ build() { install() { DESTDIR="$DESTDIR" cmake --install build || exit 1 + ln -s sdl12_compat.pc "$DESTDIR"/usr/lib/pkgconfig/sdl.pc || exit 1 } diff --git a/ports/sdl12-compat/patches/0001-add-alloca-h-for-banan-os.patch b/ports/sdl12-compat/patches/0001-add-alloca-h-for-banan-os.patch deleted file mode 100644 index 9ef163d0..00000000 --- a/ports/sdl12-compat/patches/0001-add-alloca-h-for-banan-os.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ruN sdl12-compat-1.2.68/include/SDL/SDL_config.h sdl12-compat-1.2.68-banan_os/include/SDL/SDL_config.h ---- sdl12-compat-1.2.68/include/SDL/SDL_config.h 2023-09-26 20:43:48.000000000 +0300 -+++ sdl12-compat-1.2.68-banan_os/include/SDL/SDL_config.h 2025-11-16 03:22:39.015867984 +0200 -@@ -73,7 +73,7 @@ - #define HAVE_MATH_H 1 - #endif - --#if defined(__linux__) || defined(__sun) -+#if defined(__linux__) || defined(__sun) || defined(__banan_os__) - #define HAVE_ALLOCA_H 1 - #endif - diff --git a/ports/sdl12-compat/patches/0001-fix-sdl-config-for-cross-compilation.patch b/ports/sdl12-compat/patches/0001-fix-sdl-config-for-cross-compilation.patch new file mode 100644 index 00000000..6d575728 --- /dev/null +++ b/ports/sdl12-compat/patches/0001-fix-sdl-config-for-cross-compilation.patch @@ -0,0 +1,21 @@ +diff -ruN sdl12-compat-1.2.76/sdl-config.in sdl12-compat-1.2.76-banan_os/sdl-config.in +--- sdl12-compat-1.2.76/sdl-config.in 2026-04-04 03:40:25.000000000 +0300 ++++ sdl12-compat-1.2.76-banan_os/sdl-config.in 2026-07-04 09:10:44.224259068 +0300 +@@ -7,11 +7,14 @@ + + # Copied and modified from SDL2's sdl2-compat. + +-prefix=@CMAKE_INSTALL_PREFIX@ ++# Get the canonical path of the folder containing this script ++bindir=`cd -P -- "\`dirname -- "$0"\`" && printf '%s\n' "\`pwd -P\`"` ++ ++prefix=`cd -P -- "$bindir/.." && printf '%s\n' "\`pwd -P\`"` + exec_prefix=${prefix} + exec_prefix_set=no +-libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +-includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ ++libdir=$prefix/lib ++includedir=$prefix/include + + @ENABLE_STATIC_FALSE@usage="\ + @ENABLE_STATIC_FALSE@Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" diff --git a/ports/sdl12-compat/patches/0002-add-OS_GetExeName.patch b/ports/sdl12-compat/patches/0002-add-OS_GetExeName.patch new file mode 100644 index 00000000..941d7847 --- /dev/null +++ b/ports/sdl12-compat/patches/0002-add-OS_GetExeName.patch @@ -0,0 +1,21 @@ +diff -ruN sdl12-compat-1.2.76/src/SDL12_compat.c sdl12-compat-1.2.76-banan_os/src/SDL12_compat.c +--- sdl12-compat-1.2.76/src/SDL12_compat.c 2026-04-04 03:40:25.000000000 +0300 ++++ sdl12-compat-1.2.76-banan_os/src/SDL12_compat.c 2026-07-04 09:13:14.105336073 +0300 +@@ -57,7 +57,7 @@ + #undef snprintf + #undef vsnprintf + +-#ifdef __linux__ ++#if defined(__linux__) || defined(__banan_os__) + #include /* for readlink() */ + #endif + +@@ -1486,7 +1486,7 @@ + #endif + }; + +-#ifdef __linux__ ++#if defined(__linux__) || defined(__banan_os__) + static void OS_GetExeName(char *buf, const unsigned maxpath) { + int ret; + buf[0] = '\0'; diff --git a/ports/sdl12-compat/patches/0003-define-HAVE_ALLOCA_H.patch b/ports/sdl12-compat/patches/0003-define-HAVE_ALLOCA_H.patch new file mode 100644 index 00000000..ec72d2e1 --- /dev/null +++ b/ports/sdl12-compat/patches/0003-define-HAVE_ALLOCA_H.patch @@ -0,0 +1,12 @@ +diff -ruN sdl12-compat-1.2.76/include/SDL/SDL_config.h sdl12-compat-1.2.76-banan_os/include/SDL/SDL_config.h +--- sdl12-compat-1.2.76/include/SDL/SDL_config.h 2026-04-04 03:40:25.000000000 +0300 ++++ sdl12-compat-1.2.76-banan_os/include/SDL/SDL_config.h 2026-07-04 09:21:56.688337719 +0300 +@@ -73,7 +73,7 @@ + #define HAVE_MATH_H 1 + #endif + +-#if defined(__linux__) || defined(__sun) ++#if defined(__linux__) || defined(__sun) || defined(__banan_os__) + #define HAVE_ALLOCA_H 1 + #endif + diff --git a/ports/sdl2-compat/build.sh b/ports/sdl2-compat/build.sh new file mode 100755 index 00000000..6edf3f90 --- /dev/null +++ b/ports/sdl2-compat/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash ../install.sh + +NAME='sdl2-compat' +VERSION='2.32.70' +DOWNLOAD_URL="https://github.com/libsdl-org/sdl2-compat/releases/download/release-$VERSION/sdl2-compat-$VERSION.tar.gz#998fa62557eb46ffe7e5c3e2c123bc332f7df9d9f593b3ceed88ed1158428a44" +DEPENDENCIES=('SDL3') + +configure() { + cmake --fresh -S . -B build -G Ninja \ + --toolchain="$BANAN_TOOLCHAIN_DIR/Toolchain.txt" \ + -DCMAKE_INSTALL_PREFIX='/usr' \ + -DCMAKE_BUILD_TYPE=Release \ + -DSDL2COMPAT_X11=OFF \ + || exit 1 +} + +build() { + cmake --build build || exit 1 +} + +install() { + DESTDIR="$DESTDIR" cmake --install build || exit 1 + ln -s sdl2-compat.pc "$DESTDIR"/usr/lib/pkgconfig/sdl2.pc || exit 1 +} diff --git a/ports/sdl2-compat/patches/0001-fix-sdl2-config-for-cross-compilation.patch b/ports/sdl2-compat/patches/0001-fix-sdl2-config-for-cross-compilation.patch new file mode 100644 index 00000000..fecba9eb --- /dev/null +++ b/ports/sdl2-compat/patches/0001-fix-sdl2-config-for-cross-compilation.patch @@ -0,0 +1,21 @@ +diff -ruN sdl2-compat-2.32.70/sdl2-config.in sdl2-compat-2.32.70-banan_os/sdl2-config.in +--- sdl2-compat-2.32.70/sdl2-config.in 2023-07-26 08:40:50.000000000 +0300 ++++ sdl2-compat-2.32.70-banan_os/sdl2-config.in 2026-07-04 00:30:22.699878722 +0300 +@@ -7,11 +7,14 @@ + + # Copied and modified from SDL2's sdl2-compat. + +-prefix=@CMAKE_INSTALL_PREFIX@ ++# Get the canonical path of the folder containing this script ++bindir=`cd -P -- "\`dirname -- "$0"\`" && printf '%s\n' "\`pwd -P\`"` ++ ++prefix=`cd -P -- "$bindir/.." && printf '%s\n' "\`pwd -P\`"` + exec_prefix=${prefix} + exec_prefix_set=no +-libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +-includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ ++libdir=$prefix/lib ++includedir=$prefix/include + + @ENABLE_STATIC_FALSE@usage="\ + @ENABLE_STATIC_FALSE@Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" diff --git a/ports/sdl2-compat/patches/0002-add-OS_GetExeName.patch b/ports/sdl2-compat/patches/0002-add-OS_GetExeName.patch new file mode 100644 index 00000000..cefc0dbd --- /dev/null +++ b/ports/sdl2-compat/patches/0002-add-OS_GetExeName.patch @@ -0,0 +1,21 @@ +diff -ruN sdl2-compat-2.32.70/src/sdl2_compat.c sdl2-compat-2.32.70-banan_os/src/sdl2_compat.c +--- sdl2-compat-2.32.70/src/sdl2_compat.c 2026-06-08 18:01:06.000000000 +0300 ++++ sdl2-compat-2.32.70-banan_os/src/sdl2_compat.c 2026-07-04 00:34:09.939149767 +0300 +@@ -96,7 +96,7 @@ + #undef snprintf + #undef vsnprintf + +-#if defined(__linux__) || defined(__GNU__) ++#if defined(__linux__) || defined(__GNU__) || defined(__banan_os__) + #include /* for readlink() */ + #endif + +@@ -546,7 +546,7 @@ + #endif + }; + +-#if defined(__linux__) || defined(__GNU__) ++#if defined(__linux__) || defined(__GNU__) || defined(__banan_os__) + static void OS_GetExeName(char *buf, const unsigned maxpath, bool *use_base_path) + { + int ret; diff --git a/ports/tinygb/build.sh b/ports/tinygb/build.sh index 7880543e..f229fbe8 100755 --- a/ports/tinygb/build.sh +++ b/ports/tinygb/build.sh @@ -3,7 +3,7 @@ NAME='tinygb' VERSION='git' DOWNLOAD_URL="https://github.com/jewelcodes/tinygb.git#57fdaff675a6b5b963b2b6624868d9698eabe375" -DEPENDENCIES=('SDL2') +DEPENDENCIES=('sdl2-compat') configure() { sed -i "s|shell sdl2-config|shell $BANAN_SYSROOT/usr/bin/sdl2-config|g" Makefile diff --git a/ports/xash3d-fwgs/build.sh b/ports/xash3d-fwgs/build.sh index bef512f9..dd67d55b 100755 --- a/ports/xash3d-fwgs/build.sh +++ b/ports/xash3d-fwgs/build.sh @@ -3,7 +3,7 @@ NAME='xash3d-fwgs' VERSION='git' DOWNLOAD_URL="https://github.com/FWGS/xash3d-fwgs.git#da1b9ad80d76156a5cbd54d3ce87edb32634ea87" -DEPENDENCIES=('SDL2' 'freetype' 'bzip2' 'libvorbis') +DEPENDENCIES=('sdl2-compat' 'freetype' 'bzip2' 'libvorbis') configure() { git submodule update --init --recursive || exit 1 @@ -22,12 +22,12 @@ build() { } install() { - ./waf install --destdir="$DESTDIR/usr/share/games/halflife" || exit 1 + ./waf install --destdir="$DESTDIR/home/user/halflife" || exit 1 cat > "$DESTDIR/home/user/halflife/start.sh" << EOF #!/bin/Shell export LD_LIBRARY_PATH=/home/user/halflife -./xash3d -console +exec /home/user/halflife/xash3d -console EOF - chmod +x $DESTDIR/home/user/halflife/start.sh + chmod +x "$DESTDIR/home/user/halflife/start.sh" }