forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zlib: Return building minizip library
- Loading branch information
Showing
8 changed files
with
669 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From c162a3620a3d0d317f59af8ddc2d1605bf5ee4b3 Mon Sep 17 00:00:00 2001 | ||
From: martell <[email protected]> | ||
Date: Sat, 11 Oct 2014 03:32:38 +0100 | ||
Subject: [PATCH 1/3] unzip: add function unzOpenBuffer | ||
|
||
--- | ||
unzip.c | 11 +++++++++++ | ||
unzip.h | 2 ++ | ||
2 files changed, 13 insertions(+) | ||
|
||
diff --git a/unzip.c b/unzip.c | ||
index 11030cb..1f4bdda 100644 | ||
--- a/unzip.c | ||
+++ b/unzip.c | ||
@@ -29,6 +29,7 @@ | ||
|
||
#include "zlib.h" | ||
#include "unzip.h" | ||
+#include "ioapi_mem.h" | ||
|
||
#ifdef HAVE_AES | ||
# define AES_METHOD (99) | ||
@@ -553,6 +554,16 @@ extern unzFile ZEXPORT unzOpen64(const void *path) | ||
return unzOpenInternal(path, NULL); | ||
} | ||
|
||
+extern unzFile ZEXPORT unzOpenBuffer(const void* buffer, uLong size) | ||
+{ | ||
+ char path[48] = {0}; | ||
+ ourmemory_t FileMemory; | ||
+ zlib_filefunc64_32_def memory_file; | ||
+ sprintf(path, "%llx %lx", (unsigned long long)buffer, (unsigned long)size); | ||
+ fill_memory_filefunc(&memory_file, &FileMemory); | ||
+ return unzOpenInternal(path, &memory_file); | ||
+} | ||
+ | ||
extern int ZEXPORT unzClose(unzFile file) | ||
{ | ||
unz64_s *s; | ||
diff --git a/unzip.h b/unzip.h | ||
index 1aa197f..8503471 100644 | ||
--- a/unzip.h | ||
+++ b/unzip.h | ||
@@ -131,6 +131,8 @@ extern unzFile ZEXPORT unzOpen64(const void *path); | ||
open64_file_func callback. Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path | ||
is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char *does not describe the reality */ | ||
|
||
+extern unzFile ZEXPORT unzOpenBuffer OF((const void* buffer, uLong size)); | ||
+/* Open a Zip file, like unzOpen, but from a buffer */ | ||
extern unzFile ZEXPORT unzOpen2(const char *path, zlib_filefunc_def *pzlib_filefunc_def); | ||
/* Open a Zip file, like unzOpen, but provide a set of file low level API for read/write operations */ | ||
extern unzFile ZEXPORT unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def); | ||
-- | ||
2.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- minizip/CMakeLists.txt.orig 2018-11-01 09:39:57.256660300 +0300 | ||
+++ minizip/CMakeLists.txt 2018-11-01 09:48:31.840164200 +0300 | ||
@@ -15,9 +15,15 @@ | ||
|
||
project("minizip") | ||
|
||
+# Minizip library version | ||
+set(VERSION "1.2") | ||
+ | ||
# set cmake debug postfix to d | ||
set(CMAKE_DEBUG_POSTFIX "d") | ||
|
||
+set(MINIZIP_PC ${CMAKE_CURRENT_BINARY_DIR}/minizip.pc) | ||
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/minizip.pc.cmakein ${MINIZIP_PC} @ONLY) | ||
+ | ||
# Ensure correct version of zlib is referenced | ||
set(ZLIB_ROOT ${DEF_ZLIB_ROOT} CACHE PATH "Parent directory of zlib installation") | ||
find_package(ZLIB REQUIRED) | ||
@@ -116,6 +122,8 @@ | ||
install(FILES ${MINIZIP_PUBLIC_HEADERS} | ||
DESTINATION "include/minizip") | ||
|
||
+install(FILES ${MINIZIP_PC} DESTINATION "lib/pkgconfig") | ||
+ | ||
option (BUILD_TEST "enabled building of executables minizip and miniunz. Requires ZLIB!" OFF) | ||
if(BUILD_TEST) | ||
add_executable(miniunz_exec miniunz.c minishared.c) | ||
--- minizip/minizip.pc.cmakein.orig 1970-01-01 03:00:00.000000000 +0300 | ||
+++ minizip/minizip.pc.cmakein 2018-11-01 09:44:56.762586400 +0300 | ||
@@ -0,0 +1,13 @@ | ||
+prefix=@CMAKE_INSTALL_PREFIX@ | ||
+exec_prefix=${prefix} | ||
+libdir=${prefix}/lib | ||
+includedir=${prefix}/include | ||
+ | ||
+Name: minizip | ||
+Description: Minizip zip file manipulation library | ||
+Version: @VERSION@ | ||
+ | ||
+Requires: zlib | ||
+Libs: -L${libdir} -lminizip | ||
+Libs.private: -lz | ||
+Cflags: -I${includedir}/minizip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- minizip/CMakeLists.txt.orig 2018-11-01 10:08:03.857622900 +0300 | ||
+++ minizip/CMakeLists.txt 2018-11-01 10:12:15.003464000 +0300 | ||
@@ -63,10 +63,6 @@ | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -msse4.1 -maes") | ||
endif() | ||
|
||
-# create minizip library | ||
-add_library(minizip ${MINIZIP_SRC} ${MINIZIP_PUBLIC_HEADERS}) | ||
-target_link_libraries(minizip ZLIB::ZLIB) | ||
- | ||
option(USE_AES "enables building of aes library" ON) | ||
if(USE_AES) | ||
set(AES_SRC | ||
@@ -93,22 +89,21 @@ | ||
aes/pwd2key.h | ||
aes/sha1.h) | ||
|
||
- add_library(aes ${AES_SRC} ${AES_PUBLIC_HEADERS}) | ||
- | ||
add_definitions(-DHAVE_AES) | ||
|
||
- target_link_libraries(minizip aes) | ||
- | ||
- install(TARGETS aes EXPORT minizip-exports | ||
- INCLUDES DESTINATION "include" | ||
- RUNTIME DESTINATION "bin" | ||
- LIBRARY DESTINATION "lib" | ||
- ARCHIVE DESTINATION "lib") | ||
- | ||
install(FILES ${AES_PUBLIC_HEADERS} | ||
DESTINATION "include/minizip/aes") | ||
endif() | ||
|
||
+# create minizip library | ||
+add_library(minizip ${MINIZIP_SRC} ${MINIZIP_PUBLIC_HEADERS} | ||
+ ${AES_SRC} ${AES_PUBLIC_HEADERS}) | ||
+set_target_properties(minizip PROPERTIES | ||
+ ARCHIVE_OUTPUT_NAME "minizip" | ||
+ OUTPUT_NAME "minizip" | ||
+ RUNTIME_OUTPUT_NAME "minizip-1") | ||
+target_link_libraries(minizip ZLIB::ZLIB) | ||
+ | ||
install(TARGETS minizip EXPORT minizip-exports | ||
INCLUDES DESTINATION "include" | ||
RUNTIME DESTINATION "bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- minizip/CMakeLists.txt.orig 2018-11-01 10:34:10.997658800 +0300 | ||
+++ minizip/CMakeLists.txt 2018-11-01 10:34:52.056930900 +0300 | ||
@@ -111,7 +111,7 @@ | ||
ARCHIVE DESTINATION "lib") | ||
|
||
install(EXPORT minizip-exports | ||
- DESTINATION "cmake" | ||
+ DESTINATION "lib/cmake" | ||
NAMESPACE "MINIZIP::") | ||
|
||
install(FILES ${MINIZIP_PUBLIC_HEADERS} |
Oops, something went wrong.