summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 270f5d4cae74d35a58c2b673ab256789a5575649 (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
# Maintainer: WithoutAName <withoutaname@withoutaname.eu>
pkgname=dot-manager-git
pkgver=0.3.0.r2.g4115e17
pkgrel=2
pkgdesc="CLI Utility for easy dotfile management"
arch=("x86_64")
_repo=DotManager
url="https://github.com/WithoutAName25/$_repo"
license=("MIT")
depends=("gcc-libs" "glibc")
makedepends=("cargo" "git")
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
source=("${pkgname%-git}::git+$url.git")
sha256sums=("SKIP")

pkgver() {
  cd "$srcdir/${pkgname%-git}"

  printf "%s" "$(git describe --long --tags --abbrev=7 | sed 's/^v//;s/-/.r/;s/-/./')"
}

prepare() {
  cd "$srcdir/${pkgname%-git}"

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

build() {
  cd "$srcdir/${pkgname%-git}"

  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --frozen --release --no-default-features
}

package() {
  cd "$srcdir/${pkgname%-git}"

  install -Dm755 target/release/dot-manager "$pkgdir/usr/bin/dot-manager"

  install -Dm644 target/generated/completions/dot-manager.bash "$pkgdir/usr/share/bash-completion/completions/dot-manager"
  install -Dm644 target/generated/completions/dot-manager.fish "$pkgdir/usr/share/fish/vendor_completions.d/dot-manager.fish"
  install -Dm644 target/generated/completions/_dot-manager "$pkgdir/usr/share/zsh/site-functions/_dot-manager"

  for file in target/generated/manpage/dot-manager*.1; do
    install -Dm644 "$file" "$pkgdir/usr/share/man/man1/$(basename "$file")"
    gzip "$pkgdir/usr/share/man/man1/$(basename "$file")"
  done

  install -Dm644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}