mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-24 07:43:44 +02:00
235 lines
5.8 KiB
Diff
235 lines
5.8 KiB
Diff
# This patch prevents libzip's build system from trying to look for zlib, bzip2, lzma and zstd since Meson already handles that.
|
|
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -200,64 +200,14 @@ int main(int argc, char *argv[]) { }" HAVE_NULLABLE)
|
|
|
|
-find_package(ZLIB 1.1.2 REQUIRED)
|
|
-# so developers on systems where zlib is named differently (Windows, sometimes)
|
|
-# can override the name used in the pkg-config file
|
|
-if (NOT ZLIB_LINK_LIBRARY_NAME)
|
|
- set(ZLIB_LINK_LIBRARY_NAME "z")
|
|
-
|
|
- # Get the correct name in common cases
|
|
- list(LENGTH ZLIB_LIBRARIES N_ZLIB_LIBRARIES)
|
|
- if(N_ZLIB_LIBRARIES EQUAL 1)
|
|
- set(ZLIB_FILENAME ${ZLIB_LIBRARIES})
|
|
- elseif(N_ZLIB_LIBRARIES EQUAL 4)
|
|
- # ZLIB_LIBRARIES might have the target_link_library() format like
|
|
- # "optimized;path/to/zlib.lib;debug;path/to/zlibd.lib". Use the 'optimized'
|
|
- # case unless we know we are in a Debug build.
|
|
- if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
- list(FIND ZLIB_LIBRARIES "debug" ZLIB_LIBRARIES_INDEX_OF_CONFIG)
|
|
- else()
|
|
- list(FIND ZLIB_LIBRARIES "optimized" ZLIB_LIBRARIES_INDEX_OF_CONFIG)
|
|
- endif()
|
|
- if(ZLIB_LIBRARIES_INDEX_OF_CONFIG GREATER_EQUAL 0)
|
|
- math(EXPR ZLIB_FILENAME_INDEX "${ZLIB_LIBRARIES_INDEX_OF_CONFIG}+1")
|
|
- list(GET ZLIB_LIBRARIES ${ZLIB_FILENAME_INDEX} ZLIB_FILENAME)
|
|
- endif()
|
|
- endif()
|
|
- if(ZLIB_FILENAME)
|
|
- get_filename_component(ZLIB_FILENAME ${ZLIB_FILENAME} NAME_WE)
|
|
- string(REGEX REPLACE "^lib" "" ZLIB_LINK_LIBRARY_NAME ${ZLIB_FILENAME})
|
|
- endif()
|
|
-endif(NOT ZLIB_LINK_LIBRARY_NAME)
|
|
-
|
|
if(ENABLE_BZIP2)
|
|
- find_package(BZip2)
|
|
- if(BZIP2_FOUND)
|
|
set(HAVE_LIBBZ2 1)
|
|
- else()
|
|
- message(WARNING "-- bzip2 library not found; bzip2 support disabled")
|
|
- endif(BZIP2_FOUND)
|
|
endif(ENABLE_BZIP2)
|
|
|
|
if(ENABLE_LZMA)
|
|
- find_package(LibLZMA 5.2)
|
|
- if(LIBLZMA_FOUND)
|
|
set(HAVE_LIBLZMA 1)
|
|
- else()
|
|
- message(WARNING "-- lzma library not found; lzma/xz support disabled")
|
|
- endif(LIBLZMA_FOUND)
|
|
endif(ENABLE_LZMA)
|
|
|
|
if(ENABLE_ZSTD)
|
|
- find_package(zstd 1.4.0)
|
|
- if(zstd_FOUND)
|
|
set(HAVE_LIBZSTD 1)
|
|
- if(TARGET zstd::libzstd_shared AND BUILD_SHARED_LIBS)
|
|
- set(zstd_TARGET zstd::libzstd_shared)
|
|
- else()
|
|
- set(zstd_TARGET zstd::libzstd_static)
|
|
- endif()
|
|
- else()
|
|
- message(WARNING "-- zstd library not found; zstandard support disabled")
|
|
- endif(zstd_FOUND)
|
|
endif(ENABLE_ZSTD)
|
|
|
|
if (COMMONCRYPTO_FOUND)
|
|
--- a/lib/CMakeLists.txt
|
|
+++ b/lib/CMakeLists.txt
|
|
@@ -140,17 +140,14 @@ endif(WIN32)
|
|
|
|
if(HAVE_LIBBZ2)
|
|
target_sources(zip PRIVATE zip_algorithm_bzip2.c)
|
|
- target_link_libraries(zip PRIVATE BZip2::BZip2)
|
|
endif()
|
|
|
|
if(HAVE_LIBLZMA)
|
|
target_sources(zip PRIVATE zip_algorithm_xz.c)
|
|
- target_link_libraries(zip PRIVATE LibLZMA::LibLZMA)
|
|
endif()
|
|
|
|
if(HAVE_LIBZSTD)
|
|
target_sources(zip PRIVATE zip_algorithm_zstd.c)
|
|
- target_link_libraries(zip PRIVATE ${zstd_TARGET})
|
|
endif()
|
|
|
|
if(HAVE_COMMONCRYPTO)
|
|
@@ -178,7 +175,6 @@ if(SHARED_LIB_VERSIONNING)
|
|
set_target_properties(zip PROPERTIES VERSION 5.5 SOVERSION 5 MACHO_CURRENT_VERSION 6.5 MACHO_COMPATIBILITY_VERSION 6)
|
|
endif()
|
|
|
|
-target_link_libraries(zip PRIVATE ZLIB::ZLIB)
|
|
target_include_directories(zip
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib>
|
|
--- a/lib/compat.h
|
|
+++ b/lib/compat.h
|
|
@@ -154,7 +154,8 @@ typedef off_t zip_off_t;
|
|
#define ZIP_OFF_MAX ZIP_INT16_MAX
|
|
#define ZIP_OFF_MIN ZIP_INT16_MIN
|
|
#else
|
|
-#error unsupported size of off_t
|
|
+#define ZIP_OFF_MAX ZIP_INT64_MAX
|
|
+#define ZIP_OFF_MIN ZIP_INT64_MIN
|
|
#endif
|
|
|
|
#define ZIP_FSEEK_MAX ZIP_OFF_MAX
|
|
--- a/lib/zip_algorithm_bzip2.c
|
|
+++ b/lib/zip_algorithm_bzip2.c
|
|
@@ -33,7 +33,7 @@
|
|
|
|
#include "zipint.h"
|
|
|
|
-#include <bzlib.h>
|
|
+#include "../../bzip2/bzlib.h"
|
|
#include <limits.h>
|
|
#include <stdlib.h>
|
|
|
|
--- a/lib/zip_algorithm_deflate.c
|
|
+++ b/lib/zip_algorithm_deflate.c
|
|
@@ -35,7 +35,7 @@
|
|
|
|
#include <limits.h>
|
|
#include <stdlib.h>
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
struct ctx {
|
|
zip_error_t *error;
|
|
--- a/lib/zip_algorithm_xz.c
|
|
+++ b/lib/zip_algorithm_xz.c
|
|
@@ -35,9 +35,9 @@
|
|
#include "zipint.h"
|
|
|
|
#include <limits.h>
|
|
-#include <lzma.h>
|
|
+#include "../../liblzma/src/liblzma/api/lzma.h"
|
|
#include <stdlib.h>
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
enum header_state { INCOMPLETE, OUTPUT, DONE };
|
|
|
|
--- a/lib/zip_algorithm_zstd.c
|
|
+++ b/lib/zip_algorithm_zstd.c
|
|
@@ -34,8 +34,8 @@
|
|
#include "zipint.h"
|
|
|
|
#include <stdlib.h>
|
|
-#include <zstd.h>
|
|
-#include <zstd_errors.h>
|
|
+#include "../../zstd/lib/zstd.h"
|
|
+#include "../../zstd/lib/zstd_errors.h"
|
|
|
|
struct ctx {
|
|
zip_error_t *error;
|
|
--- a/lib/zip_dirent.c
|
|
+++ b/lib/zip_dirent.c
|
|
@@ -37,7 +37,7 @@
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
#include <time.h>
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
#include "zipint.h"
|
|
|
|
--- a/lib/zip_error_strerror.c
|
|
+++ b/lib/zip_error_strerror.c
|
|
@@ -35,7 +35,7 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
#include "zipint.h"
|
|
|
|
--- a/lib/zip_io_util.c
|
|
+++ b/lib/zip_io_util.c
|
|
@@ -34,7 +34,7 @@
|
|
#include <limits.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
#include "zipint.h"
|
|
|
|
--- a/lib/zip_pkware.c
|
|
+++ b/lib/zip_pkware.c
|
|
@@ -33,7 +33,7 @@
|
|
|
|
|
|
#include <stdlib.h>
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
#include "zipint.h"
|
|
|
|
--- a/lib/zip_source_crc.c
|
|
+++ b/lib/zip_source_crc.c
|
|
@@ -34,7 +34,7 @@
|
|
|
|
#include <limits.h>
|
|
#include <stdlib.h>
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
#include "zipint.h"
|
|
|
|
--- a/lib/zip_string.c
|
|
+++ b/lib/zip_string.c
|
|
@@ -34,7 +34,7 @@
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
#include "zipint.h"
|
|
|
|
--- a/src/zipcmp.c
|
|
+++ b/src/zipcmp.c
|
|
@@ -45,7 +45,7 @@
|
|
#ifdef HAVE_FTS_H
|
|
#include <fts.h>
|
|
#endif
|
|
-#include <zlib.h>
|
|
+#include "../../zlib/zlib.h"
|
|
|
|
#ifndef HAVE_GETOPT
|
|
#include "getopt.h"
|