## Prerequisites & Sources

- No requirements.
- Download [WebMinifier source archives and packages](https://fox-echo.info/webminifier/res/)


## Build and install

This software is programmed in C language and uses the CMake build system.
From the project root directory, run:

```sh
mkdir build
cd build
cmake .. [-DCMAKE_INSTALL_PREFIX=/usr] [-DCMAKE_INSTALL_LIBDIR=lib64]
make
sudo make install [DESTDIR=$(pwd)/pack]
```

To uninstall, run: `sudo make uninstall`


## Manual build

*For those who do not have or do not want to install the CMake build system,
building is possible with a single make command or even a simple compiler
(tested with GCC and CLang).*

### Without CMake

From `src` directory, run: `make build`.

### Without Make

From `src` directory, run:

```sh
gcc -c -fpic webminifier.c
gcc -shared -o libwebminifier.so webminifier.o
rm -f webminifier.o
gcc -o webminifier main.c -lwebminifier -L .
```

`gcc` can be replaced by `clang`.

Library file is `libwebminifier.so`, and executable is `webminifier`; usage:

```sh
LD_LIBRARY_PATH=. ./webminifier path/to/original/css_or_html_file path/to/minified_file
```

Library can be embedded into executable:

```sh
gcc [-static] -o webminifier libwebminifier.c webminifier.c
```
