SHA256
1
0
forked from pool/gzdoom
gzdoom/0001-Revert-Switch-to-miniz-from-zlib.patch

304 lines
10 KiB
Diff
Raw Normal View History

From: Jan Engelhardt <ej@inai.de>
Date: Fri, 27 Oct 2023 09:01:47 +0200
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 | 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 | 9 +++++++--
src/common/platform/win32/i_crash.cpp | 3 ++-
src/common/textures/m_png.cpp | 3 ++-
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 ++-
17 files changed, 39 insertions(+), 20 deletions(-)
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/CMakeLists.txt
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/CMakeLists.txt
+++ gzdoom-g4.13.0/CMakeLists.txt
@@ -215,6 +215,7 @@ option( NO_OPENAL "Disable OpenAL sound
find_package( BZip2 )
find_package( VPX )
+find_package( ZLIB )
include( TargetArch )
@@ -406,7 +407,6 @@ install(DIRECTORY docs/
option( DYN_OPENAL "Dynamically load OpenAL" ON )
add_subdirectory( libraries/lzma )
-add_subdirectory( libraries/miniz )
add_subdirectory( tools )
add_subdirectory( wadsrc )
add_subdirectory( wadsrc_bm )
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/CMakeLists.txt
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/CMakeLists.txt
+++ gzdoom-g4.13.0/src/CMakeLists.txt
@@ -319,7 +319,7 @@ add_custom_target( revision_check ALL
# required libraries
-set( PROJECT_LIBRARIES ${PROJECT_LIBRARIES} miniz "${BZIP2_LIBRARIES}" "${CMAKE_DL_LIBS}" "${DRPC_LIBRARIES}")
+set( PROJECT_LIBRARIES ${PROJECT_LIBRARIES} "${ZLIB_LIBRARIES}" "${BZIP2_LIBRARIES}" "${CMAKE_DL_LIBS}" "${DRPC_LIBRARIES}")
if (HAVE_VULKAN)
list( APPEND PROJECT_LIBRARIES "zvulkan" )
endif()
@@ -383,7 +383,7 @@ else()
message( SEND_ERROR "Could not find libvpx" )
endif()
-include_directories( SYSTEM "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${DRPC_INCLUDE_DIR}")
+include_directories( SYSTEM "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${DRPC_INCLUDE_DIR}")
if( ${HAVE_VM_JIT} )
add_definitions( -DHAVE_VM_JIT )
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/audio/music/i_music.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/audio/music/i_music.cpp
+++ gzdoom-g4.13.0/src/common/audio/music/i_music.cpp
@@ -37,7 +37,8 @@
#include <sys/wait.h>
#endif
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include <zmusic.h>
#include "filesystem.h"
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/engine/serializer.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/engine/serializer.cpp
+++ gzdoom-g4.13.0/src/common/engine/serializer.cpp
@@ -37,7 +37,8 @@
#define RAPIDJSON_HAS_CXX11_RANGE_FOR 1
#define RAPIDJSON_PARSE_DEFAULT_FLAGS kParseFullPrecisionFlag
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include "rapidjson/rapidjson.h"
#include "rapidjson/writer.h"
#include "rapidjson/prettywriter.h"
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/filesystem/source/files_decompress.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/filesystem/source/files_decompress.cpp
+++ gzdoom-g4.13.0/src/common/filesystem/source/files_decompress.cpp
@@ -39,7 +39,8 @@
#include "Xz.h"
// CRC table needs to be generated prior to reading XZ compressed files.
#include "7zCrc.h"
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include <bzlib.h>
#include <algorithm>
#include <stdexcept>
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/filesystem/source/filesystem.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/filesystem/source/filesystem.cpp
+++ gzdoom-g4.13.0/src/common/filesystem/source/filesystem.cpp
@@ -36,7 +36,8 @@
// HEADER FILES ------------------------------------------------------------
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/filesystem/source/resourcefile.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/filesystem/source/resourcefile.cpp
+++ gzdoom-g4.13.0/src/common/filesystem/source/resourcefile.cpp
@@ -35,7 +35,8 @@
*/
#include <algorithm>
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include "resourcefile.h"
#include "md5.hpp"
#include "fs_stringpool.h"
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/models/model.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/models/model.cpp
+++ gzdoom-g4.13.0/src/common/models/model.cpp
@@ -25,7 +25,6 @@
** General model handling code
**
**/
-#include <stddef.h> // offsetof() macro.
#include "filesystem.h"
#include "cmdlib.h"
@@ -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<se; s++)
+ hash = CRC1 (hash, *s, table);
+ return hash ^ 0xffffffff;
}
//===========================================================================
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/platform/win32/i_crash.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/platform/win32/i_crash.cpp
+++ gzdoom-g4.13.0/src/common/platform/win32/i_crash.cpp
@@ -68,7 +68,8 @@
#include "i_mainwindow.h"
#include <time.h>
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
// MACROS ------------------------------------------------------------------
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/textures/m_png.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/textures/m_png.cpp
+++ gzdoom-g4.13.0/src/common/textures/m_png.cpp
@@ -36,7 +36,8 @@
#include <algorithm>
#include <stdlib.h>
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <malloc.h> // for alloca()
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/common/thirdparty/m_crc32.h
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/common/thirdparty/m_crc32.h
+++ gzdoom-g4.13.0/src/common/thirdparty/m_crc32.h
@@ -32,11 +32,13 @@
**
*/
#pragma once
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include <stdint.h>
// 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)
{
return crc32 (0, buf, len);
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/g_pch.h
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/g_pch.h
+++ gzdoom-g4.13.0/src/g_pch.h
@@ -10,7 +10,8 @@
#include <errno.h>
#include <ctype.h>
#include <stdint.h>
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include <new>
#include <algorithm>
#include <forward_list>
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/g_pch2.h
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/g_pch2.h
+++ gzdoom-g4.13.0/src/g_pch2.h
@@ -11,7 +11,8 @@
#include <errno.h>
#include <ctype.h>
#include <stdint.h>
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include <new>
#include <algorithm>
#include <sys/stat.h>
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/maploader/glnodes.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/maploader/glnodes.cpp
+++ gzdoom-g4.13.0/src/maploader/glnodes.cpp
@@ -36,7 +36,8 @@
#include <unistd.h>
#endif
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include "m_argv.h"
#include "c_dispatch.h"
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/src/serializer_doom.cpp
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/src/serializer_doom.cpp
+++ gzdoom-g4.13.0/src/serializer_doom.cpp
@@ -38,7 +38,8 @@
#define RAPIDJSON_HAS_CXX11_RANGE_FOR 1
#define RAPIDJSON_PARSE_DEFAULT_FLAGS kParseFullPrecisionFlag
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include "rapidjson/rapidjson.h"
#include "rapidjson/writer.h"
#include "rapidjson/prettywriter.h"
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/tools/zipdir/CMakeLists.txt
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/tools/zipdir/CMakeLists.txt
+++ gzdoom-g4.13.0/tools/zipdir/CMakeLists.txt
@@ -1,9 +1,9 @@
cmake_minimum_required( VERSION 3.16 )
if( NOT CMAKE_CROSSCOMPILING )
- include_directories( SYSTEM "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" )
+ include_directories( SYSTEM "${ZLIB_INCLUDE_DIR} ${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" )
add_executable( zipdir
zipdir.c )
- target_link_libraries( zipdir miniz ${BZIP2_LIBRARIES} lzma )
+ target_link_libraries( zipdir ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} lzma )
set( CROSS_EXPORTS ${CROSS_EXPORTS} zipdir PARENT_SCOPE )
endif()
2024-10-12 10:48:05 +02:00
Index: gzdoom-g4.13.0/tools/zipdir/zipdir.c
===================================================================
2024-10-12 10:48:05 +02:00
--- gzdoom-g4.13.0.orig/tools/zipdir/zipdir.c
+++ gzdoom-g4.13.0/tools/zipdir/zipdir.c
@@ -46,7 +46,8 @@
#include <errno.h>
#include <stdlib.h>
#include <time.h>
-#include <miniz.h>
+#include <assert.h>
+#include <zlib.h>
#include "bzlib.h"
#include "LzmaEnc.h"
#include "7zVersion.h"