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..87bf70f 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,12 @@ 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: - [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 +24,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,21 +74,22 @@ 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. 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 a36a0ea..f2bacf7 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 @@ -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 @@ -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 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);