summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 41612392a885130aab54d942e0dfb7358ef00aa6 (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: Romain Chardiny <romain.chardiny@gmail.com>
pkgname=floc-git
pkgver=0.2.2.r4.bc8b8b9
pkgrel=1
pkgdesc="Flo Compiler"
arch=("any")
url="https://github.com/romch007/floc"
license=('MIT')
depends=("llvm-libs" "gcc-libs")
provides=('floc')
makedepends=('git' 'rust' 'llvm' 'clang')
source=('git+https://github.com/romch007/floc.git')
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/floc"

  printf "%s" "$(git describe --long | sed 's/\([^-]*-\)g/r\1/;s/-/./g')"
}

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

build() {
  cd "$srcdir/floc"
  export RUSTUP_TOOLCHAIN=stable
  export CARGO_TARGET_DIR=target
  cargo build --release --locked --offline
}

package() {
  cd "$srcdir/floc"

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

  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/floc/LICENSE

  find . -name floc.bash -type f -exec install -Dm644 {} "$pkgdir/usr/share/bash-completion/completions/floc" \;
  find . -name _floc -type f -exec install -Dm644 {} "$pkgdir/usr/share/zsh/site-functions/_floc" \;
  find . -name floc.fish -type f -exec install -Dm644 {} "$pkgdir/usr/share/fish/vendor_completions.d/floc.fish" \;
  find . -name floc.elv -type f -exec install -Dm644 {} "$pkgdir/usr/share/elvish/lib/floc.elv" \;
  find . -name floc.1 -type f -exec install -Dm644 {} "$pkgdir/usr/share/man/man1/floc.1" \;
  gzip "$pkgdir/usr/share/man/man1/floc.1"
}