summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e0eeaf0da9fcdfce261c3b20ede4e285d07949f6 (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
# Maintainer: Integral <integral@member.fsf.org>

pkgname=tunet-rust-git
_pkgname=tunet-rust
pkgver=0.12.0.r9.g9727f20
pkgrel=1
pkgdesc="A Rust-based client for network authentication at Tsinghua University | 清华大学校园网 Rust 客户端"
url="https://github.com/Berrysoft/tunet-rust"
arch=('x86_64' 'aarch64')
license=('MIT')
depends=('openssl' 'curl' 'freetype2' 'hicolor-icon-theme' 'qt6-base')
makedepends=('git' 'cargo')
conflicts=("${_pkgname}")
provides=("${_pkgname}")
source=("git+${url}.git")
sha512sums=('SKIP')
options=('!lto')

pkgver() {
	cd "${_pkgname}/"
	(
		set -o pipefail
		git describe --tags --long --abbrev=7 2>/dev/null | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' ||
			printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
	)
}

prepare() {
	cd "${_pkgname}/"
	export RUSTUP_TOOLCHAIN=stable
	cargo fetch --locked --target $(rustc --print host-tuple)
}

build() {
	cd "${_pkgname}/"
	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	cargo build --frozen --release --workspace --exclude native
}

check() {
	cd "${_pkgname}/"
	export RUSTUP_TOOLCHAIN=stable
	cargo test --frozen --all-features --workspace --exclude native
}

package() {
	cd "${_pkgname}/"

	# Binaries
	install -Dm755 target/release/tunet -t "${pkgdir}/usr/bin/"

	# Desktop file
	install -Dm644 "tunet/io.github.berrysoft.tunet.desktop" -t "${pkgdir}/usr/share/applications/"

	# Icon
	install -Dm644 "logo.png" "${pkgdir}/usr/share/icons/hicolor/256x256/apps/tunet.png"

	# Service
	install -Dm644 tunet-service/tunet{,-dbus}.service -t "${pkgdir}/usr/lib/systemd/user/"

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