summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 23f2996fa8f4792f339c459c2b98e14c00f77c09 (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
# Maintainer: SandaruKasa <sandarukasa plus aur at ya dot ru>

pkgname=okolors-git
pkgver=0.5.1.r199.ed2e86a
pkgrel=1
pkgdesc='Generate a color palette from an image using k-means clustering in the Oklab color space'
arch=('x86_64' 'aarch64')
url="https://github.com/Ivordir/Okolors"
license=('MIT' 'Apache')
makedepends=(git rust cargo coreutils sed gcc)
depends=(gcc-libs glibc)
conflicts=("${pkgname%-git}")
provides=("${pkgname%-git}")
_git_folder="${pkgname%-git}"
source=("${_git_folder}::git+$url.git")
sha256sums=(SKIP)

prepare() {
  cd "${_git_folder}/okolors-bin"
  cargo fetch --locked --target "${CARCH}-unknown-linux-gnu"
}

pkgver() {
  cd "${_git_folder}/okolors-bin"
  printf "%s.r%s.%s" \
    "$(cargo pkgid | cut -d# -f2 | cut -d@ -f2 | cut -d: -f2 | sed 's/-/_/g')" \
    "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "${_git_folder}/okolors-bin"
  export CARGO_TARGET_DIR=../target
  cargo build --frozen --release --all-features
}

check() {
  cd "${_git_folder}/okolors-bin"
  cargo test --frozen --all-features
}

package() {
  cd "${_git_folder}"
  install -Dm755 target/release/"${pkgname%-git}" -t "$pkgdir/usr/bin/"

  install -Dm644 LICENSE-MIT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-MIT"
  install -Dm644 LICENSE-APACHE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-APACHE"
}