summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/warzone2100-unbundle-libs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/warzone2100-unbundle-libs.patch')
-rw-r--r--gnu/packages/patches/warzone2100-unbundle-libs.patch324
1 files changed, 324 insertions, 0 deletions
diff --git a/gnu/packages/patches/warzone2100-unbundle-libs.patch b/gnu/packages/patches/warzone2100-unbundle-libs.patch
new file mode 100644
index 0000000000..6752cc609c
--- /dev/null
+++ b/gnu/packages/patches/warzone2100-unbundle-libs.patch
@@ -0,0 +1,324 @@
+diff -ru a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
+--- a/3rdparty/CMakeLists.txt 2025-09-16 11:41:32.000000000 -0500
++++ b/3rdparty/CMakeLists.txt 2025-09-18 14:00:25.296819724 -0500
+@@ -1,67 +1,47 @@
+ cmake_minimum_required (VERSION 3.16...3.31)
+-
++find_package(PkgConfig QUIET)
+ include(CheckCompilerFlagsOutput)
+
+-SET(UTF8PROC_INSTALL OFF CACHE BOOL "Enable installation of utf8proc" FORCE)
+-add_subdirectory(utf8proc EXCLUDE_FROM_ALL)
+-set_property(TARGET utf8proc PROPERTY FOLDER "3rdparty")
+-if(NOT MSVC)
+- set(_supported_utf8proc_cxx_compiler_flags "")
+-
+- # -Wassign-enum
+- check_compiler_flags_output("-Werror -Wno-assign-enum -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-Wno-assign-enum" OUTPUT_VARIABLE _supported_utf8proc_cxx_compiler_flags APPEND)
+-
+- if (NOT _supported_utf8proc_cxx_compiler_flags STREQUAL "")
+- string(REPLACE " " ";" _supported_utf8proc_cxx_compiler_flags "${_supported_utf8proc_cxx_compiler_flags}")
+- target_compile_options(utf8proc PRIVATE ${_supported_utf8proc_cxx_compiler_flags})
+- endif()
+-endif()
++pkg_check_modules(UTF8PROC REQUIRED libutf8proc)
++add_library(utf8proc UNKNOWN IMPORTED)
++set_target_properties(utf8proc PROPERTIES
++ IMPORTED_LOCATION ${UTF8PROC_LIBRARIES}
++ INTERFACE_INCLUDE_DIRECTORIES ${UTF8PROC_INCLUDE_DIRS}
++ INTERFACE_LINK_LIBRARIES ${UTF8PROC_LINK_LIBRARIES}
++)
+
+ add_subdirectory(launchinfo EXCLUDE_FROM_ALL)
+ set_property(TARGET launchinfo PROPERTY FOLDER "3rdparty")
+
+-SET(FMT_INSTALL OFF CACHE BOOL "Generate the install target" FORCE)
+-SET(FMT_SYSTEM_HEADERS ON CACHE BOOL "Expose headers with marking them as system." FORCE)
+-add_subdirectory(fmt EXCLUDE_FROM_ALL)
+-set_property(TARGET fmt PROPERTY FOLDER "3rdparty")
+-# Define a custom inline namespace for the fmt used by WZ, to prevent ODR violations if static linking to any libraries that themselves embed (a different version of) fmt
+-target_compile_definitions(fmt PUBLIC "FMT_BEGIN_NAMESPACE=namespace fmt { inline namespace v11_wz2100 {")
+-target_compile_definitions(fmt PUBLIC "FMT_END_NAMESPACE=}}")
+-
++pkg_check_modules(FMT REQUIRED fmt)
++add_library(fmt UNKNOWN IMPORTED)
++set_target_properties(fmt PROPERTIES
++ IMPORTED_LOCATION ${FMT_LIBRARIES}
++ INTERFACE_INCLUDE_DIRECTORIES ${FMT_INCLUDE_DIRS}
++ INTERFACE_LINK_LIBRARIES ${FMT_LINK_LIBRARIES}
++)
+
+ # inih library
+-add_library(inih STATIC "inih/ini.h" "inih/ini.c")
+-set_property(TARGET inih PROPERTY FOLDER "3rdparty")
+-target_include_directories(inih PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
+-target_compile_definitions(inih PRIVATE
+- "-DINI_API="
+- "-DINI_ALLOW_MULTILINE=0"
+- "-DINI_ALLOW_BOM=1"
+- "-DINI_ALLOW_INLINE_COMMENTS=0"
+- "-DINI_MAX_LINE=1024"
+- "-DINI_ALLOW_REALLOC=1"
+- "-DINI_INITIAL_ALLOC=1024"
++pkg_check_modules(INIH REQUIRED inih)
++add_library(inih UNKNOWN IMPORTED)
++set_target_properties(inih PROPERTIES
++ IMPORTED_LOCATION ${INIH_LIBRARIES}
++ INTERFACE_INCLUDE_DIRECTORIES ${INIH_INCLUDE_DIRS}
++ INTERFACE_LINK_LIBRARIES ${INIH_LINK_LIBRARIES}
+ )
+
+ # re2
+-SET(RE2_BUILD_TESTING OFF CACHE BOOL "enable testing for RE2" FORCE)
+-add_subdirectory(re2 EXCLUDE_FROM_ALL)
+-target_include_directories(re2 PUBLIC
+- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/re2>
++pkg_check_modules(RE2 REQUIRED re2)
++add_library(re2 UNKNOWN IMPORTED)
++set_target_properties(re2 PROPERTIES
++ IMPORTED_LOCATION ${RE2_LIBRARIES}
++ INTERFACE_INCLUDE_DIRECTORIES ${RE2_INCLUDE_DIRS}
++ INTERFACE_LINK_LIBRARIES ${RE2_LINK_LIBRARIES}
+ )
+-set_property(TARGET re2 PROPERTY FOLDER "3rdparty")
+-set_property(TARGET re2 PROPERTY XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS NO) # -Wmissing-field-initializers
+-set_property(TARGET re2 PROPERTY XCODE_ATTRIBUTE_GCC_WARN_SHADOW NO) # -Wshadow
+-set_property(TARGET re2 PROPERTY XCODE_ATTRIBUTE_WARNING_CFLAGS "-Wno-missing-field-initializers -Wno-shadow")
+
+ add_subdirectory(EmbeddedJSONSignature EXCLUDE_FROM_ALL)
+ set_property(TARGET EmbeddedJSONSignature PROPERTY FOLDER "3rdparty")
+
+-if(ENABLE_DISCORD)
+- add_subdirectory(discord-rpc EXCLUDE_FROM_ALL)
+- set_property(TARGET discord-rpc PROPERTY FOLDER "3rdparty")
+-endif()
+-
+ find_package(SQLite3 3.14 REQUIRED)
+ set(SQLITECPP_USE_STATIC_RUNTIME OFF CACHE BOOL "Use static runtime" FORCE)
+ set(SQLITE_HAS_CODEC OFF CACHE BOOL "Enable database encryption API. Not available in the public release of SQLite." FORCE)
+@@ -111,52 +91,7 @@
+ if (WZ_ENABLE_BASIS_UNIVERSAL AND NOT WZ_CI_DISABLE_BASIS_COMPRESS_TEXTURES)
+
+ # basis-universal
+- set(_ORIGINAL_CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH}")
+- if(DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_HOST_TRIPLET)
+- # Partial workaround for: https://github.com/microsoft/vcpkg/issues/17001
+- # Explicitly add the HOST_TRIPLET paths to CMAKE_PROGRAM_PATH
+- list(APPEND CMAKE_PROGRAM_PATH "${VCPKG_INSTALLED_DIR}/${VCPKG_HOST_TRIPLET}")
+- endif()
+- find_program(BASIS_UNIVERSAL_CLI NAMES basisu PATH_SUFFIXES "tools/basisu" NO_CACHE)
+- set(CMAKE_PROGRAM_PATH "${_ORIGINAL_CMAKE_PROGRAM_PATH}")
+- if(NOT BASIS_UNIVERSAL_CLI)
+- message(STATUS "Pre-installed basisu tool not found - attempting to build for host system")
+-
+- # Build the tool for the host system at configure time
+- set(BASISU_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/basis_universal_host_tool/")
+- execute_process(
+- COMMAND ${CMAKE_COMMAND} -E make_directory "${BASISU_BINARY_DIR}"
+- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/basis_universal_host_build"
+- RESULT_VARIABLE _basis_result
+- )
+- if(NOT _basis_result EQUAL 0)
+- message(FATAL_ERROR "Failed to create directory for basis_universal_host_build")
+- endif()
+- execute_process(
+- COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release "${CMAKE_CURRENT_SOURCE_DIR}/basis_universal_host_build"
+- WORKING_DIRECTORY "${BASISU_BINARY_DIR}"
+- RESULT_VARIABLE _basis_result
+- )
+- if(NOT _basis_result EQUAL 0)
+- message(FATAL_ERROR "Failed to configure basis_universal_host_build")
+- endif()
+- execute_process(
+- COMMAND ${CMAKE_COMMAND} --build "${BASISU_BINARY_DIR}" --config Release
+- WORKING_DIRECTORY "${BASISU_BINARY_DIR}"
+- RESULT_VARIABLE _basis_result
+- )
+- if(NOT _basis_result EQUAL 0)
+- message(FATAL_ERROR "Basis-Universal host tool build failed")
+- endif()
+- message(STATUS "Basis-Universal Host Tool Built")
+-
+- find_program(BASIS_UNIVERSAL_CLI NAMES basisu PATHS "${BASISU_BINARY_DIR}/basis_install/bin" NO_CACHE NO_DEFAULT_PATH)
+- if(NOT BASIS_UNIVERSAL_CLI)
+- message(FATAL_ERROR "Built basisu CLI tool not found!")
+- endif()
+- else()
+- message(STATUS "Pre-installed basisu tool found: ${BASIS_UNIVERSAL_CLI}")
+- endif()
++ find_program(BASIS_UNIVERSAL_CLI NAMES basisu REQUIRED)
+
+ # Test basisu -version
+ execute_process(
+@@ -174,86 +109,6 @@
+
+ endif()
+
+-if (WZ_ENABLE_BASIS_UNIVERSAL)
+-
+- # basis-universal transcoder
+-
+- add_library(basis_transcoder STATIC "${CMAKE_CURRENT_SOURCE_DIR}/basis_universal/transcoder/basisu_transcoder.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/basis_universal/transcoder/basisu_transcoder.h" "${CMAKE_CURRENT_SOURCE_DIR}/basis_universal/zstd/zstddeclib.c")
+- set_property(TARGET basis_transcoder PROPERTY FOLDER "3rdparty")
+- target_include_directories(basis_transcoder SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/basis_universal/transcoder")
+-
+- if(NOT MSVC)
+- set(_supported_basistranscoder_cxx_compiler_flags "")
+-
+- # -fno-strict-aliasing (GCC, Clang)
+- check_compiler_flags_output("-Werror -fno-strict-aliasing -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-fno-strict-aliasing" OUTPUT_VARIABLE _supported_basistranscoder_cxx_compiler_flags APPEND)
+-
+- # -Wcast-align (GCC 3.4+, Clang 3.2+)
+- check_compiler_flags_output("-Werror -Wno-cast-align -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-Wno-cast-align" OUTPUT_VARIABLE _supported_basistranscoder_cxx_compiler_flags APPEND)
+-
+- # -Wdeprecated-declarations
+- check_compiler_flags_output("-Werror -Wno-deprecated-declarations -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-Wno-deprecated-declarations" OUTPUT_VARIABLE _supported_basistranscoder_cxx_compiler_flags APPEND)
+-
+- # -Wunused-but-set-variable
+- check_compiler_flags_output("-Werror -Wno-unused-but-set-variable -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-Wno-unused-but-set-variable" OUTPUT_VARIABLE _supported_basistranscoder_cxx_compiler_flags APPEND)
+-
+- # -Wunused-function
+- check_compiler_flags_output("-Werror -Wno-unused-function -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-Wno-unused-function" OUTPUT_VARIABLE _supported_basistranscoder_cxx_compiler_flags APPEND)
+-
+- # -Wunused-const-variable
+- check_compiler_flags_output("-Werror -Wno-unused-const-variable -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-Wno-unused-const-variable" OUTPUT_VARIABLE _supported_basistranscoder_cxx_compiler_flags APPEND)
+-
+- # -Wunknown-warning-option
+- check_compiler_flags_output("-Werror -Wno-unknown-warning-option -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-Wno-unknown-warning-option" OUTPUT_VARIABLE _supported_basistranscoder_cxx_compiler_flags APPEND)
+-
+- # -Wnontrivial-memcall
+- check_compiler_flags_output("-Werror -Wno-nontrivial-memcall -Wno-error=cpp" COMPILER_TYPE CXX OUTPUT_FLAGS "-Wno-nontrivial-memcall" OUTPUT_VARIABLE _supported_basistranscoder_cxx_compiler_flags APPEND)
+-
+- if (NOT _supported_basistranscoder_cxx_compiler_flags STREQUAL "")
+- string(REPLACE " " ";" _supported_basistranscoder_cxx_compiler_flags "${_supported_basistranscoder_cxx_compiler_flags}")
+- target_compile_options(basis_transcoder PRIVATE ${_supported_basistranscoder_cxx_compiler_flags})
+- endif()
+- endif()
+-
+- # Must also set BASISD_IS_BIG_ENDIAN if the target platform is big-endian!
+- if (NOT DEFINED CMAKE_CXX_BYTE_ORDER AND CMAKE_VERSION VERSION_LESS 3.20)
+- # CMake < 3.20 does not have CMAKE_<LANG>_BYTE_ORDER
+- # Instead, use the older TestBigEndian module (although this may not work for cross-compilation)
+- if (NOT CMAKE_CROSSCOMPILING)
+- include(TestBigEndian)
+- test_big_endian(IS_BIGENDIAN)
+- if (IS_BIGENDIAN)
+- set(CMAKE_CXX_BYTE_ORDER "BIG_ENDIAN")
+- endif()
+- else()
+- message(WARNING "Unable to determine endianness for target architecture. Either upgrade to CMake 3.20+, or - if big endian - manually set the CMAKE_CXX_BYTE_ORDER cache variable to \"BIG_ENDIAN\". Otherwise, assuming little endian.")
+- endif()
+- endif()
+- if (DEFINED CMAKE_CXX_BYTE_ORDER AND CMAKE_CXX_BYTE_ORDER STREQUAL "BIG_ENDIAN")
+- message(STATUS "Defining BASISD_IS_BIG_ENDIAN=1")
+- target_compile_definitions(basis_transcoder PRIVATE "-DBASISD_IS_BIG_ENDIAN=1")
+- endif()
+-
+- # Must set BASISU_HAVE_STD_TRIVIALLY_COPYABLE if the target supports std::is_trivially_copyable
+- include(CheckCXXSourceCompiles)
+- check_cxx_source_compiles("
+- #include <type_traits>
+- const bool val = std::is_trivially_copyable<bool>::value;
+- int main()
+- {
+- return 0;
+- }"
+- HAVE_STD_IS_TRIVIALLY_COPYABLE
+- )
+- if (HAVE_STD_IS_TRIVIALLY_COPYABLE)
+- target_compile_definitions(basis_transcoder PUBLIC "-DBASISU_HAVE_STD_TRIVIALLY_COPYABLE")
+- endif()
+-
+- # Disable certain transcoder formats
+- target_compile_definitions(basis_transcoder PRIVATE "-DBASISD_SUPPORT_ATC=0" "-DBASISD_SUPPORT_PVRTC1=0" "-DBASISD_SUPPORT_PVRTC2=0")
+-
+-endif(WZ_ENABLE_BASIS_UNIVERSAL)
+-
+ if (WZ_PROFILING_NVTX)
+ include(FetchContent)
+ FetchContent_Declare(
+diff -ru a/lib/framework/wzstring.cpp b/lib/framework/wzstring.cpp
+--- a/lib/framework/wzstring.cpp 2025-09-16 11:41:32.000000000 -0500
++++ b/lib/framework/wzstring.cpp 2025-09-18 13:37:23.686668245 -0500
+@@ -24,8 +24,8 @@
+ #include <sstream>
+ #include <iomanip>
+ #include <limits>
+-#include <utfcpp/source/utf8.h>
+-#include <utf8proc/utf8proc.h>
++#include <utf8cpp/utf8.h>
++#include <utf8proc.h>
+
+ WzUniCodepoint WzUniCodepoint::fromASCII(unsigned char charLiteral)
+ {
+diff -ru a/lib/ivis_opengl/CMakeLists.txt b/lib/ivis_opengl/CMakeLists.txt
+--- a/lib/ivis_opengl/CMakeLists.txt 2025-09-16 11:41:32.000000000 -0500
++++ b/lib/ivis_opengl/CMakeLists.txt 2025-09-18 14:00:13.716771596 -0500
+@@ -88,7 +88,7 @@
+ include(WZTargetConfiguration)
+ WZ_TARGET_CONFIGURATION(ivis-opengl)
+
+-target_link_libraries(ivis-opengl PRIVATE framework launchinfo fmt::fmt)
++target_link_libraries(ivis-opengl PRIVATE framework launchinfo fmt)
+ if(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
+ # We should be using the Emscripten port linker flags for FreeType & Harfbuzz
+ else()
+@@ -116,8 +116,11 @@
+ target_link_libraries(ivis-opengl PRIVATE etcpak)
+ target_compile_definitions(ivis-opengl PRIVATE "-DETCPAK_ENABLED")
+ endif()
+-if(WZ_ENABLE_BASIS_UNIVERSAL AND TARGET basis_transcoder)
+- target_link_libraries(ivis-opengl PRIVATE basis_transcoder)
++if(WZ_ENABLE_BASIS_UNIVERSAL)
++ find_package(PkgConfig QUIET)
++ pkg_check_modules(BASIS REQUIRED basisu_encoder)
++ target_include_directories(ivis-opengl PUBLIC ${BASIS_INCLUDE_DIRS})
++ target_link_libraries(ivis-opengl PRIVATE ${BASIS_LINK_LIBRARIES})
+ target_compile_definitions(ivis-opengl PRIVATE "-DBASIS_ENABLED")
+ else()
+ message(WARNING "Basis-universal support is disabled")
+diff -ru a/lib/netplay/CMakeLists.txt b/lib/netplay/CMakeLists.txt
+--- a/lib/netplay/CMakeLists.txt 2025-09-16 11:41:32.000000000 -0500
++++ b/lib/netplay/CMakeLists.txt 2025-09-18 13:37:23.686969530 -0500
+@@ -108,7 +108,7 @@
+ include(WZTargetConfiguration)
+ WZ_TARGET_CONFIGURATION(netplay)
+ target_link_libraries(netplay
+- PRIVATE framework re2::re2 nlohmann_json plum-static Threads::Threads ZLIB::ZLIB fmt::fmt
++ PRIVATE framework re2 nlohmann_json plum-static Threads::Threads ZLIB::ZLIB fmt
+ PUBLIC tl::expected)
+
+ if(WZ_USE_IMPORTED_MINIUPNPC)
+diff -ru a/src/3rdparty/INIReaderWriter.cpp b/src/3rdparty/INIReaderWriter.cpp
+--- a/src/3rdparty/INIReaderWriter.cpp 2025-09-16 11:41:32.000000000 -0500
++++ b/src/3rdparty/INIReaderWriter.cpp 2025-09-18 13:37:23.687094584 -0500
+@@ -13,7 +13,7 @@
+ #ifndef INI_API
+ # define INI_API
+ #endif
+-#include <inih/ini.h>
++#include <ini.h>
+ #include "INIReaderWriter.h"
+
+ using std::string;
+diff -ru a/src/CMakeLists.txt b/src/CMakeLists.txt
+--- a/src/CMakeLists.txt 2025-09-16 11:41:32.000000000 -0500
++++ b/src/CMakeLists.txt 2025-09-18 13:37:23.687282446 -0500
+@@ -130,7 +130,7 @@
+
+ target_link_libraries(warzone2100 exception-handler gamelib wzmaplib ZipIOProvider ivis-opengl netplay sdl-backend framework sequence sound widget)
+ target_link_libraries(warzone2100 launchinfo EmbeddedJSONSignature)
+-target_link_libraries(warzone2100 fmt::fmt)
++target_link_libraries(warzone2100 fmt)
+ if(ENABLE_NLS)
+ target_link_libraries(warzone2100 ${Intl_LIBRARIES})
+ endif()
+@@ -146,7 +146,7 @@
+ include(IncludeFindCurl)
+ target_link_libraries(warzone2100 CURL::libcurl)
+ endif()
+-target_link_libraries(warzone2100 re2::re2)
++target_link_libraries(warzone2100 re2)
+
+ find_package(SQLite3 3.14 REQUIRED)
+ target_link_libraries(warzone2100 SQLite::SQLite3)