summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: da36f61baebdf7fdade752496238c46f9b9a274a (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
# Maintainer: bemxio <bemxiov at protonmail dot com>

pkgname="countryfetch"
pkgdesc="A neofetch-like tool for fetching information about your country"

pkgver=0.1.9
pkgrel=2

arch=(aarch64 i686 x86_64)

url="https://github.com/nik-rev/${pkgname}"
license=("MIT")

depends=(openssl)
makedepends=(cargo-nightly)

source=("${pkgname}-${pkgver}.tar.gz::https://github.com/nik-rev/${pkgname}/releases/download/v${pkgver}/source.tar.gz")
md5sums=("807d670545c99f33d42255dea569f0cc")

prepare() {
	# move to the source directory
	cd "${pkgname}-${pkgver}"

	# use the system-provided openssl
	sed -i 's/openssl = { version = "0.10", features = \["vendored"\] }//' countryfetch/Cargo.toml

	# fetch required dependencies
	RUSTUP_TOOLCHAIN=nightly cargo fetch --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
	# move to the source directory
	cd "${pkgname}-${pkgver}"

	# build the project
	RUSTUP_TOOLCHAIN=nightly CARGO_TARGET_DIR=target cargo build --release --all-features
}

check() {
	# move to the source directory
	cd "${pkgname}-${pkgver}"

	# run the tests
	RUSTUP_TOOLCHAIN=nightly cargo test --all-features
}

package() {
	# move to the source directory
	cd "${pkgname}-${pkgver}"

	# copy the executable and the license files
	install -Dm755 "target/release/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}