From 1c802ff6447d138840016291554c632a9acd8719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Tabin?= Date: Sun, 17 Mar 2019 17:57:13 +0100 Subject: [PATCH 1/4] Update to libzip 1.5.2 --- Makefile | 2 +- README.md | 12 ++++++------ compile.bat | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 4830fd8..143b620 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ OBJ=obj LIB=lib ZLIB_VERSION=1.2.11 ZLIB=$(LIB)/zlib-$(ZLIB_VERSION) -LIBZIP_VERSION=1.5.1 +LIBZIP_VERSION=1.5.2 LIBZIP=$(LIB)/libzip-$(LIBZIP_VERSION) LIBZIP_CMAKE=-DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF CRYPTO_FLAGS=-lssl -lcrypto diff --git a/README.md b/README.md index 20e4194..71dbe1d 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Compilation has been tested with: Underlying libraries: - [ZLib](http://zlib.net) 1.2.11 -- [libzip](http://www.nih.at/libzip) 1.5.1 +- [libzip](http://www.nih.at/libzip) 1.5.2 # Compilation @@ -27,13 +27,13 @@ Underlying libraries: 3. You may want to run the tests (optional): `make tests` (`libbz2-dev` package is needed to link statically) 4. Now you just have to include the src folder in your include path and link against *libzippp.a* or *libzippp.so* (do not forget to also link - against libzip libraries in *lib/libzip-1.5.1/lib/.libs/*). + against libzip libraries in *lib/libzip-1.5.2/lib/.libs/*). An example of compilation with g++: ```shell -g++ -I./lib/libzip-1.5.1/lib -I./src \ +g++ -I./lib/libzip-1.5.2/lib -I./src \ main.cpp libzippp.a \ - lib/libzip-1.5.1/lib/.libs/libzip.a \ + lib/libzip-1.5.2/lib/.libs/libzip.a \ lib/zlib-1.2.11/libz.a ``` @@ -77,12 +77,12 @@ See [here](https://github.com/nih-at/libzip/blob/master/INSTALL.md) for more inf \Common7\Tools\VsDevCmd.bat ``` -1. Download [libzip](http://www.nih.at/libzip/libzip-1.5.1.tar.gz) and [zlib](http://zlib.net/zlib1211.zip) sources and extract them in the 'lib' folder. +1. Download [libzip](http://www.nih.at/libzip/libzip-1.5.2.tar.gz) and [zlib](http://zlib.net/zlib1211.zip) sources and extract them in the 'lib' folder. You should end up with the following structure: ``` libzippp/compile.bat libzippp/lib/zlib-1.2.11 - libzippp/lib/libzip-1.5.1 + libzippp/lib/libzip-1.5.2 ``` 2. Execute the *compile.bat* (simply double-click on it). The compilation should diff --git a/compile.bat b/compile.bat index a36a0ea..8ce183a 100644 --- a/compile.bat +++ b/compile.bat @@ -3,7 +3,7 @@ SET vs2012devprompt=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat SET zlib=lib\zlib-1.2.11 -SET libzip=lib\libzip-1.5.1 +SET libzip=lib\libzip-1.5.2 if not exist "%zlib%" goto error_zlib_not_found if not exist "%libzip%" goto error_libzip_not_found From ff515351b34fc5cd7dabd5a6ef306138510ae2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Tabin?= Date: Sun, 5 May 2019 21:09:50 +0200 Subject: [PATCH 2/4] Updates the tested GCC versions --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 71dbe1d..75c0d71 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,7 @@ libzippp is a simple basic C++ wrapper around the libzip library. It is meant to be a portable and easy-to-use library for ZIP handling. Compilation has been tested with: -- GCC 4.9.3 (GNU/Linux Gentoo) -- GCC 6.2.1 (GNU/Linux Debian) -- GCC 6.3.0 (GNU/Linux Debian) -- GCC 7.2.0 (GNU/Linux Debian) +- GCC 8.3.0 (GNU/Linux Debian) - MS Visual Studio 2012 (Windows 7) Underlying libraries: From 22fcf23e07e0e7a40f855496884eb853bd60a4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Tabin?= Date: Sun, 5 May 2019 21:54:20 +0200 Subject: [PATCH 3/4] Compilation of libzip 1.5.2 on Windows --- README.md | 7 ++++--- compile.bat | 2 +- lib/libzip-1.5.2-windows.patch | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 lib/libzip-1.5.2-windows.patch diff --git a/README.md b/README.md index 75c0d71..87bf70f 100644 --- a/README.md +++ b/README.md @@ -81,14 +81,15 @@ See [here](https://github.com/nih-at/libzip/blob/master/INSTALL.md) for more inf libzippp/lib/zlib-1.2.11 libzippp/lib/libzip-1.5.2 ``` +2. Apply the modifications described in libzippp/lib/libzip-1.5.2-windows.patch. -2. Execute the *compile.bat* (simply double-click on it). The compilation should +3. Execute the *compile.bat* (simply double-click on it). The compilation should go without error. -3. You'll have a *dist* folder containing the *release* and *debug* folders +4. You'll have a *dist* folder containing the *release* and *debug* folders where you can now execute the libzippp tests. -4. You can either use *libzippp.dll* and *libzippp.lib* to link dynamically the +5. You can either use *libzippp.dll* and *libzippp.lib* to link dynamically the library or simply use *libzippp_static.lib* to link it statically. Unless you also link zlib and libzippp statically, you'll need the dll packaged with your executable. diff --git a/compile.bat b/compile.bat index 8ce183a..a9c9eff 100644 --- a/compile.bat +++ b/compile.bat @@ -31,7 +31,7 @@ echo Compiling libzip... cd "%libzip%" mkdir build cd "build" -cmake .. -G"Visual Studio 11" -DCMAKE_PREFIX_PATH="../../%zlib%/build/install" +cmake .. -G"Visual Studio 11" -DCMAKE_PREFIX_PATH="../../%zlib%/build/install" -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF -DENABLE_WINDOWS_CRYPTO=ON -DENABLE_BZIP2=OFF -DBUILD_TOOLS=OFF -DBUILD_REGRESS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_DOC=OFF if %ERRORLEVEL% GEQ 1 goto error_libzip msbuild /P:Configuration=Debug ALL_BUILD.vcxproj if %ERRORLEVEL% GEQ 1 goto error_libzip diff --git a/lib/libzip-1.5.2-windows.patch b/lib/libzip-1.5.2-windows.patch new file mode 100644 index 0000000..812c0b7 --- /dev/null +++ b/lib/libzip-1.5.2-windows.patch @@ -0,0 +1,24 @@ +diff -u libzip-1.5.2/lib/zip_crypto_win.c libzip-1.5.2-win/lib/zip_crypto_win.c +--- libzip-1.5.2/lib/zip_crypto_win.c 2019-03-12 12:44:02.000000000 +0100 ++++ libzip-1.5.2-win/lib/zip_crypto_win.c 2019-05-05 21:41:01.203275000 +0200 +@@ -80,7 +80,7 @@ + */ + + #if !defined(WINCE) && !defined(__MINGW32__) +-#define HAS_BCRYPTDERIVEKEYPBKDF2 ++//#define HAS_BCRYPTDERIVEKEYPBKDF2 + #endif + + #ifdef HAS_BCRYPTDERIVEKEYPBKDF2 +diff -u libzip-1.5.2/lib/zip_source_winzip_aes_encode.c libzip-1.5.2-win/lib/zip_source_winzip_aes_encode.c +--- libzip-1.5.2/lib/zip_source_winzip_aes_encode.c 2019-03-12 12:44:02.000000000 +0100 ++++ libzip-1.5.2-win/lib/zip_source_winzip_aes_encode.c 2019-05-05 21:51:31.213545000 +0200 +@@ -163,7 +163,7 @@ + /* TODO: return partial read? */ + return -1; + } +- buffer_n += _zip_buffer_read(ctx->buffer, data + ret, length - (zip_uint64_t)ret); ++ buffer_n += _zip_buffer_read(ctx->buffer, ((size_t)data) + ret, length - (zip_uint64_t)ret); + } + + return (zip_int64_t)(buffer_n + (zip_uint64_t)ret); From c869178a8612b674c9d3e51f70967d5a68fe86b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Tabin?= Date: Sun, 5 May 2019 22:01:39 +0200 Subject: [PATCH 4/4] Copies libzippp headers to dist folders --- compile.bat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compile.bat b/compile.bat index a9c9eff..f2bacf7 100644 --- a/compile.bat +++ b/compile.bat @@ -62,6 +62,7 @@ if exist "dist\libzippp_static.lib" goto end mkdir "dist" cd "dist" mkdir release +copy ..\src\libzippp.h release copy ..\build\Release\libzippp_shared_test.exe release copy ..\build\Release\libzippp_static_test.exe release copy ..\build\Release\libzippp.dll release @@ -70,6 +71,7 @@ copy ..\build\Release\libzippp_static.lib release copy ..\%zlib%\build\Release\zlib.dll release copy ..\%libzip%\build\lib\Release\zip.dll release mkdir debug +copy ..\src\libzippp.h debug copy ..\build\Debug\libzippp_shared_test.exe debug copy ..\build\Debug\libzippp_static_test.exe debug copy ..\build\Debug\libzippp.dll debug