summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6abea91530bce4de808311ebea244106276f3dfb (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
# Maintainer: Rafael Dominiquini <rafaeldominiquini at gmail dot com>
# Contributor: David Birks <david@birks.dev>

_pkgauthor=theopfr
_pkgname=somo
pkgname=${_pkgname}
pkgver=1.3.3
pkgrel=1
pkgdesc='A human-friendly alternative to netstat for socket and port monitoring'

url="https://github.com/${_pkgauthor}/${_pkgname}"
license=('MIT')
arch=('x86_64')

provides=("${pkgname}")
conflicts=("${pkgname}"{-git,-bin})

makedepends=('cargo')
depends=('glibc' 'libgcc')

options=('!debug' '!strip')

source=("${_pkgname}-${pkgver}.tgz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('011ff1fe6e4e973c59526fd5c50d2cdd040d1517f26a321e21807b658047377a')

prepare() {
    cd "${pkgname}-${pkgver}" || exit

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

build() {
    cd "${pkgname}-${pkgver}" || exit

    export RUSTUP_TOOLCHAIN=stable
    export CARGO_TARGET_DIR=target
    cargo build --frozen --release --all-features

    mkdir -p completions
    ./"target/release/${_pkgname}" generate-completions bash > "completions/${_pkgname}.bash"
    ./"target/release/${_pkgname}" generate-completions zsh > "completions/${_pkgname}.zsh"
    ./"target/release/${_pkgname}" generate-completions fish > "completions/${_pkgname}.fish"
}

check() {
    cd "${pkgname}-${pkgver}" || exit

    export RUSTUP_TOOLCHAIN=stable
    cargo test --frozen --all-features
}

package() {
    cd "${pkgname}-${pkgver}" || exit

    install -Dm0755 "target/release/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"

    install -D -m644 "completions/${_pkgname}.bash" "${pkgdir}/usr/share/bash-completion/completions/${_pkgname}"
    install -D -m644 "completions/${_pkgname}.zsh" "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}"
    install -D -m644 "completions/${_pkgname}.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/${_pkgname}.fish"

    install -Dm644 "README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"

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