libzip uses cmake to build.
For running the tests, you need to have perl.
You'll need zlib (at least version 1.1.2). It comes with most operating systems.
For supporting bzip2-compressed zip archives, you need bzip2.
For supporting lzma- and xz-compressed zip archives, you need liblzma which is part of xz, at least version 5.2.
For supporting zstd-compressed zip archives, you need zstd.
For AES (encryption) support, you need one of these cryptographic libraries, listed in order of preference:
If you don't want a library even if it is installed, you can pass
-DENABLE_<LIBRARY>=OFF to cmake, where
<LIBRARY> is one of
The basic usage is
mkdir build cd build cmake .. make make test make install
Some useful parameters you can pass to
BUILD_SHARED_LIBS: set to
OFFto enable/disable building of shared libraries, defaults to
CMAKE_INSTALL_PREFIX: for setting the installation path
DOCUMENTATION_FORMAT: choose one of
htmlfor the installed documentation (default: decided by cmake depending on available tools)
LIBZIP_DO_INSTALL: If you include libzip as a subproject, link it statically and do not want to let it install its files, set this variable to
OFF. Defaults to
If you want to compile with custom
CFLAGS, set them in the environment before running
CFLAGS=-DMY_CUSTOM_FLAG cmake ..
If you are compiling on a system with a small stack size, add
If you are building on a 32-bit Linux system it might be necessary to define
64. Your distro will need to provide a
fts.h file that is new enough to support this, or the build will break in
You can get verbose build output with by passing
You can also check the cmake FAQ.