gzdoom: only build for 64-bit architectures
authorDaniel Golle <daniel@makrotopia.org>
Sun, 8 Dec 2024 20:11:39 +0000 (20:11 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 9 Dec 2024 03:33:13 +0000 (03:33 +0000)
Only LP64/LLP64 builds are officially supported. Please do not attempt
to build for other platforms; even if the program succeeds in a MAP01
smoke test, there are e.g. known visual artifacts that lead to a bad
user experience.

Still allow build on 32-bit platforms in case BROKEN is selected, so
users can try if it would work on their system as forum claims a fix
had actually been applied long ago.

Link: https://forum.zdoom.org/viewtopic.php?f=7&t=75673
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
games/gzdoom/Makefile
games/gzdoom/patches/0002-fix-musl-fts.patch [deleted file]
games/gzdoom/patches/0003-define-cpu_set_t.patch [deleted file]
games/gzdoom/patches/002-fix-musl-fts.patch [new file with mode: 0644]
games/gzdoom/patches/003-define-cpu_set_t.patch [new file with mode: 0644]
games/gzdoom/patches/130-no-execinfo.patch [new file with mode: 0644]
games/gzdoom/patches/998-fix-vulkan-on-32-bit-platforms [new file with mode: 0644]
games/gzdoom/patches/999-remove-64bit-assertion.patch [new file with mode: 0644]
games/gzdoom/patches/no-execinfo.patch [deleted file]

index ae05680d9104db25aeb48d5bda214390a7f40280..5b8160bf453a957be8e7722037df1220c3d7fb8c 100644 (file)
@@ -17,6 +17,7 @@ PKG_LICENSE_FILES:=COPYING LICENSE
 
 CMAKE_INSTALL:=1
 PKG_BUILD_DEPENDS:=gzdoom/host vulkan-loader
+PKG_BUILD_FLAGS:=no-mips16
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/host-build.mk
@@ -32,12 +33,14 @@ CMAKE_OPTIONS += \
        -DVULKAN_USE_XLIB=OFF \
        -DVULKAN_USE_WAYLAND=ON
 
+TARGET_LDFLAGS += -latomic
+
 define Package/gzdoom
   SECTION:=games
   CATEGORY:=Games
   TITLE:=GZDoom
   URL:=https://zdoom.org/
-  DEPENDS:=+alsa-lib +glib2 +libbz2 +libstdcpp +libzmusic +libvpx +libsdl2 +USE_MUSL:musl-fts
+  DEPENDS:=+alsa-lib +glib2 +libatomic +libbz2 +libstdcpp +libzmusic +libvpx +libsdl2 +USE_MUSL:musl-fts @(ARCH_64BIT||BROKEN)
 endef
 
 define Package/gzdoom/description
diff --git a/games/gzdoom/patches/0002-fix-musl-fts.patch b/games/gzdoom/patches/0002-fix-musl-fts.patch
deleted file mode 100644 (file)
index 111ca87..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -291,6 +291,7 @@ else()
-               if ( NOT HAVE_FTS )
-                       include ( FindPkgConfig )
-                       pkg_check_modules( MUSL_FTS musl-fts )
-+                      string(REPLACE ";" " " MUSL_FTS_LDFLAGS "${MUSL_FTS_LDFLAGS}")
-                       if ( MUSL_FTS_FOUND )
-                               set ( ALL_C_FLAGS "${ALL_C_FLAGS} ${MUSL_FTS_LDFLAGS}" )
-                       else ( MUSL_FTS_FOUND )
diff --git a/games/gzdoom/patches/0003-define-cpu_set_t.patch b/games/gzdoom/patches/0003-define-cpu_set_t.patch
deleted file mode 100644 (file)
index ba6048e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-From https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/35711#note_243863
-_GNU_SOURCE is needed for cpu_set_t, and affinity disable is needed to work around lack of pthread_attr_setaffinity_np
---- a/libraries/lzma/CMakeLists.txt
-+++ b/libraries/lzma/CMakeLists.txt
-@@ -1,6 +1,6 @@
- make_release_only()
--set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DZ7_PPMD_SUPPORT" )
-+set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DZ7_PPMD_SUPPORT -DZ7_AFFINITY_DISABLE" )
- find_package(Threads)
diff --git a/games/gzdoom/patches/002-fix-musl-fts.patch b/games/gzdoom/patches/002-fix-musl-fts.patch
new file mode 100644 (file)
index 0000000..111ca87
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -291,6 +291,7 @@ else()
+               if ( NOT HAVE_FTS )
+                       include ( FindPkgConfig )
+                       pkg_check_modules( MUSL_FTS musl-fts )
++                      string(REPLACE ";" " " MUSL_FTS_LDFLAGS "${MUSL_FTS_LDFLAGS}")
+                       if ( MUSL_FTS_FOUND )
+                               set ( ALL_C_FLAGS "${ALL_C_FLAGS} ${MUSL_FTS_LDFLAGS}" )
+                       else ( MUSL_FTS_FOUND )
diff --git a/games/gzdoom/patches/003-define-cpu_set_t.patch b/games/gzdoom/patches/003-define-cpu_set_t.patch
new file mode 100644 (file)
index 0000000..ba6048e
--- /dev/null
@@ -0,0 +1,12 @@
+From https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/35711#note_243863
+_GNU_SOURCE is needed for cpu_set_t, and affinity disable is needed to work around lack of pthread_attr_setaffinity_np
+--- a/libraries/lzma/CMakeLists.txt
++++ b/libraries/lzma/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ make_release_only()
+-set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DZ7_PPMD_SUPPORT" )
++set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -DZ7_PPMD_SUPPORT -DZ7_AFFINITY_DISABLE" )
+ find_package(Threads)
diff --git a/games/gzdoom/patches/130-no-execinfo.patch b/games/gzdoom/patches/130-no-execinfo.patch
new file mode 100644 (file)
index 0000000..1e7ad64
--- /dev/null
@@ -0,0 +1,49 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -358,7 +358,7 @@ if( HAVE_VM_JIT AND UNIX )
+               if( HAVE_LIBEXECINFO )
+                       set( ALL_C_FLAGS "${ALL_C_FLAGS} -lexecinfo" )
+               else( HAVE_LIBEXECINFO )
+-                      set( HAVE_VM_JIT NO )
++                      #       set( HAVE_VM_JIT NO )
+               endif( HAVE_LIBEXECINFO )
+               set( CMAKE_REQUIRED_FLAGS )
+       endif( NOT HAVE_BACKTRACE )
+--- a/src/common/scripting/jit/jit_runtime.cpp
++++ b/src/common/scripting/jit/jit_runtime.cpp
+@@ -7,7 +7,6 @@
+ #include <DbgHelp.h>
+ #include <psapi.h>
+ #else
+-#include <execinfo.h>
+ #include <cxxabi.h>
+ #include <cstring>
+ #include <cstdlib>
+@@ -806,7 +805,7 @@ static int CaptureStackTrace(int max_fra
+       // JIT isn't supported here, so just do nothing.
+       return 0;//return RtlCaptureStackBackTrace(0, min(max_frames, 32), out_frames, nullptr);
+ #else
+-      return backtrace(out_frames, max_frames);
++      return 0;
+ #endif
+ }
+@@ -868,7 +867,9 @@ class NativeSymbolResolver
+ public:
+       FString GetName(void *frame)
+       {
+-              FString s;
++              FString s = "no backtrace";
++              return s;
++              #if 0
+               char **strings;
+               void *frames[1] = { frame };
+               strings = backtrace_symbols(frames, 1);
+@@ -925,6 +926,7 @@ public:
+               free(strings);
+               return s;
++              #endif
+       }
+ };
+ #endif
diff --git a/games/gzdoom/patches/998-fix-vulkan-on-32-bit-platforms b/games/gzdoom/patches/998-fix-vulkan-on-32-bit-platforms
new file mode 100644 (file)
index 0000000..80921fd
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/common/platform/posix/sdl/sdlglvideo.cpp
++++ b/src/common/platform/posix/sdl/sdlglvideo.cpp
+@@ -400,7 +400,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffe
+                               builder.RequireExtension(names[i]);
+                       auto instance = builder.Create();
+-                      VkSurfaceKHR surfacehandle = nullptr;
++                      VkSurfaceKHR surfacehandle = (VkSurfaceKHR)nullptr;
+                       if (!I_CreateVulkanSurface(instance->Instance, &surfacehandle))
+                               VulkanError("I_CreateVulkanSurface failed");
diff --git a/games/gzdoom/patches/999-remove-64bit-assertion.patch b/games/gzdoom/patches/999-remove-64bit-assertion.patch
new file mode 100644 (file)
index 0000000..c1535bf
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/src/common/engine/i_interface.cpp
++++ b/src/common/engine/i_interface.cpp
+@@ -6,13 +6,13 @@
+ #include "gstrings.h"
+ #include "version.h"
+-static_assert(sizeof(void*) == 8,
+-      "Only LP64/LLP64 builds are officially supported. "
+-      "Please do not attempt to build for other platforms; "
+-      "even if the program succeeds in a MAP01 smoke test, "
+-      "there are e.g. known visual artifacts "
+-      "<https://forum.zdoom.org/viewtopic.php?f=7&t=75673> "
+-      "that lead to a bad user experience.");
++//static_assert(sizeof(void*) == 8,
++//    "Only LP64/LLP64 builds are officially supported. "
++//    "Please do not attempt to build for other platforms; "
++//    "even if the program succeeds in a MAP01 smoke test, "
++//    "there are e.g. known visual artifacts "
++//    "<https://forum.zdoom.org/viewtopic.php?f=7&t=75673> "
++//    "that lead to a bad user experience.");
+ // Some global engine variables taken out of the backend code.
+ FStartupScreen* StartWindow;
diff --git a/games/gzdoom/patches/no-execinfo.patch b/games/gzdoom/patches/no-execinfo.patch
deleted file mode 100644 (file)
index 1e7ad64..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -358,7 +358,7 @@ if( HAVE_VM_JIT AND UNIX )
-               if( HAVE_LIBEXECINFO )
-                       set( ALL_C_FLAGS "${ALL_C_FLAGS} -lexecinfo" )
-               else( HAVE_LIBEXECINFO )
--                      set( HAVE_VM_JIT NO )
-+                      #       set( HAVE_VM_JIT NO )
-               endif( HAVE_LIBEXECINFO )
-               set( CMAKE_REQUIRED_FLAGS )
-       endif( NOT HAVE_BACKTRACE )
---- a/src/common/scripting/jit/jit_runtime.cpp
-+++ b/src/common/scripting/jit/jit_runtime.cpp
-@@ -7,7 +7,6 @@
- #include <DbgHelp.h>
- #include <psapi.h>
- #else
--#include <execinfo.h>
- #include <cxxabi.h>
- #include <cstring>
- #include <cstdlib>
-@@ -806,7 +805,7 @@ static int CaptureStackTrace(int max_fra
-       // JIT isn't supported here, so just do nothing.
-       return 0;//return RtlCaptureStackBackTrace(0, min(max_frames, 32), out_frames, nullptr);
- #else
--      return backtrace(out_frames, max_frames);
-+      return 0;
- #endif
- }
-@@ -868,7 +867,9 @@ class NativeSymbolResolver
- public:
-       FString GetName(void *frame)
-       {
--              FString s;
-+              FString s = "no backtrace";
-+              return s;
-+              #if 0
-               char **strings;
-               void *frames[1] = { frame };
-               strings = backtrace_symbols(frames, 1);
-@@ -925,6 +926,7 @@ public:
-               free(strings);
-               return s;
-+              #endif
-       }
- };
- #endif