summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cc221b11ed24f010ba1c06378a3ac74d209fa2e0 (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
# -*- mode: Shell-script; eval: (setq indent-tabs-mode 't); eval: (setq tab-width 4) -*-
# Maintainer: LuckyTurtleDev [aur at lukas1818 dot de]

_crate="hf2-cli"
pkgname="hf2-cli"
pkgver=0.3.3
pkgrel=1
pkgdesc='CLI for Microsoft HID Flashing Library for UF2 Bootloaders'
url='https://crates.io/crates/hf2-cli'
license=('Apache-2.0' 'MIT')

depends=('gcc-libs' 'hidapi' 'libusb')
makedepends=('cargo')
optdepends=('adafruit-boards-udev: udev rule for adafruit boards')

source=("$_crate-0.3.3.tar.gz::https://crates.io/api/v1/crates/hf2-cli/0.3.3/download")
sha512sums=('038d37171f382c0637cb45e929495533bb4632d8ebd8a813d7da67ee509dc91e9ae4aa8008bfe4271d01b0e6b57723e4a995874f0b15746975d3344a77a3bb96')

# Tier 1 architectures supported by Rust (https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-1)
arch=('aarch64' 'i686' 'x86_64')

prepare() {
	cd "$srcdir/$_crate-0.3.3"

	export RUSTUP_TOOLCHAIN=stable

	cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
	cd "$srcdir/$_crate-0.3.3"
	
	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	CFLAGS+=" -ffat-lto-objects"

	
	cargo build \
		--offline \
		--locked \
		--release
}

package() {
	cd "$srcdir/$_crate-0.3.3"
	install -Dm755 "target/release/hf2" -t "$pkgdir/usr/bin"
	install -Dm644 'LICENSE.md' -t "$pkgdir/usr/share/licenses/$pkgname/"
}