# How to Build

## Prerequisites

To build **fuse-archive**, you need the following libraries:

*   [Boost Intrusive](https://www.boost.org)
*   [libfuse >= 3.1](https://github.com/libfuse/libfuse)
*   [libarchive >= 3.7](https://libarchive.org)

On Debian systems, you can get these libraries by installing the following
packages:

```sh
$ sudo apt install libboost-container-dev libfuse3-dev libarchive-dev
```

For compatibility reasons, **fuse-archive** can optionally use the old FUSE 2
library [libfuse >= 2.9](https://github.com/libfuse/libfuse). On Debian systems,
you can install FUSE 2 by installing the following package:

```sh
$ sudo apt install libfuse-dev
```

To build **fuse-archive**, you also need the following tools:

*   C++23 compiler (g++ 13+ or clang++ 16+)
*   [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/)
*   [GNU make](https://www.gnu.org/software/make/)
*   [GoogleTest](https://github.com/google/googletest) (for unit tests)
*   [Pandoc](https://pandoc.org) to regenerate the man page

On Debian systems, you can get these tools by installing the following packages:

```sh
$ sudo apt install g++ pkg-config make libgtest-dev pandoc
```

To test **fuse-archive**, you also need the following external programs for
certain formats and encodings:

*   [Python 3](https://www.python.org) (required for the test runner)
*   `umount` (required to unmount test file systems)
*   `base64` (from `coreutils`)
*   [`brotli`](https://github.com/google/brotli)
*   [`compress`](https://en.wikipedia.org/wiki/Compress_(software)) (from `ncompress`)
*   [`gpg`](https://www.gnupg.org)
*   [`lrzip`](https://github.com/ckolivas/lrzip)
*   [`lzop`](https://www.lzop.org/)

Most other formats, such as ZIP, 7Z, RAR, TAR, ISO, UU, Lzip, XZ, and Gzip, are
handled natively by the libraries or by the mounter itself and do not require
additional tools.

On Debian systems, you can install the necessary tools by running:

```sh
$ sudo apt install mount python3 brotli coreutils gpg lrzip lzop ncompress
```

## Get the Source Code

```sh
$ git clone https://github.com/google/fuse-archive.git
$ cd fuse-archive
```

## Build **fuse-archive**

```sh
$ make
```

### With debugging assertions

```sh
$ DEBUG=1 make
```

### With FUSE 2

```sh
$ FUSE_MAJOR_VERSION=2 make
```

## Test **fuse-archive**

### All tests (including slow tests)

```sh
$ make check
```

### Only fast tests

```sh
$ make check-fast
```

## Install **fuse-archive**

```sh
$ sudo make install
```

## Uninstall **fuse-archive**

```sh
$ sudo make uninstall
```
