diff --git a/Ports/gltron/package.sh b/Ports/gltron/package.sh index 29a84f45017..e3e1c4cc3a4 100755 --- a/Ports/gltron/package.sh +++ b/Ports/gltron/package.sh @@ -1,28 +1,18 @@ #!/usr/bin/env -S bash ../.port_include.sh -port=gltron -useconfigure="true" -use_fresh_config_sub=true -version="0.70" -files="http://mirror.sobukus.de/files/grimoire/games-arcade-2d/gltron-${version}-source.tar.gz gltron-${version}-source.tar.gz e0c8ebb41a18a1f8d7302a9c2cb466f5b1dd63e9a9966c769075e6b6bdad8bb0" -auth_type=sha256 -depends=("libpng" "SDL2_sound" "SDL2" "zlib") +port='gltron' +useconfigure='true' +use_fresh_config_sub='true' +version='0.70' +files="http://mirror.sobukus.de/files/grimoire/games-arcade-2d/gltron-${version}-source.tar.gz gltron-${version}.tar.gz e0c8ebb41a18a1f8d7302a9c2cb466f5b1dd63e9a9966c769075e6b6bdad8bb0" +auth_type='sha256' +depends=("libpng" "glu" "SDL_sound" "sdl12-compat" "zlib") configopts=( "--disable-warn" + "--with-sdl-prefix=${SERENITY_INSTALL_ROOT}/usr/local" + "CPPFLAGS=-I${SERENITY_INSTALL_ROOT}/usr/include/LibGL" + "LIBS=-lm -lSDL_sound" ) - -launcher_name="GLTron" -launcher_category="Games" -launcher_command="/usr/local/bin/gltron" -icon_file="art/default/gltron.png" - -pre_configure() { - export CPPFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/include/LibGL -I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2" - export LIBS="-lSDL2_sound" - export SDL_CONFIG="${SERENITY_INSTALL_ROOT}/usr/local/bin/sdl2-config" -} - -post_configure() { - unset CPPFLAGS - unset LIBS - unset SDL_CONFIG -} +launcher_name='GLTron' +launcher_category='Games' +launcher_command='/usr/local/bin/gltron' +icon_file='art/default/gltron.png' diff --git a/Ports/gltron/patches/0001-Build-Allow-CFLAGS-env-var-to-be-set.patch b/Ports/gltron/patches/0001-Build-Allow-CFLAGS-env-var-to-be-set.patch deleted file mode 100644 index 3b776b5c30e..00000000000 --- a/Ports/gltron/patches/0001-Build-Allow-CFLAGS-env-var-to-be-set.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jelle Raaijmakers -Date: Mon, 9 May 2022 00:29:43 +0200 -Subject: [PATCH] Build: Allow `CFLAGS` env var to be set - ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure b/configure -index 226d00e..05ebf5d 100755 ---- a/configure -+++ b/configure -@@ -2805,7 +2805,7 @@ else - RANLIB="$ac_cv_prog_RANLIB" - fi - --CFLAGS="-DSEPARATOR=\"'/'\"" -+CFLAGS="$CFLAGS -DSEPARATOR=\"'/'\"" - - # Check whether --enable-warn or --disable-warn was given. - if test "${enable_warn+set}" = set; then diff --git a/Ports/gltron/patches/0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch b/Ports/gltron/patches/0001-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch similarity index 96% rename from Ports/gltron/patches/0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch rename to Ports/gltron/patches/0001-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch index 6f13fba93e1..a994dfcc5a8 100644 --- a/Ports/gltron/patches/0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch +++ b/Ports/gltron/patches/0001-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch @@ -8,7 +8,7 @@ Subject: [PATCH] Build: Replace `-lGL` with `-lgl` to reference our LibGL 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure -index 05ebf5d..10f771f 100755 +index 226d00e..086139a 100755 --- a/configure +++ b/configure @@ -3130,7 +3130,7 @@ if test "${ac_cv_lib_GL_main+set}" = set; then diff --git a/Ports/gltron/patches/0003-Build-Remove-ansi-build-argument.patch b/Ports/gltron/patches/0002-Build-Remove-ansi-build-argument.patch similarity index 100% rename from Ports/gltron/patches/0003-Build-Remove-ansi-build-argument.patch rename to Ports/gltron/patches/0002-Build-Remove-ansi-build-argument.patch diff --git a/Ports/gltron/patches/0004-Build-Fix-char-vs.-const-char-arguments.patch b/Ports/gltron/patches/0003-Build-Fix-char-vs.-const-char-arguments.patch similarity index 100% rename from Ports/gltron/patches/0004-Build-Fix-char-vs.-const-char-arguments.patch rename to Ports/gltron/patches/0003-Build-Fix-char-vs.-const-char-arguments.patch diff --git a/Ports/gltron/patches/0004-Build-Disable-nebu-using-SDL-s-glext.h-constants.patch b/Ports/gltron/patches/0004-Build-Disable-nebu-using-SDL-s-glext.h-constants.patch new file mode 100644 index 00000000000..b2f6cd936c9 --- /dev/null +++ b/Ports/gltron/patches/0004-Build-Disable-nebu-using-SDL-s-glext.h-constants.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Grigoris Pavlakis +Date: Mon, 13 Jun 2022 16:04:43 +0300 +Subject: [PATCH] Build: Disable nebu using SDL's glext.h constants + +SerenityOS provides glext.h definitions inside GL/gl.h, but the +build process thinks that glext.h doesn't exist, therefore it attempts +to use SDL's definitions, which leads to a conflict. Therefore, disable +use of said definitions. +--- + nebu/include/video/nebu_renderer_gl.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/nebu/include/video/nebu_renderer_gl.h b/nebu/include/video/nebu_renderer_gl.h +index 64bf0a4..b74e3db 100644 +--- a/nebu/include/video/nebu_renderer_gl.h ++++ b/nebu/include/video/nebu_renderer_gl.h +@@ -1,6 +1,8 @@ + #ifndef NEBU_RENDERER_GL_H + #define NEBU_RENDERER_GL_H + ++#define NO_SDL_GLEXT ++ + #include "SDL_opengl.h" + #include + #include "video/nebu_quad.h" diff --git a/Ports/gltron/patches/0005-Scripting-Fix-default-keybindings.patch b/Ports/gltron/patches/0005-Scripting-Fix-default-keybindings.patch deleted file mode 100644 index d0cfef6cc71..00000000000 --- a/Ports/gltron/patches/0005-Scripting-Fix-default-keybindings.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jelle Raaijmakers -Date: Mon, 9 May 2022 00:36:08 +0200 -Subject: [PATCH] Scripting: Fix default keybindings - -These constants referred to the wrong keys. ---- - scripts/config.lua | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/scripts/config.lua b/scripts/config.lua -index 3c9e6d2..4755678 100644 ---- a/scripts/config.lua -+++ b/scripts/config.lua -@@ -90,18 +90,18 @@ settings.musicVolume = 0.5 - - settings.keys = { - { -- player 1 -- left = 97, -- lower case 'a' -- right = 115, -- lower case 's' -- glance_left = 113, -- lower case 'q' -- glance_right = 119, -- lower case 'w' -- boost = 101, -- lower case 'd' -+ left = 65, -- lower case 'a' -+ right = 83, -- lower case 's' -+ glance_left = 81, -- lower case 'q' -+ glance_right = 87, -- lower case 'w' -+ boost = 68, -- lower case 'd' - }, - { -- player 2 -- left = 106, -- lower case 'j' -- right = 107, -- lower case 'k' -- glance_left = 117, -- lower case 'u' -- glance_right = 105, -- lower case 'i' -- boost = 108, -- lower case 'l' -+ left = 74, -- lower case 'j' -+ right = 75, -- lower case 'k' -+ glance_left = 85, -- lower case 'u' -+ glance_right = 73, -- lower case 'i' -+ boost = 76, -- lower case 'l' - }, - { -- player 3 - left = 276, -- cursor left diff --git a/Ports/gltron/patches/0006-SDL-Convert-SDL1-to-SDL2.patch b/Ports/gltron/patches/0006-SDL-Convert-SDL1-to-SDL2.patch deleted file mode 100644 index 1540343571f..00000000000 --- a/Ports/gltron/patches/0006-SDL-Convert-SDL1-to-SDL2.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jelle Raaijmakers -Date: Mon, 9 May 2022 00:53:48 +0200 -Subject: [PATCH] SDL: Convert SDL1 to SDL2 - ---- - nebu/input/input_system.c | 7 ++++--- - nebu/video/video_system.c | 20 +++++++++++--------- - src/game/init_sdl.c | 1 - - 3 files changed, 15 insertions(+), 13 deletions(-) - -diff --git a/nebu/input/input_system.c b/nebu/input/input_system.c -index 5b934e2..802540a 100644 ---- a/nebu/input/input_system.c -+++ b/nebu/input/input_system.c -@@ -6,18 +6,19 @@ - #include "SDL.h" - #include - -+extern SDL_Window* window; - static float joystick_threshold = 0; - - void SystemGrabInput() { -- SDL_WM_GrabInput(SDL_GRAB_ON); -+ SDL_SetWindowGrab(window, SDL_TRUE); - } - - void SystemUngrabInput() { -- SDL_WM_GrabInput(SDL_GRAB_OFF); -+ SDL_SetWindowGrab(window, SDL_FALSE); - } - - void SystemWarpPointer(int x, int y) { -- SDL_WarpMouse(x, y); -+ SDL_WarpMouseInWindow(window, x, y); - } - - void SystemHidePointer() { -diff --git a/nebu/video/video_system.c b/nebu/video/video_system.c -index fdfcc56..9c985f8 100644 ---- a/nebu/video/video_system.c -+++ b/nebu/video/video_system.c -@@ -3,14 +3,15 @@ - #include "SDL.h" - #include "SDL_opengl.h" - --static SDL_Surface *screen; -+SDL_Window* window; -+static SDL_GLContext glcontext; - static int width, height; - static int flags; - static int fullscreen; - extern int video_initialized; - - void SystemSwapBuffers() { -- SDL_GL_SwapBuffers(); -+ SDL_GL_SwapWindow(window); - } - - void SystemInitWindow(int x, int y, int w, int h) { -@@ -50,21 +51,22 @@ void SystemInitDisplayMode(int f, unsigned char full) { - } - - void SystemSetGamma(float red, float green, float blue) { -- SDL_SetGamma(red, green, blue); -+ SDL_SetWindowBrightness(window, (red + green + blue) / 3); - } - - int SystemCreateWindow(char *name) { -- int f = SDL_OPENGL; -+ int f = SDL_WINDOW_OPENGL; - if(fullscreen & SYSTEM_FULLSCREEN) -- f |= SDL_FULLSCREEN; -- if( (screen = SDL_SetVideoMode( width, height, 0, f )) == NULL ) { -+ f |= SDL_WINDOW_FULLSCREEN; -+ if( (window = SDL_CreateWindow("GLTron", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, f )) == NULL ) { - fprintf(stderr, "[system] Couldn't set GL mode: %s\n", SDL_GetError()); - exit(1); /* OK: critical, no visual */ - } -- SDL_WM_SetCaption("GLtron", ""); -+ glcontext = SDL_GL_CreateContext(window); -+ SDL_SetWindowTitle(window, "GLtron"); - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT); -- SDL_GL_SwapBuffers(); -+ SDL_GL_SwapWindow(window); - return 1; - } - -@@ -76,7 +78,7 @@ void SystemDestroyWindow(int id) { - /* there used to be some problems (memory leaks, unprober driver unloading) - * caused by this, but I can't remember what they where - */ -- -+ SDL_GL_DeleteContext(glcontext); - SDL_QuitSubSystem(SDL_INIT_VIDEO); - video_initialized = 0; - } -diff --git a/src/game/init_sdl.c b/src/game/init_sdl.c -index bb787e5..c35eeca 100644 ---- a/src/game/init_sdl.c -+++ b/src/game/init_sdl.c -@@ -22,7 +22,6 @@ void videoInit(void) { - - void inputInit(void) { - /* keyboard */ -- SDL_EnableKeyRepeat(0, 0); /* turn keyrepeat off */ - - /* joystick */ - if(SDL_Init(SDL_INIT_JOYSTICK) >= 0) { diff --git a/Ports/gltron/patches/0007-SDL-Fix-2x-audio-rate-issue.patch b/Ports/gltron/patches/0007-SDL-Fix-2x-audio-rate-issue.patch deleted file mode 100644 index c994c4184d8..00000000000 --- a/Ports/gltron/patches/0007-SDL-Fix-2x-audio-rate-issue.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jelle Raaijmakers -Date: Mon, 9 May 2022 01:01:47 +0200 -Subject: [PATCH] SDL: Fix 2x audio rate issue - -By not passing in an `obtained` struct into `SDL_OpenAudio`, we ask SDL -to perform any sample rate and/or format conversion for us. Previously -GLTron would simply ignore the result in `obtained`, causing the audio -to be played back at 2x speed. ---- - src/audio/sound_glue.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/audio/sound_glue.cpp b/src/audio/sound_glue.cpp -index 9753f09..e08b1b3 100644 ---- a/src/audio/sound_glue.cpp -+++ b/src/audio/sound_glue.cpp -@@ -170,7 +170,7 @@ extern "C" { - - SDL_AudioSpec obtained; - -- if(SDL_OpenAudio( spec, &obtained ) != 0) { -+ if(SDL_OpenAudio( spec, nullptr ) != 0) { - fprintf(stderr, "[error] %s\n", SDL_GetError()); - sound->SetStatus(Sound::eUninitialized); - } else { diff --git a/Ports/gltron/patches/ReadMe.md b/Ports/gltron/patches/ReadMe.md index 1f3be2e61d8..857bff8f533 100644 --- a/Ports/gltron/patches/ReadMe.md +++ b/Ports/gltron/patches/ReadMe.md @@ -1,44 +1,28 @@ # Patches for gltron on SerenityOS -## `0001-Build-Allow-CFLAGS-env-var-to-be-set.patch` - -Build: Allow `CFLAGS` env var to be set - - -## `0002-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch` +## `0001-Build-Replace-lGL-with-lgl-to-reference-our-LibGL.patch` Build: Replace `-lGL` with `-lgl` to reference our LibGL -## `0003-Build-Remove-ansi-build-argument.patch` +## `0002-Build-Remove-ansi-build-argument.patch` Build: Remove `-ansi` build argument -## `0004-Build-Fix-char-vs.-const-char-arguments.patch` +## `0003-Build-Fix-char-vs.-const-char-arguments.patch` Build: Fix `char*` vs. `const char*` arguments These arguments are of the wrong constness, which will trip our compiler. -## `0005-Scripting-Fix-default-keybindings.patch` +## `0004-Build-Disable-nebu-using-SDL-s-glext.h-constants.patch` -Scripting: Fix default keybindings +Build: Disable nebu using SDL's glext.h constants -These constants referred to the wrong keys. - -## `0006-SDL-Convert-SDL1-to-SDL2.patch` - -SDL: Convert SDL1 to SDL2 - - -## `0007-SDL-Fix-2x-audio-rate-issue.patch` - -SDL: Fix 2x audio rate issue - -By not passing in an `obtained` struct into `SDL_OpenAudio`, we ask SDL -to perform any sample rate and/or format conversion for us. Previously -GLTron would simply ignore the result in `obtained`, causing the audio -to be played back at 2x speed. +SerenityOS provides glext.h definitions inside GL/gl.h, but the +build process thinks that glext.h doesn't exist, therefore it attempts +to use SDL's definitions, which leads to a conflict. Therefore, disable +use of said definitions.