summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c766648bef354f22e657cf165990e53e35e20948 (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
# Maintainer: Wenxuan <wenxuangm@gmail.com>
_pkgname=csview
pkgname=csview-git
pkgver=1.2.4.20240414
pkgrel=1
pkgdesc='A high performance csv viewer with cjk/emoji support'
arch=(i686 x86_64)
url='https://github.com/wfxr/csview'
license=('MIT OR Apache-2.0')
makedepends=('git' 'rust' 'cargo')
conflicts=("${_pkgname}" "${_pkgname}-bin")
provides=("${_pkgname}")

source=("${_pkgname}::git+${url}")
sha256sums=('SKIP')

pkgver() {
    cd "${_pkgname}"
    echo "$(grep -oPm1 '(?<=^version = ")[^"]+' Cargo.toml).$(TZ=UTC git log -1 --pretty='%cd' --date=short-local | tr -d '-')" | tr '-' '.'
}

build() {
    cd "${_pkgname}"
    cargo build --release --locked
}

package() {
    cd "$srcdir/${_pkgname}"
    install -Dm755 "target/release/${_pkgname}"        "$pkgdir/usr/bin/${_pkgname}"
    install -Dm644 "completions/fish/${_pkgname}.fish" "$pkgdir/usr/share/fish/vendor_completions.d/${_pkgname}.fish"
    install -Dm644 "completions/zsh/_${_pkgname}"      "$pkgdir/usr/share/zsh/site-functions/_${_pkgname}"
    install -Dm644 "README.md"                         "$pkgdir/usr/share/doc/${_pkgname}/README.md"
    install -Dm644 "LICENSE-MIT"                       "$pkgdir/usr/share/licenses/${_pkgname}/LICENSE-MIT"
    install -Dm644 "LICENSE-APACHE"                    "$pkgdir/usr/share/licenses/${_pkgname}/LICENSE-APACHE"
}

# vim:set noet sts=0 sw=4 ts=4 ft=PKGBUILD: