# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka pkgname=cargo pkgver=0.14.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 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). # TODO: Implement some support for verifying crates fetched by cargo! source="$pkgname-$pkgver.tar.gz::https://github.com/rust-lang/$pkgname/archive/$pkgver.tar.gz https://s3.amazonaws.com/rust-lang-ci/cargo-builds/333a79884d2463b11f279d815284b6406656c949/cargo-nightly-x86_64-unknown-linux-musl.tar.gz fix-release-num.patch" builddir="$srcdir/$pkgname-$pkgver" _ctarget="$CARCH-unknown-linux-musl" build() { export CARGO_HOME="$builddir/.cargo" # Convince libgit2-sys to use the distro libgit2. export LIBGIT2_SYS_USE_PKG_CONFIG=1 cd "$builddir" ./configure \ --prefix=/usr \ --local-cargo="$srcdir/cargo-nightly-$_ctarget/cargo/bin/cargo" \ || return 1 make CARGOFLAGS="--locked" VERBOSE=1 } package() { cd "$builddir" make prepare-image-$_ctarget IMGDIR_$_ctarget="$pkgdir/usr" } bashcomp() { pkgdesc="Bash completions for $pkgname" depends="" 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="" 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="d789a7785e37a1f299b24bc4b57f98ff cargo-0.14.0.tar.gz 27e5c82f233e2207cca1c1db9218a362 cargo-nightly-x86_64-unknown-linux-musl.tar.gz fe8c3891c23626882b2380e32450413d fix-release-num.patch" sha256sums="90ec0e644586959f62e6e34e649ba57db6f74aa37b89e90972f817c49b187531 cargo-0.14.0.tar.gz 928bd9e4966f67fe020d703a549fa04fc18d98227ec2c57f479625cbb58576c2 cargo-nightly-x86_64-unknown-linux-musl.tar.gz 3fa15aa38a1d6c0a8f1b9a1361197faa6c7de79d9e38097b38017cb352098339 fix-release-num.patch" sha512sums="dcd6857f256f1b4cd4d0dfedbb7fceedadcf3ecbe92014f58ff3e668870624d5a1cddda1c4b2653b6ec713c6aef4810760e112e589b6eba81bba9692356acb4f cargo-0.14.0.tar.gz d55792c55730689b5b7a95db0d57a5c991dd2ee565685bf43e50652597c399569759363acb18d726a2ece5ba5dbdeb396158dfb1aa68a36ca4e3f9ba92e81da3 cargo-nightly-x86_64-unknown-linux-musl.tar.gz 2db1c0870d20a6cfdff863a17180d960e2891e3cfd0ff565d1d1494eaeacfb553e2d1374cdc626f4ce5bc7c2a1c11ab99ae5462d8c3b44716a0f50f7b2b355fd fix-release-num.patch"