summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b28d8079735a3aad51cb2653630ea61dd33b14eb (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
# Maintainer:
# Contributor: Caleb Bassi <calebjbassi@gmail.com>

_pkgname="joshuto"
pkgname="$_pkgname-git"
pkgver=0.9.8.r19.g235f339
pkgrel=1
pkgdesc="ranger-like terminal file manager written in Rust"
url="https://github.com/kamiyaa/joshuto"
license=('LGPL-3.0-only')
arch=('x86_64')

depends=(
  'glibc'
  'gcc-libs'
)
makedepends=(
  "git"
  "cargo"
)
optdepends=(
  'fzf: for better file searching'
  'xclip: for clipboard support on X11'
  'xsel: for clipboard support on X11'
  'wl-clipboard: for clipboard support on Wayland'
  'zoxide: for use in cd functions'
)

provides=("$_pkgname=${pkgver%%.r*}")
conflicts=("$_pkgname")

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

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

_cargo_env() {
  : ${CARGO_HOME:=$SRCDEST/cargo-home}

  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
}

prepare() {
  _cargo_env

  cd "$_pkgsrc"
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  export CFLAGS+=" -ffat-lto-objects"

  _cargo_env

  cd "$_pkgsrc"
  cargo build --frozen --release --all-features
}

package() {
  install -Dm755 "$_pkgsrc/target/release/$_pkgname" -t "$pkgdir/usr/bin/"
}