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