summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9f80fefcc58738e0b1a396f008869ee964bf1781 (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
# Maintainer: Kimiblock Moe

pkgname=clash-rs-git
pkgdesc="custom protocol network proxy"
url="https://github.com/Watfaq/clash-rs"
license=("Apache-2.0")
arch=("any")
pkgver=latest.r0.gc69339e6
pkgrel=1
makedepends=("rust" "cargo" "git")
depends=("gcc-libs" "glibc" "xz")
source=("git+https://github.com/Watfaq/clash-rs.git")
md5sums=("SKIP")
provides=("clash-rs")
conflicts=("clash-rs")
options=(!lto)

function pkgver() {
	cd "${srcdir}/clash-rs"
	git describe --long --tags --abbrev=8 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

function prepare() {
	cd "${srcdir}/clash-rs"
	export RUSTUP_TOOLCHAIN=stable
	cargo fetch --target "$CARCH-unknown-linux-gnu"
}

function build() {
	cd "${srcdir}/clash-rs"
	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	cargo build --release --frozen --all-features --locked
}

function check() {
	cd "${srcdir}/clash-rs"
	export RUSTUP_TOOLCHAIN=stable
	cargo test --release --frozen --all-features --locked
}

function package() {
	install -Dm755 "${srcdir}/clash-rs/target/release/clash" "${pkgdir}/usr/bin/clash-rs"
	install -Dm644 "${srcdir}/clash-rs/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}