2021-07-02 16:39:44 +00:00
# Compiling Czkawka from sources
2021-05-01 09:14:02 +00:00
## Requirements
2022-01-07 15:46:07 +00:00
2022-01-07 15:53:03 +00:00
If you only want the terminal version without a GUI, just skip all the packages with `gtk` in their names.
2022-05-18 16:46:34 +00:00
FFmpeg is not included here because it is not needed to build - it is dynamically loaded.
2022-01-07 15:53:03 +00:00
2022-06-08 19:42:51 +00:00
Support for heif images is optional and require to install libheif library.
2023-02-26 10:50:54 +00:00
New versions of GTK fixes some bugs, so e.g. middle button selection will work only with GTK >=4.8.
2022-01-07 15:53:03 +00:00
2023-02-19 09:21:14 +00:00
| Program | Min | What for |
|---------|--------|--------------------------------------------------------------------------------------|
2023-03-05 19:54:02 +00:00
| Rust | 1.67.1 | The minimum version of rust does not depend on anything, so it can change frequently |
2023-02-19 09:21:14 +00:00
| GTK | 4.6 | Only for the `GTK` backend |
2021-05-01 09:14:02 +00:00
#### Debian / Ubuntu
```shell
2022-03-11 04:43:54 +00:00
sudo apt install -y curl git build-essential # Needed by Rust update tool
2021-05-01 09:14:02 +00:00
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Download the latest stable Rust
2022-05-22 08:59:09 +00:00
sudo apt install -y libgtk-4-dev
2021-05-01 09:14:02 +00:00
```
#### Fedora / CentOS / Rocky Linux
```shell
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Download the latest stable Rust
2022-07-31 06:45:19 +00:00
sudo yum install gtk4-devel glib2-devel
2021-05-01 09:14:02 +00:00
```
#### macOS
2022-07-31 06:45:19 +00:00
You need to install Rust via Homebrew, GTK Libraries and optionally heif library(to have support for heic files, which are quite popular on Mac)
2021-05-01 09:14:02 +00:00
```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install rustup
rustup-init
2023-02-26 10:50:54 +00:00
brew install gtk4 adwaita-icon-theme librsvg libheif webp-pixbuf-loader
2021-05-01 09:14:02 +00:00
```
### Windows
2023-02-26 10:50:54 +00:00
Compiling Czkawka on Windows is possible, but due using GTK is very hard.
2021-05-01 09:14:02 +00:00
2023-02-26 10:50:54 +00:00
In CI we use cross compilation which simplify a lot of things, so for now there is no instruction how to compile native binaries on Windows.
2021-05-01 09:14:02 +00:00
2022-01-06 20:31:44 +00:00
### Docker
```shell
docker build ./misc/docker/ --tag cargo-gtk
```
2021-05-01 09:14:02 +00:00
## Compilation
2021-11-25 10:15:31 +00:00
Czkawka can be installed with Debug or Release build.
2022-05-18 16:46:34 +00:00
With Debug build additional checks, e.g., variables overflow, are available, but depending on the usage it works very slow, so it should be used only for development purposes.
Compilation with `--release` flag will optimize binaries, so they can be used with good performance (official binaries are built with this flag)
2021-11-25 10:15:31 +00:00
2021-05-01 09:14:02 +00:00
- Download the source
```
git clone https://github.com/qarmin/czkawka.git
cd czkawka
```
- Compile and run GTK GUI
```
cargo run --release --bin czkawka_gui
```
- Compile and run CLI (by default this will print help with examples)
```
cargo run --release --bin czkawka_cli
```
2022-01-06 20:31:44 +00:00
## Compilation with Docker
```shell
docker run -t --rm --volume $PWD:/app --workdir /app cargo-gtk cargo build --release --bin czkawka_gui
```
Run the binary:
```shell
target/release/czkawka_gui
```
2021-05-01 09:14:02 +00:00
## Additional features
2022-07-31 06:45:19 +00:00
Currently, the only additional dependence is heif image support.
2021-05-01 09:14:02 +00:00
2022-07-31 06:45:19 +00:00
To enable checking for heif images, just add ` --all-features` or `--features heif`
2021-05-01 09:14:02 +00:00
```
2022-07-31 06:45:19 +00:00
cargo run --features heif --bin czkawka_cli -- image -d /home/rafal/ -f "results.txt"
2022-01-06 20:31:44 +00:00
```