summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 49f0c754f701ce97e291a31218815f5e8d2b980c (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
# Maintainer: Sergey A. <murlakatamenka@disroot.org>
# shellcheck disable=SC2034,SC2164

pkgname=intermodal
pkgver=0.1.14
pkgrel=2
pkgdesc="User-friendly and featureful CLI BitTorrent metainfo utility, written in Rust"
arch=('x86_64')
url="https://github.com/casey/intermodal"
license=('custom:CC0')
makedepends=(cargo help2man libgit2 libssh2)
conflicts=(intermodal-bin)
options=(!lto)
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha256sums=('4b42fc39246a637e8011a520639019d33beffb337ed4e45110260eb67ecec9cb')

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

  export RUSTUP_TOOLCHAIN=stable

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

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

  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target

  cargo build --release --frozen

  # completions and man pages
  cargo run --package gen -- --bin target/release/imdl completion-scripts
  cargo run --package gen -- --bin target/release/imdl man
  cargo run --package gen -- --bin target/release/imdl book
}

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

  # binary
  install -Dm 755 "target/release/imdl" "$pkgdir/usr/bin/imdl"

  # shell completions
  install -Dm644 "target/gen/completions/_imdl" "$pkgdir/usr/share/zsh/site-functions/_imdl"
  install -Dm644 "target/gen/completions/imdl.bash" "$pkgdir/usr/share/bash-completion/completions/imdl"
  install -Dm644 "target/gen/completions/imdl.fish" "$pkgdir/usr/share/fish/vendor_completions.d/imdl.fish"

  # man pages
  install -Dm644 target/gen/man/*.1 -t "$pkgdir/usr/share/man/man1/"

  # book
  pushd book/src
  find . -name '*.md' -exec \
    install -Dm 644 {} "$pkgdir/usr/share/doc/$pkgname/book/{}" \;
  popd

  # license
  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
}

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

  export RUSTUP_TOOLCHAIN=stable

  cargo test --frozen --all
}