blob: 4aa01f057e1f8d8033bb97c9df648c1077508fef (
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
|
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=cargo
pkgver=0.22.0
pkgrel=3
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).
# 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!
_bootstrap_cargo_ver=0.17.0
# We must use newer version of openssl crate and patch it for compatibility
# with LibreSSL 2.6.3.
_crate_openssl_ver="0.9.20"
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-alpine-linux-musl.tar.gz
tests-fix-build-auth-http_auth_offered.patch
tests-ignore-ssh_something_happens.patch
replace-openssl-crate.patch
rust-openssl-$_crate_openssl_ver.tar.gz::https://github.com/sfackler/rust-openssl/archive/v$_crate_openssl_ver.tar.gz
openssl-fix-libressl-cmsh-detection.patch
openssl-libressl263-compat.patch"
builddir="$srcdir/$pkgname-$pkgver"
export CARGO_HOME="$srcdir/.cargo"
_bootstrap_cargo="$srcdir/$pkgname-$_bootstrap_cargo_ver-$CHOST/bin/cargo"
_cargo_opts="--release --locked --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() {
mv "$srcdir"/rust-openssl-$_crate_openssl_ver "$builddir"/openssl
default_prepare
}
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"
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="31764df0462fcd0e7ddd29aee63ed0916b0d05e44d72aa815b3b823256e90f85e582c468a517d048e4451dfc1a3b22434abf25d825d3d926ab7a95f7bb44ad40 cargo-0.22.0.tar.gz
b78a03942344852fd1a8c0ac893580c589757d4946150e5959e1df08b163b94ce5319236a48506c18f987cf3500a2c7cfe808eef13092c45d271e169946a18d1 cargo-0.17.0-x86_64-alpine-linux-musl.tar.gz
4e9a0d409951a72b5c1d3578cb310c0efc5d98a5b963432ec4f485f1d58d2354f0050c31574d6bd9090b7247468ef1a13b04b133deabe6daed91032764468f97 tests-fix-build-auth-http_auth_offered.patch
17c669a71443e21cc5e5cc6eb99933c20562b7df9d859c493ff25252167eb1aea6dd7322a06207776eab1c769464f95a432d1520a949512a52592b1eb115a4be tests-ignore-ssh_something_happens.patch
f066262423d7f092080629bc0b91f8445757c230d5fa441b1c367f3ac44c7def59c05ff8d95f8df8b8c8dbb51e4de8df41b41c95ef18415d20deede3b0f5661f replace-openssl-crate.patch
a1a83416d7ef75fedcd98ac2368c6c6041916ce73438a2f1de7aeafb39c32e7156ade5efd3340e58f0eb666c8b60305d030fffd134bc403fddccbe65914b0815 rust-openssl-0.9.20.tar.gz
e50464c72d94515768763c72778b1e6bd25f83a07eb8ef666fe6efaa592c9fec96307cf5d56643e05665273d4d1c480f28a1e29956a2e24cf4fda9424ead1879 openssl-fix-libressl-cmsh-detection.patch
8dce5569eee5bbf99a52b0589a7907b6a558eaff04e3701e40e575000fdd2a164736aaa9b104bd38973ad914e6cf5eaed903db13761f8217049ed4100121283d openssl-libressl263-compat.patch"
|