summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 22d7ef4b1b92ead9db392795282c5dd8a95f5d5c (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: aquabeam <laithbahodi@gmail.com>

pkgname=org-rust
pkgver=0.1.17
pkgrel=1
url=https://github.com/hydrobeam/org-rust
pkgdesc='CLI tool for converting Org-Mode documents to other formats'
arch=('x86_64')
license=('MIT')
depends=()
makedepends=('cargo')
source=("$pkgname-$pkgver.tar.gz::https://static.crates.io/crates/$pkgname/$pkgname-$pkgver.crate")
sha256sums=(SKIP)

prepare() {
  export RUSTUP_TOOLCHAIN=stable
  cd "$pkgname-$pkgver"
  cargo fetch --locked --manifest-path=./Cargo.toml  --target="$CARCH-unknown-linux-gnu"
}

build() {
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cd "$pkgname-$pkgver"
  cargo build --frozen --release

  find target/release -name "$pkgname.fish" | xargs dirname > out_dir
}

check() {
  cd "$pkgname-$pkgver"
  export RUSTUP_TOOLCHAIN=stable
  cargo test --release --locked
}

package() {
  cd "$pkgname-$pkgver"

  local OUT_DIR=$(<out_dir)

  install -Dm755 "target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"

  install -Dm644 "$OUT_DIR/_$pkgname" "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
  install -Dm644 "$OUT_DIR/$pkgname".bash "$pkgdir/usr/share/bash-completion/completions/$pkgname"
  install -Dm644 "$OUT_DIR/$pkgname".fish "$pkgdir/usr/share/fish/vendor_completions.d/$pkgname.fish"
  install -Dm644 "$OUT_DIR/$pkgname".1 "$pkgdir/usr/share/man/man1/$pkgname.1"
}