cargo: update to 1.82.0
[void-pkg.git] / srcpkgs / cargo / template
blob2280228fa9eebd89668f63f56cd7a8f04b32f469
1 # Template file for 'cargo'
2 pkgname=cargo
3 version=1.82.0
4 revision=1
5 _cargo_revision=0.83.0
6 build_helper=rust
7 hostmakedepends="cargo-bootstrap rust python3 curl pkg-config zlib-devel"
8 makedepends="rust libcurl-devel openssl-devel"
9 depends="rust"
10 short_desc="Rust package manager"
11 maintainer="Enno Boland <gottox@voidlinux.org>"
12 license="Apache-2.0 OR MIT"
13 homepage="https://crates.io/"
14 distfiles="https://github.com/rust-lang/cargo/archive/refs/tags/${_cargo_revision}.tar.gz"
15 checksum=53fbf5eb9d0c42ce184bd1b170606db7c878e7ef07ed3b513a67e62e14ca4661
16 replaces="cargo-tree>=0"
18 build_options="static bindist"
19 desc_option_bindist="Generate a tarball for bootstrap"
21 if [ -n "$build_option_static" -o -n "$build_option_bindist" ]; then
22         _build_static=yes
25 if [ -z "$_build_static" ]; then
26         makedepends+=" libgit2-1.8-devel"
29 do_build() {
30         local cargs
32         # breaks requested building sqlite in bundled mode
33         unset LIBSQLITE3_SYS_USE_PKG_CONFIG
35         if [ -n "$_build_static" ]; then
36                 unset LIBSSH2_SYS_USE_PKG_CONFIG
37                 export OPENSSL_STATIC=1
38                 # rust-openssl can not be linked static if pkg-config is used
39                 export OPENSSL_NO_PKG_CONFIG
40                 export OPENSSL_DIR="${XBPS_CROSS_BASE}/usr"
41         fi
43         if [ -n "$_build_static" ]; then
44                 cargs+=" --features=all-static"
45         fi
47         cargo build --release ${cargs}
50 do_install() {
51         local cbin="target/release/cargo"
52         if [ "$CROSS_BUILD" ]; then
53                 cbin="target/${RUST_TARGET}/release/cargo"
54         fi
56         if [ "$build_option_bindist" ]; then
57                 local dest="cargo-${version}-${RUST_TARGET}"
58                 mkdir -p ${XBPS_SRCDISTDIR}/distfiles ${dest}/cargo/bin
59                 install -m 0755 ${cbin} ${dest}/cargo/bin
60                 install -m 0644 LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY ${dest}
61                 bsdtar cvJf ${dest}.tar.xz ${dest}
62                 install -m 0644 ${dest}.tar.xz ${XBPS_SRCDISTDIR}/distfiles
63                 exit 1
64         fi
66         vbin ${cbin}
67         for f in src/etc/man/*.?; do
68                 vman $f
69         done
70         vinstall src/etc/cargo.bashcomp.sh 0644 \
71          usr/share/bash-completion/completions cargo
72         vinstall src/etc/_cargo 0644 usr/share/zsh/site-functions
74         vlicense LICENSE-APACHE
75         vlicense LICENSE-MIT
76         vlicense LICENSE-THIRD-PARTY