summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9205880d2e18610c46882162b93ec168760ae0d8 (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: Daniel Peukert <daniel@peukert.cc>
_pkgname='shd'
pkgname="$_pkgname-git"
pkgver='0.1.2.r0.g1df83d0'
pkgrel='1'
pkgdesc='Console tool to display drive list with commonly checked smart info - git version'
arch=('x86_64' 'i686' 'arm' 'aarch64')
url="https://github.com/alttch/$_pkgname"
license=('MIT')
depends=('smartmontools')
makedepends=('cargo' 'git')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=("$pkgname::git+$url")
sha256sums=('SKIP')

_sourcedirectory="$pkgname"

prepare() {
	cd "$srcdir/$_sourcedirectory/"

	_cargotarget="$CARCH-unknown-linux-musl"

	if [ "$CARCH" = 'arm' ]; then
		_cargotarget="${_cargotarget}eabihf"
	fi

	cargo fetch --locked --target "$_cargotarget"
}

pkgver() {
	cd "$srcdir/$_sourcedirectory/"
	git describe --long --tags | sed -e 's/^v//' -e 's/-\([^-]*-g[^-]*\)$/-r\1/' -e 's/-/./g'
}

build() {
	cd "$srcdir/$_sourcedirectory/"
	export RUSTUP_TOOLCHAIN='stable'
	export CARGO_TARGET_DIR='build'
	cargo build --frozen --release --all-features
}

package() {
	cd "$srcdir/$_sourcedirectory/"
	install -Dm755 "build/release/$_pkgname" "$pkgdir/usr/bin/$_pkgname"
	install -Dm644 'LICENSE' "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}