diff --git a/0001-Revert-Switch-to-miniz-from-zlib.patch b/0001-Revert-Switch-to-miniz-from-zlib.patch index a285f6a..d4611bc 100644 --- a/0001-Revert-Switch-to-miniz-from-zlib.patch +++ b/0001-Revert-Switch-to-miniz-from-zlib.patch @@ -1,29 +1,33 @@ -From b0910739a3fe9ade92356f2ed510049ebbccbec9 Mon Sep 17 00:00:00 2001 -From: Jan Engelhardt +From: Jan Engelhardt Date: Fri, 27 Oct 2023 09:01:47 +0200 -Subject: [PATCH] Revert "Switch to miniz from zlib" -This reverts commit ba9ce0e83f6e25e3ddef5000bd51d53f2e3947a2. +Use system-provided zlib. Heed + +Heed +https://en.opensuse.org/openSUSE:Bundled_software_policy +https://docs.fedoraproject.org/en-US/fesco/Bundled_Software_policy/ + +(This reverts commit ba9ce0e83f6e25e3ddef5000bd51d53f2e3947a2.) + --- - CMakeLists.txt | 13 ++++++++++++- + CMakeLists.txt | 2 +- src/CMakeLists.txt | 4 ++-- src/common/audio/music/i_music.cpp | 3 ++- src/common/engine/serializer.cpp | 3 ++- src/common/filesystem/source/files_decompress.cpp | 3 ++- src/common/filesystem/source/filesystem.cpp | 3 ++- src/common/filesystem/source/resourcefile.cpp | 3 ++- - src/common/models/model.cpp | 13 +++++++++++-- + src/common/models/model.cpp | 9 +++++++-- src/common/platform/win32/i_crash.cpp | 3 ++- src/common/textures/m_png.cpp | 3 ++- - src/common/thirdparty/m_crc32.h | 6 ++++-- + src/common/thirdparty/m_crc32.h | 4 +++- src/g_pch.h | 3 ++- src/g_pch2.h | 3 ++- src/maploader/glnodes.cpp | 3 ++- src/serializer_doom.cpp | 3 ++- tools/zipdir/CMakeLists.txt | 4 ++-- tools/zipdir/zipdir.c | 3 ++- - vcpkg.json | 4 ++++ - 18 files changed, 59 insertions(+), 21 deletions(-) + 17 files changed, 39 insertions(+), 20 deletions(-) Index: gzdoom-g4.12.2/CMakeLists.txt =================================================================== @@ -37,32 +41,7 @@ Index: gzdoom-g4.12.2/CMakeLists.txt include( TargetArch ) -@@ -332,6 +333,7 @@ set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE - set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${REL_C_FLAGS}" ) - set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEB_C_FLAGS} -D_DEBUG" ) - -+option(FORCE_INTERNAL_ZLIB "Use internal zlib") - option(FORCE_INTERNAL_BZIP2 "Use internal bzip2") - option(FORCE_INTERNAL_ASMJIT "Use internal asmjit" ON) - mark_as_advanced( FORCE_INTERNAL_ASMJIT ) -@@ -348,6 +350,16 @@ set( DRPC_INCLUDE_DIR "-I/ignore" ) - set( DRPC_LIBRARIES -ldiscord-rpc ) - set( DRPC_LIBRARY -ldiscord-rpc ) - -+if( ZLIB_FOUND AND NOT FORCE_INTERNAL_ZLIB ) -+ message( STATUS "Using system zlib, includes found at ${ZLIB_INCLUDE_DIR}" ) -+else() -+ message( STATUS "Using internal zlib" ) -+ set( SKIP_INSTALL_ALL TRUE ) # Avoid installing zlib -+ set( ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib ) -+ set( ZLIB_LIBRARIES z ) -+ set( ZLIB_LIBRARY z ) -+endif() -+ - if( HAVE_VM_JIT AND UNIX ) - check_symbol_exists( "backtrace" "execinfo.h" HAVE_BACKTRACE ) - if( NOT HAVE_BACKTRACE ) -@@ -406,7 +418,6 @@ install(DIRECTORY docs/ +@@ -406,7 +407,6 @@ install(DIRECTORY docs/ option( DYN_OPENAL "Dynamically load OpenAL" ON ) add_subdirectory( libraries/lzma ) @@ -174,21 +153,17 @@ Index: gzdoom-g4.12.2/src/common/models/model.cpp #include "filesystem.h" #include "cmdlib.h" -@@ -132,7 +131,17 @@ FTextureID LoadSkin(const char * path, c +@@ -132,7 +131,13 @@ FTextureID LoadSkin(const char * path, c int ModelFrameHash(FSpriteModelFrame * smf) { - return crc32(0, (const unsigned char *)(&smf->type), offsetof(FSpriteModelFrame, hashnext) - offsetof(FSpriteModelFrame, type)); + const uint32_t *table = GetCRCTable (); + uint32_t hash = 0xffffffff; -+ + const char * s = (const char *)(&smf->type); // this uses type, sprite and frame for hashing + const char * se= (const char *)(&smf->hashnext); -+ + for (; s #include --// miniz includes some CRC32 stuff, so just use that -+// zlib includes some CRC32 stuff, so just use that + // miniz includes some CRC32 stuff, so just use that +inline const uint32_t *GetCRCTable () { return (const uint32_t *)get_crc_table(); } inline uint32_t CalcCRC32 (const uint8_t *buf, unsigned int len) @@ -327,18 +301,3 @@ Index: gzdoom-g4.12.2/tools/zipdir/zipdir.c #include "bzlib.h" #include "LzmaEnc.h" #include "7zVersion.h" -Index: gzdoom-g4.12.2/vcpkg.json -=================================================================== ---- gzdoom-g4.12.2.orig/vcpkg.json -+++ gzdoom-g4.12.2/vcpkg.json -@@ -28,6 +28,10 @@ - }, - "dependencies": [ - { -+ "name": "zlib", -+ "platform": "!windows | (windows & static & staticcrt)" -+ }, -+ { - "name": "bzip2", - "platform": "(!windows & static) | (windows & static & staticcrt)" - }, diff --git a/0001-Revert-use-static_assert-to-make-32-bit-builds-fail.patch b/0001-Revert-use-static_assert-to-make-32-bit-builds-fail.patch deleted file mode 100644 index 9f5cb7e..0000000 --- a/0001-Revert-use-static_assert-to-make-32-bit-builds-fail.patch +++ /dev/null @@ -1,23 +0,0 @@ -From eb9bb8fb2fd0599199d8c94ece7e3bda642683ec Mon Sep 17 00:00:00 2001 -From: Jan Engelhardt -Date: Mon, 4 Jul 2022 10:52:17 +0200 -Subject: [PATCH] Revert "- use static_assert to make 32 bit builds fail." - -This reverts commit 8c244f6f850eeb5a5dede7f887f3f1ba87b3d8bc. ---- - src/common/engine/i_interface.cpp | 2 -- - 1 file changed, 2 deletions(-) - -Index: gzdoom-g4.9.0/src/common/engine/i_interface.cpp -=================================================================== ---- gzdoom-g4.9.0.orig/src/common/engine/i_interface.cpp -+++ gzdoom-g4.9.0/src/common/engine/i_interface.cpp -@@ -5,8 +5,6 @@ - #include "c_cvars.h" - #include "gstrings.h" - --static_assert(sizeof(void*) == 8, "32 builds are not supported"); -- - // Some global engine variables taken out of the backend code. - FStartupScreen* StartWindow; - SystemCallbacks sysCallbacks; diff --git a/0001-removed-some-32bit-only-CMake-code.patch b/0001-removed-some-32bit-only-CMake-code.patch deleted file mode 100644 index 3bce930..0000000 --- a/0001-removed-some-32bit-only-CMake-code.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 9e76faff1f93688d035062913cc29b294b831576 Mon Sep 17 00:00:00 2001 -From: Christoph Oelckers -Date: Thu, 20 Oct 2022 21:11:18 +0200 -Subject: [PATCH] - removed some 32bit only CMake code. - ---- - src/CMakeLists.txt | 25 +++++++++++++++++++++++++ - 1 file changed, 25 insertions(+) - -Index: gzdoom-g4.9.0/src/CMakeLists.txt -=================================================================== ---- gzdoom-g4.9.0.orig/src/CMakeLists.txt -+++ gzdoom-g4.9.0/src/CMakeLists.txt -@@ -156,8 +156,33 @@ endif() - - # Decide on SSE setup - -+# SSE only matters on 32-bit targets. We check compiler flags to know if we can do it. -+if( CMAKE_SIZEOF_VOID_P MATCHES "4" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES ppc ) -+ CHECK_CXX_COMPILER_FLAG( "-msse2 -mfpmath=sse" CAN_DO_MFPMATH ) -+ CHECK_CXX_COMPILER_FLAG( -arch:SSE2 CAN_DO_ARCHSSE2 ) -+ if( CAN_DO_MFPMATH ) -+ set( SSE1_ENABLE "-msse -mfpmath=sse" ) -+ set( SSE2_ENABLE "-msse2 -mfpmath=sse" ) -+ elseif( CAN_DO_ARCHSSE2 ) -+ set( SSE1_ENABLE -arch:SSE ) -+ set( SSE2_ENABLE -arch:SSE2 ) -+ endif() -+endif() -+ - if( X64 ) - set( HAVE_MMX 1 ) -+else( X64 ) -+ set( SAFE_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ) -+ -+ if( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) -+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx") -+ endif( DEM_CMAKE_COMPILER_IS_GNUCXX_COMPATIBLE ) -+ -+ CHECK_CXX_SOURCE_COMPILES("#include -+ int main(void) { __m64 v = _m_from_int(0); }" -+ HAVE_MMX) -+ -+ set( CMAKE_CXX_FLAGS ${SAFE_CMAKE_CXX_FLAGS} ) - endif( X64 ) - - CHECK_CXX_SOURCE_COMPILES("#include diff --git a/gzdoom-discord.patch b/gzdoom-discord.patch index 5fd1856..4814db3 100644 --- a/gzdoom-discord.patch +++ b/gzdoom-discord.patch @@ -1,7 +1,11 @@ -From: Jan Engelhardt +From: Jan Engelhardt Date: 2022-06-12 10:37:00.984596068 +0200 -Unbundle discord-rpc. +Use system-provided discord-rpc library. Heed + +* https://docs.fedoraproject.org/en-US/fesco/Bundled_Software_policy/ +* https://en.opensuse.org/openSUSE:Bundled_software_policy + --- CMakeLists.txt | 6 +++--- libraries/discordrpc/src/CMakeLists.txt | 2 +- @@ -18,7 +22,7 @@ Index: gzdoom-g4.12.2/CMakeLists.txt -set( DRPC_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/discordrpc/include" ) -set( DRPC_LIBRARIES discord-rpc ) -set( DRPC_LIBRARY discord-rpc ) -+set( DRPC_INCLUDE_DIR "-I/ignore" ) ++set( DRPC_INCLUDE_DIR "/ignore" ) +set( DRPC_LIBRARIES -ldiscord-rpc ) +set( DRPC_LIBRARY -ldiscord-rpc ) diff --git a/gzdoom-lzma-simd.patch b/gzdoom-lzma-simd.patch index f35e997..154c966 100644 --- a/gzdoom-lzma-simd.patch +++ b/gzdoom-lzma-simd.patch @@ -1,8 +1,10 @@ -From: Jan Engelhardt +From: Jan Engelhardt Date: 2024-05-01 00:14:04.625759204 +0200 Subject: Fix build failures involving SIMD code -Fix build failure on Leap 15.6/gcc-7 amd64: +When using the bundled copy of lzma-sdk, there is a build failure +on Leap 15.6/gcc-7 amd64: + [ 31s] C/SwapBytes.c:312:7: error: incompatible types when initializing type '__m256i {aka const __vector(4) long long int}' using type 'int' diff --git a/gzdoom-lzma.patch b/gzdoom-lzma.patch index fc11195..518a13a 100644 --- a/gzdoom-lzma.patch +++ b/gzdoom-lzma.patch @@ -1,7 +1,10 @@ -From: Jan Engelhardt +From: Jan Engelhardt Date: 2018-01-08 13:48:59+0100 -Use LZMA system libraries instead of bundled code. +Use system-provided lzma-sdk. Heed + +* https://docs.fedoraproject.org/en-US/fesco/Bundled_Software_policy/ +* https://en.opensuse.org/openSUSE:Bundled_software_policy --- CMakeLists.txt | 4 ++-- diff --git a/gzdoom-waddir.patch b/gzdoom-waddir.patch deleted file mode 100644 index 334b123..0000000 --- a/gzdoom-waddir.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Jan Engelhardt -Date: 2018-01-02 15:25:05.669125932 +0100 - -Ensure same IWAD directory across all Doom source ports in openSUSE - ---- - src/common/platform/posix/i_system.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: gzdoom-g4.4.0/src/common/platform/posix/i_system.h -=================================================================== ---- gzdoom-g4.4.0.orig/src/common/platform/posix/i_system.h -+++ gzdoom-g4.4.0/src/common/platform/posix/i_system.h -@@ -17,7 +17,7 @@ struct ticcmd_t; - struct WadStuff; - - #ifndef SHARE_DIR --#define SHARE_DIR "/usr/local/share/" -+#define SHARE_DIR "/usr/share/doom/" - #endif - - void CalculateCPUSpeed(void); diff --git a/gzdoom.changes b/gzdoom.changes index 974e3ae..2abe41d 100644 --- a/gzdoom.changes +++ b/gzdoom.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri May 17 22:04:47 UTC 2024 - Jan Engelhardt + +- Delete gzdoom-waddir.patch (substitute by logic in build recipe), + delete 0001-Revert-use-static_assert-to-make-32-bit-builds-fail.patch + and 0001-removed-some-32bit-only-CMake-code.patch + (merged into more-32bit.patch) + ------------------------------------------------------------------- Wed May 8 11:37:09 UTC 2024 - Jan Engelhardt diff --git a/gzdoom.spec b/gzdoom.spec index 68c05b0..af841f7 100644 --- a/gzdoom.spec +++ b/gzdoom.spec @@ -26,13 +26,10 @@ URL: https://zdoom.org/ #Git-Clone: https://github.com/zdoom/gzdoom Source: https://github.com/zdoom/gzdoom/archive/g%version.tar.gz -Patch1: gzdoom-waddir.patch Patch2: gzdoom-discord.patch Patch3: 0001-Revert-Switch-to-miniz-from-zlib.patch Patch4: gzdoom-lzma-simd.patch Patch5: gzdoom-lzma.patch -Patch6: 0001-removed-some-32bit-only-CMake-code.patch -Patch7: 0001-Revert-use-static_assert-to-make-32-bit-builds-fail.patch Patch8: more-32bit.patch BuildRequires: cmake >= 2.8.7 BuildRequires: discord-rpc-devel @@ -81,16 +78,19 @@ SSE2 is a hard requirement even on 32-bit x86. %prep %autosetup -n %name-g%version -p1 %if 0%{?suse_version} < 1599 +# system lzma-sdk too old, use bundled copy %patch -P 5 -R -p1 %endif -perl -i -pe 's{__DATE__}{"does not matter when"}g' src/common/platform/posix/sdl/i_main.cpp -perl -i -pe 's{}{%version}g' tools/updaterevision/UpdateRevision.cmake +# osc/rpm always has the version identifier (only has an effect when snapshots are used via _service files) +perl -i -pe "s{}{%version}g" tools/updaterevision/UpdateRevision.cmake +# https://en.opensuse.org/openSUSE:Reproducible_Builds +perl -i -pe "s{__DATE__}{$SOURCE_DATE_EPOCH}g" src/common/platform/posix/sdl/i_main.cpp %build -# There is handcrafted assembler, which LTO does not play nice with. +# Disable LTO, which does not like seeing handcrafted assembler %define _lto_cflags %nil -export CXXFLAGS="$CXXFLAGS -I$PWD/extra_include" +export CXXFLAGS="$CXXFLAGS -DSHARE_DIR=\\\"%_datadir/doom\\\"" %cmake -DNO_STRIP=1 \ -DCMAKE_SHARED_LINKER_FLAGS="" \ -DCMAKE_EXE_LINKER_FLAGS="" -DCMAKE_MODULE_LINKER_FLAGS="" \ diff --git a/more-32bit.patch b/more-32bit.patch index d284997..fa1df1d 100644 --- a/more-32bit.patch +++ b/more-32bit.patch @@ -1,20 +1,55 @@ -From: Jan Engelhardt -Date: 2023-11-03 10:46:06.423636287 +0100 +From: Jan Engelhardt +Date: Wed, 8 May 2024 13:33:41 +0200 +Subject: [PATCH] build: portability fixes +References: https://github.com/ZDoom/gzdoom/pull/2562 -VkSurfaceKHR is an alias to `struct something *` on 64-bit platforms, but to -`uint64_t` on 32-bit. Using {} will clear it without running into a type error: +Different architectures have different type sizes and alignments. +Don't test void* for a hardcoded size if there is not an inherent +dependency on the size. I have hereby tested gzdoom.i586 runs +inside a chroot-on-x64. -[ 88s] sdlglvideo.cpp:294:54: error: cannot convert 'std::nullptr_t' to -'VkSurfaceKHR' {aka 'long long unsigned int'} in initialization -[ 88s] 294 | VkSurfaceKHR surfacehandle = nullptr; - -static_assert for particle_t also failed, because it's 120 on ILP32. +VkSurfaceKHR is not a pointer on some platforms but an integral type. +Using {} will clear it without running into a type error: + sdlglvideo.cpp:294:54: error: cannot convert 'std::nullptr_t' to + 'VkSurfaceKHR' {aka 'long long unsigned int'} in initialization + VkSurfaceKHR surfacehandle = nullptr; --- + src/CMakeLists.txt | 5 +++++ + src/common/engine/i_interface.cpp | 2 -- src/common/platform/posix/sdl/sdlglvideo.cpp | 2 +- src/playsim/p_effect.h | 7 +++++-- - 2 files changed, 6 insertions(+), 3 deletions(-) + 4 files changed, 11 insertions(+), 5 deletions(-) +Index: gzdoom-g4.12.2/src/CMakeLists.txt +=================================================================== +--- gzdoom-g4.12.2.orig/src/CMakeLists.txt ++++ gzdoom-g4.12.2/src/CMakeLists.txt +@@ -44,6 +44,11 @@ if( ${TARGET_ARCHITECTURE} MATCHES "x86_ + set( X64 64 ) + add_definitions( -DARCH_IA32 ) + endif() ++if( ${TARGET_ARCHITECTURE} MATCHES "i386" ) ++ # The production of _mm_load_si128 instructions requires flags. ++ # (This is independent of whether or not they are executed later.) ++ add_definitions( -mmmx -msse -msse2 -mfpmath=sse -DARCH_IA32 ) ++endif() + + if( NOT PROJECT_LIBRARIES ) + set( PROJECT_LIBRARIES "" ) +Index: gzdoom-g4.12.2/src/common/engine/i_interface.cpp +=================================================================== +--- gzdoom-g4.12.2.orig/src/common/engine/i_interface.cpp ++++ gzdoom-g4.12.2/src/common/engine/i_interface.cpp +@@ -5,8 +5,6 @@ + #include "c_cvars.h" + #include "gstrings.h" + +-static_assert(sizeof(void*) == 8, "32 builds are not supported"); +- + // Some global engine variables taken out of the backend code. + FStartupScreen* StartWindow; + SystemCallbacks sysCallbacks; Index: gzdoom-g4.12.2/src/common/platform/posix/sdl/sdlglvideo.cpp =================================================================== --- gzdoom-g4.12.2.orig/src/common/platform/posix/sdl/sdlglvideo.cpp