Bump to 1.10.1
[platform/upstream/libzip.git] / INSTALL.md
1 libzip uses [cmake](https://cmake.org) to build.
2
3 You'll need [zlib](http://www.zlib.net/) (at least version 1.1.2). It
4 comes with most operating systems.
5
6 For supporting bzip2-compressed zip archives, you need
7 [bzip2](http://bzip.org/).
8
9 For supporting lzma- and xz-compressed zip archives, you need
10 [liblzma](https://tukaani.org/xz/) which is part of xz, at least version 5.2.
11
12 For supporting zstd-compressed zip archives, you need
13 [zstd](https://github.com/facebook/zstd/).
14
15 For AES (encryption) support, you need one of these cryptographic libraries,
16 listed in order of preference:
17
18 - Apple's CommonCrypto (available on macOS and iOS)
19 - Microsoft Windows Cryptography Framework
20 - [OpenSSL](https://www.openssl.org/) >= 1.0.
21 - [GnuTLS](https://www.gnutls.org/) and [Nettle](https://www.lysator.liu.se/~nisse/nettle/) (at least nettle 3.0)
22 - [mbed TLS](https://tls.mbed.org/)
23
24 If you don't want a library even if it is installed, you can
25 pass `-DENABLE_<LIBRARY>=OFF` to cmake, where `<LIBRARY>` is one of
26 `COMMONCRYPTO`, `GNUTLS`, `MBEDTLS`, or `OPENSSL`.
27
28 For running the tests, you need to have
29 [Python](https://www.python.org/) and
30 [nihtest](https://pypi.org/project/nihtest/) installed.
31
32 The basic usage is
33 ```sh
34 mkdir build
35 cd build
36 cmake ..
37 make
38 make test
39 make install
40 ```
41
42 Some useful parameters you can pass to `cmake` with `-Dparameter=value`:
43
44 - `BUILD_SHARED_LIBS`: set to `ON` or `OFF` to enable/disable building
45   of shared libraries, defaults to `ON`
46 - `CMAKE_INSTALL_PREFIX`: for setting the installation path
47 - `DOCUMENTATION_FORMAT`: choose one of `man`, `mdoc`, and `html` for
48   the installed documentation (default: decided by cmake depending on
49   available tools)
50 - `LIBZIP_DO_INSTALL`: If you include libzip as a subproject, link it
51   statically and do not want to let it install its files, set this
52   variable to `OFF`. Defaults to `ON`.
53
54 If you want to compile with custom `CFLAGS`, set them in the environment
55 before running `cmake`:
56 ```sh
57 CFLAGS=-DMY_CUSTOM_FLAG cmake ..
58 ```
59
60 If you are compiling on a system with a small stack size, add
61 `-DZIP_ALLOCATE_BUFFER` to `CFLAGS`.
62
63 If you are building on a 32-bit Linux system it might be necessary
64 to define `_FILE_OFFSET_BITS` to `64`. Your distro will need to provide
65 a `fts.h` file that is new enough to support this, or the build
66 will break in `zipcmp`.
67
68 You can get verbose build output with by passing `VERBOSE=1` to
69 `make`.
70
71 You can also check the [cmake FAQ](https://gitlab.kitware.com/cmake/community/-/wikis/FAQ).