Skip to content

Commit

Permalink
Merge pull request #20 from ctabin/update-libzip
Browse files Browse the repository at this point in the history
Update to libzip 1.3.0
  • Loading branch information
ctabin authored Sep 13, 2017
2 parents 918c26b + 1aecf7a commit 8f1e339
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SET(PACKAGE "libzippp")
SET(VERSION "0.2")

SET(ZLIB_PATH "lib/zlib-1.2.11" CACHE STRING "Path to zlib")
SET(LIBZIP_PATH "lib/libzip-1.2.0" CACHE STRING "Path to libzip")
SET(LIBZIP_PATH "lib/libzip-1.3.0" CACHE STRING "Path to libzip")

FIND_PACKAGE(ZLIB REQUIRED)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ OBJ=obj
LIB=lib
ZLIB_VERSION=1.2.11
ZLIB=$(LIB)/zlib-$(ZLIB_VERSION)
LIBZIP_VERSION=1.2.0
LIBZIP_VERSION=1.3.0
LIBZIP=$(LIB)/libzip-$(LIBZIP_VERSION)

# for optimal compilation speed, should be <nb_proc>+1
Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ 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)
- MS Visual Studio 2012 (Windows 7)

Underlying libraries:
- [ZLib](http://zlib.net) 1.2.11
- [libzip](http://www.nih.at/libzip) 1.2.0
- [libzip](http://www.nih.at/libzip) 1.3.0

# Compilation

Expand All @@ -25,13 +26,13 @@ Underlying libraries:
3. You may want to run the tests (optional): ```make tests```
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.2.0/lib/.libs/*).
against libzip libraries in *lib/libzip-1.3.0/lib/.libs/*).
An example of compilation with g++:

```Shell
g++ -I./lib/libzip-1.2.0/lib -I./src \
g++ -I./lib/libzip-1.3.0/lib -I./src \
main.cpp libzippp.a \
lib/libzip-1.2.0/lib/.libs/libzip.a \
lib/libzip-1.3.0/lib/.libs/libzip.a \
lib/zlib-1.2.11/libz.a
```

Expand All @@ -43,15 +44,15 @@ g++ -I./lib/libzip-1.2.0/lib -I./src \
<MSVS11>\Common7\Tools\VsDevCmd.bat
```

1. Download [libzip](http://www.nih.at/libzip/libzip-1.2.0.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.3.0.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.2.0
libzippp/lib/libzip-1.3.0
```

2. Extract the file *lib/libzip-1.2.0-windows-VS2012-patch.zip*. This file contains
2. Extract the file *lib/libzip-1.3.0-windows-patch.zip*. This file contains
changes to be done in libzip in order to compile successfully with Visual
Studio 2012. Simply accept the erasing of the file (a #define has been added
in zip.h).
Expand Down Expand Up @@ -196,3 +197,10 @@ that will use it. To avoid this issue, you'll have to link the library staticall

More information [here](http://www.codeproject.com/Articles/28969/HowTo-Export-C-classes-from-a-DLL).

#### Libzip windows patch

The following files have been patch in order to compile with VS2012 on windows:
* lib/CMakeFiles.txt => add SHARED keyword and STATIC library
* src/ziptool.c => redefine STDIN_FILENO
* regress/fseek.c => add `compat.h`

2 changes: 1 addition & 1 deletion compile.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.0
SET libzip=lib\libzip-1.3.0

if not exist "%zlib%" goto error_zlib_not_found
if not exist "%libzip%" goto error_libzip_not_found
Expand Down
Binary file removed lib/libzip-1.2.0-windows-VS2012-patch.zip
Binary file not shown.
Binary file added lib/libzip-1.3.0-windows-patch.zip
Binary file not shown.

0 comments on commit 8f1e339

Please sign in to comment.