blob: b5519484a2bd8e23b572d093071cb63d963a3a5b (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=cargo
pkgver=0.25.0
pkgrel=0
pkgdesc="The Rust package manager"
url="https://crates.io"
arch="x86_64" # limited by rust pkg
license="MIT Apache-2.0"
depends="rust"
makedepends="cmake curl-dev libgit2-dev libssh2-dev libressl-dev python2 zlib-dev"
subpackages="$pkgname-doc
$pkgname-bash-completion:bashcomp:noarch
$pkgname-zsh-completion:zshcomp:noarch"
# NOTE: Cargo is self-hosted, so you need cargo to build cargo (ugh).
# The bootstrap static cargo has been cross-compiled on GNU system using
# prebuilt cargo downloaded from the upstream.
# XXX: Cargo depends on many crates (Rust packages) and currently downloads
# them itself in the build phase. This quite violates our policy. However,
# unlike some other package managers, Cargo does not download arbitrary
# packages from the Internet without any verification. The source tarball
# includes file Cargo.lock that contains complete dependency tree with exact
# version and checksum for each crate . With --locked we force cargo to
# adhere to this file and verify checksums. So it provides the same
# guarantees as abuild. That said, for now it's exception only for cargo
# package and should not be applied to other rust packages!
# FIXME: There's no Cargo.lock in the cargo's repository anymore! According to
# the upstream, Cargo should be always built together with Rust... For now we
# at least include Cargo.lock generated locally as a side effect of running
# `cargo build` for particular $pkgver to ensure basic reproducibility.
_bootstrap_cargo_ver=0.25.0
source="$pkgname-$pkgver.tar.gz::https://github.com/rust-lang/$pkgname/archive/$pkgver.tar.gz
https://dev.alpinelinux.org/archive/$pkgname/$pkgname-$_bootstrap_cargo_ver-x86_64-unknown-linux-musl.tar.gz
Cargo.lock
tests-fix-build-auth-http_auth_offered.patch
tests-ignore-ssh_something_happens.patch
tests-ignore-rustdoc.patch
tests-ignore-wasm32_final_outputs.patch
"
builddir="$srcdir/$pkgname-$pkgver"
export CARGO_HOME="$srcdir/.cargo"
_bootstrap_cargo="$srcdir/$pkgname-$_bootstrap_cargo_ver-${CHOST/alpine/unknown}/bin/cargo"
_cargo_opts="--locked --release --verbose ${JOBS:+--jobs $JOBS}"
# Uploaded cargo binary from the built package to dev.a.o, so it can be used
# for building cargo next time (needed for bootstrapping).
# TODO: Build statically linked binary for bootstrapping!
snapshot() {
local apkfile="$REPODEST/$repo/$CARCH/$pkgname-$pkgver-r$pkgrel.apk"
local tarname="$pkgname-$pkgver-$CHOST"
[ -f "$apkfile" ] || die "$apkfile does not exist, run abuild -r"
mkdir -p "$srcdir/$tarname"
cd "$srcdir"
tar -C "$tarname" -x --strip-components 1 -f "$apkfile" usr/bin/cargo
tar -czf "$tarname.tar.gz" "$tarname"
msg "Uploading $tarname.tar.gz to dev.alpinelinux.org"
scp "$tarname.tar.gz" dev.alpinelinux.org:/archive/$pkgname/
}
prepare() {
default_prepare
cp "$srcdir"/Cargo.lock "$builddir"/
}
build() {
cd "$builddir"
# Convince libgit2-sys to use the distro libgit2.
export LIBGIT2_SYS_USE_PKG_CONFIG=1
"$_bootstrap_cargo" build $_cargo_opts
"$_bootstrap_cargo" test $_cargo_opts --no-run
}
check() {
cd "$builddir"
./target/release/cargo --version
CFG_DISABLE_CROSS_TESTS=1 RUST_BACKTRACE=1 \
"$_bootstrap_cargo" test $_cargo_opts --no-fail-fast
}
package() {
cd "$builddir"
install -D -m 755 target/release/cargo "$pkgdir"/usr/bin/cargo
mkdir -p "$pkgdir"/usr/share/man/man1
install -m 644 -t "$pkgdir"/usr/share/man/man1/ src/etc/man/*.1
mkdir -p "$pkgdir"/usr/share/licenses/$pkgname
install -m 644 -t "$pkgdir"/usr/share/licenses/$pkgname/ LICENSE*
}
bashcomp() {
pkgdesc="Bash completions for $pkgname"
depends=""
install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
cd "$builddir"
install -D -m 644 -D src/etc/cargo.bashcomp.sh \
"$subpkgdir"/usr/share/bash-completion/completions/cargo
}
zshcomp() {
pkgdesc="ZSH completions for $pkgname"
depends=""
install_if="$pkgname=$pkgver-r$pkgrel zsh"
cd "$builddir"
install -D -m 644 src/etc/_cargo \
"$subpkgdir"/usr/share/zsh/site-functions/_cargo
}
sha512sums="959277eaf993b455ced93581dd04358507d91390dbc4413ca5e30f5548221e8d321b8983c195025b73a193107410429b33b9692298733c201c98ab62da99dfad cargo-0.25.0.tar.gz
67d6d353d26232aa9e7c8d5b0eacc7cacb455fafa42b1932e6ebc832cbc9f948e723e5c5a9209ad504b34313e8a861236691e9bfefc12ef22afcd23f8859e918 cargo-0.25.0-x86_64-unknown-linux-musl.tar.gz
9a2c46560b3291a7db43294573957871a9359221bc2986c4ca220061ff45566da0ecf388e8ff582032419081a85c7643845fea9c76870008a376cefecf5181ae Cargo.lock
8f9ce1c7c17693a92b8f5f1e7718bf6045910240326cd06346adbf66049dd62a4ea5a2e7a60d2793e532d2b406d5ed673d05068058abb5ca8e8df85273625024 tests-fix-build-auth-http_auth_offered.patch
17c669a71443e21cc5e5cc6eb99933c20562b7df9d859c493ff25252167eb1aea6dd7322a06207776eab1c769464f95a432d1520a949512a52592b1eb115a4be tests-ignore-ssh_something_happens.patch
cf2c55d71cb376fdaac7efedfd9bb7a1d8b8709c7cd98aa7e74e574885e8dfa17fbb61050335d7fc63932c5b45ac1ca33cf516d4340e1ba9fe5f41fd6983078e tests-ignore-rustdoc.patch
9319350e31dc661131bc6c3cc4609a221d70e8d9f22faa8bea12cdbe87c989872b8b69c181e6c701bc38682b26c49a8133f93be316271995856f6ead1df296b5 tests-ignore-wasm32_final_outputs.patch"
|