aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rustup/APKBUILD
blob: 26a0bbc58de32845e5460c37054de7bfd30132d8 (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
65
66
67
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=rustup
pkgver=1.20.0
pkgrel=0
pkgdesc="The Rust toolchain installer"
url="rustup.rs"
arch="x86_64" # limited by cargo
license="Apache-2.0"
makedepends="cargo perl openssl-dev zlib-dev curl-dev"
options="!check" # Doesn't recognise x86_64-unknown-linux-musl yet
subpackages="
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-fish-completion:fishcomp:noarch
	$pkgname-zsh-completion:zshcomp:noarch"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/rust-lang/rustup.rs/archive/$pkgver.tar.gz
	dont-copy-rustup-bin.patch"
builddir="$srcdir/rustup.rs-$pkgver"

# It doesn't like our custom triplet
export RUSTUP_OVERRIDE_BUILD_TRIPLE="x86_64-unknown-linux-musl"

build() {
	cargo build --release --features no-self-update --bin rustup-init
}

check() {
	cargo test --release
}

package() {
	install -d "$pkgdir"/usr/bin
	install -m755 target/release/rustup-init "$pkgdir"/usr/bin/

	ln -s target/release/rustup-init rustup
	./rustup completions zsh > rustup.zsh
	./rustup completions bash > rustup.bash
	./rustup completions fish > rustup.fish
}

bashcomp() {
	pkgdesc="$pkgdesc - bash completion"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	install -Dm644 "$builddir"/rustup.bash \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

fishcomp() {
	pkgdesc="$pkgdesc - fish shell completion"
	install_if="$pkgname=$pkgver-r$pkgrel fish"

	install -Dm644 "$builddir"/rustup.fish \
		"$subpkgdir"/usr/share/fish/completions/$pkgname.fish
}

zshcomp() {
	pkgdesc="$pkgdesc -zsh completion"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	install -Dm644 "$builddir"/rustup.zsh \
		"$subpkgdir"/usr/share/zsh/site-functions/_$pkgname
}
sha512sums="52c21b173abfea9f89c91bc7dae7fcbb7f2082b7692b85369218136a1ea2cc19bbb8546a5ef343c09f6cdc3e7dbe0ff8f2340707bd57230220034fa8e9560c78  rustup-1.20.0.tar.gz
ca28b41a638fe5b1e8b0dcb549bdbed04bada7f41759d14a374dbc6f0823df57c08b65aa4fbce05ced3deafcb96ee3ae38b187ca29e1a9183ee5e91f8577400c  dont-copy-rustup-bin.patch"