aboutsummaryrefslogtreecommitdiffstats
path: root/testing/cargo/APKBUILD
blob: 59ff54cc6b28c8784f9ec5960f9fa46f6fb939da (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=cargo
pkgver=0.12.0
pkgrel=1
pkgdesc="The Rust package manager"
url="https://crates.io"
arch="x86_64"
license="MIT ASL-2.0"
depends="rust"
makedepends="cmake curl-dev libssh2-dev libressl-dev python2 zlib-dev"
subpackages="$pkgname-doc
	$pkgname-bash-completion:bashcomp
	$pkgname-zsh-completion:zshcomp"

# XXX: Cargo is self-hosted, so you need cargo to build cargo (ugh).
# The problem is that Rust doesn't provide prebuilt cargo for musl yet. Thus
# I bootstrapped cargo using cargo-bootstrap and uploaded the built tarball
# to my server. We're gonna replace it once Rust start providing prebuilt
# binary for musl.
# TODO: Implement some support for verifying crates fetched by cargo!
source="$pkgname-$pkgver.tar.gz::https://github.com/rust-lang/cargo/archive/$pkgver.tar.gz
	https://alpine.geeknet.cz/distfiles/cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz
	musl-NFS_SUPER_MAGICK.patch
	"
builddir="$srcdir/$pkgname-$pkgver"

_CTARGET="$CARCH-unknown-linux-musl"

prepare() {
	default_prepare || return 1

	cd "$builddir"
	_mv "$srcdir"/cargo-*-$_CTARGET/cargo/* target/snapshot
}

build() {
	export CARGO_HOME="$builddir/.cargo"

	cd "$builddir"
	./configure && make VERBOSE=1
}

package() {
	cd "$builddir"

	make prepare-image-$_CTARGET IMGDIR_$_CTARGET="$pkgdir/usr"
}

bashcomp() {
	pkgdesc="Bash completions for $pkgname"
	depends=""
	arch="noarch"
	install_if="$pkgname=$pkgver-r$pkgrel bash"

	_mv "$pkgdir"/usr/etc/bash_completion.d/* \
		"$subpkgdir"/usr/share/bash-completion/completions/ || return 1

	# Clean directories which are supposed to be empty.
	rmdir "$pkgdir"/usr/etc/bash_completion.d && rmdir "$pkgdir"/usr/etc
}

zshcomp() {
	pkgdesc="ZSH completions for $pkgname"
	depends=""
	arch="noarch"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	_mv "$pkgdir"/usr/share/zsh "$subpkgdir"/usr/share/ || return 1
	rmdir "$pkgdir"/usr/share
}

_mv() {
	local dest; for dest; do true; done  # get last argument
	mkdir -p "$dest"
	mv $@
}

md5sums="2eac183921fcf2ea1e5eda71b4840179  cargo-0.12.0.tar.gz
79f81ecfa861f4d97a3b9235e66ba594  cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz
284d4477b72157e5edb3b27f7045ab5e  musl-NFS_SUPER_MAGICK.patch"
sha256sums="4080d76b56b8202f7df271b4bb7d7d22abea5ff8c261aef42e6e5d248ca5972b  cargo-0.12.0.tar.gz
587172026c0565e839d96b0c1d4c68c000927817398241f96682dca47fa8c3b9  cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz
43a348ad5ef2830d109ac4a1c759b03f009281b58b4b8c1f3f6c463316c69fc8  musl-NFS_SUPER_MAGICK.patch"
sha512sums="6fba348b068c07d49a6a263f143b31c3dff1e0aa399b90193830ad1823a3c07c5097fb39ff09fcc7713e78e85cfa1b5d8825db75055c49e2c3237fe4bffad3bc  cargo-0.12.0.tar.gz
17838355ff6d87165aa0f61bd01f48c58a426c069bba7c3852d016e1836666bfafe2609c323a0409fc8530ad27fb3ad5989d8cee033633e38b07fefa670597d5  cargo-0.11.0-nightly-x86_64-alpine-linux-musl.tar.gz
ab70985df7d32b6e82af806986ecf6ba22939d27b9d7abdd31e5c35d2ead668c8f56f2c53c59d86843c762fd43856cc22c57e3373cb746519dc68937bcdb86dd  musl-NFS_SUPER_MAGICK.patch"