aboutsummaryrefslogtreecommitdiff
path: root/PKGBUILD
blob: 3ffd4be86528bfc9afd516f79423d2a351e5e0fd (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
# shellcheck disable=SC2034,SC2154,SC2164
# Maintainer: pml68 <contact@pml68.dev>

_pkgname=iced-builder
pkgname=$_pkgname-git
pkgver=r212.a17a972
pkgrel=2
pkgdesc='UI builder for iced, built with iced.'
arch=(x86_64)
url='https://git.sr.ht/~pml68/iced-builder'
license=('GPL-3.0-or-later')
depends=(
  gcc-libs
  glibc
  openssl
)
makedepends=(
  git
  cargo
)
options=('!lto' '!strip' '!debug')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("$_pkgname::git+${url}")
sha256sums=('SKIP')

prepare() {
  cd "${_pkgname}"

  export RUSTUP_TOOLCHAIN=stable
  cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

pkgver() {
  cd "${_pkgname}"
  (
    set -o pipefail
    git describe --long --abbrev=7 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
  )
}

build() {
  cd "${_pkgname}"

  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  export RUSTFLAGS="${RUSTFLAGS} --remap-path-prefix $srcdir=src"
  cargo build --frozen --release
}

check() {
  cd "${_pkgname}"

  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo test --frozen --release
}

package() {
  cd "${_pkgname}"

  install -Dm755 "target/release/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  install -Dm644 "assets/linux/dev.pml68.${_pkgname}.desktop" -t "${pkgdir}/usr/share/applications"
}