summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 02bd3cb33e664a1945b21dd204844c1936da621a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Maintainer:
# Contributor: sp1rit <sp1ritCS@protonmail.com>

: ${CARGO_HOME:=$SRCDEST/cargo-home}
: ${RUSTUP_TOOLCHAIN:=stable}
: ${CARGO_TARGET_DIR:=target}

export CARGO_HOME CARGO_TARGET_DIR RUSTUP_TOOLCHAIN

_pkgname=czkawka
pkgname="$_pkgname-git"
pkgver=7.0.0.r4.g2a32a52
pkgrel=2
pkgdesc="Multi-functional app to find duplicates, similar images, and empty folders"
url="https://github.com/qarmin/czkawka"
license=('MIT')
arch=('x86_64')

depends=(
  'gtk4'
  'libheif'
)
makedepends=(
  'git'
  'cargo'
)

provides=(
  "czkawka=${pkgver%%.r*}"
  "czkawka-cli=${pkgver%%.r*}"
  "czkawka-gui=${pkgver%%.r*}"
  "krokiet=${pkgver%%.r*}"
)
conflicts=(
  "czkawka"
  "czkawka-cli"
  "czkawka-gui"
  "krokiet"
)

_pkgsrc="$_pkgname"
source=("$_pkgname"::"git+$url.git")
sha256sums=("SKIP")

prepare() {
  cd "$_pkgsrc"
  cargo update
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  local _cargo_options=(
    --bin czkawka_cli
    --bin czkawka_gui
    --bin krokiet
    --features heif
    --release
  )

  cd "$_pkgsrc"
  cargo build "${_cargo_options[@]}"
}

check() {
  cd "$_pkgsrc/czkawka_core"
  cargo test
}

package() {
  cd "$_pkgsrc"

  # binaries
  install -Dm755 "$CARGO_TARGET_DIR"/release/czkawka_gui -t "$pkgdir/usr/bin/"
  install -Dm755 "$CARGO_TARGET_DIR"/release/czkawka_cli -t "$pkgdir/usr/bin/"
  install -Dm755 "$CARGO_TARGET_DIR"/release/krokiet -t "$pkgdir/usr/bin/"

  # symlink
  ln -sf "czkawka_gui" "$pkgdir/usr/bin/czkawka"

  # launcher
  install -Dm644 data/com.github.qarmin.czkawka.desktop -t "$pkgdir/usr/share/applications/"

  # license
  for i in czkawka_cli czkawka_core czkawka_gui krokiet; do
    install -Dm644 "$i/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE.$i"
  done
}