# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka global pkgname := 'cargo' global pkgver := '0.18.0' # Git revision of prebuilt Cargo to use for bootstrapping. global _bootstrap_gitrev := '6e0c18cccc8b0c06fba8a8d76486f81a792fb420' # 0.16.0 # Git revision of rust-installer (submodule in cargo repo). global _installer_gitrev := '4f994850808a572e2cc8d43f968893c8e942e9bf' global pkgrel := '0' global pkgdesc := '"The Rust package manager'" global url := '"https://crates.io'" global arch := '"x86_64'" # limited by rust pkg global license := '"MIT ASL-2.0'" global depends := '"rust'" global makedepends := '"cmake curl-dev libgit2-dev libssh2-dev libressl-dev python2 zlib-dev'" global 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! global _cbuild := ""$CARCH-unknown-linux-musl"" global source := ""$pkgname-$pkgver.tar.gz::https://github.com/rust-lang/$pkgname/archive/$pkgver.tar.gz https://github.com/rust-lang/rust-installer/archive/$_installer_gitrev/rust-installer-$_installer_gitrev.tar.gz cargo-$_bootstrap_gitrev-$_cbuild.tar.gz::https://s3.amazonaws.com/rust-lang-ci/cargo-builds/$_bootstrap_gitrev/cargo-nightly-$_cbuild.tar.gz fix-test-build-auth.patch"" global builddir := ""$srcdir/$pkgname-$pkgver"" global _bootstrap_cargo := ""$srcdir/cargo-nightly-$_cbuild/cargo/bin/cargo"" export CARGOFLAGS="--locked" export CARGO_HOME="$srcdir/.cargo" proc prepare { default_prepare cd $builddir rmdir src/rust-installer ln -s "$srcdir"/rust-installer-$_installer_gitrev src/rust-installer } proc build { cd $builddir ./configure \ --prefix=/usr \ --release-channel=stable \ --cargo="$_bootstrap_cargo" # LIBGIT2... Convince libgit2-sys to use the distro libgit2. make LIBGIT2_SYS_USE_PKG_CONFIG=1 \ VERBOSE=1 } proc check { cd $builddir ./target/$CTARGET/release/cargo --version # XXX: ignore test failures for now env CFG_DISABLE_CROSS_TESTS=1 \ $_bootstrap_cargo test \ --release \ --target $CTARGET \ --no-fail-fast \ --verbose || true } proc package { cd $builddir make install DESTDIR="$pkgdir" # Remove installer artifacts (manifests, uninstall scripts, etc.) rm -rv "$pkgdir"/usr/lib } proc bashcomp { global pkgdesc := ""Bash completions for $pkgname"" global depends := ''"" global install_if := ""$pkgname=$pkgver-r$pkgrel bash"" _mv "$pkgdir"/usr/etc/bash_completion.d/* \ "$subpkgdir"/usr/share/bash-completion/completions/ # Clean directories which are supposed to be empty. rmdir -p "$pkgdir"/usr/etc/bash_completion.d !2 >/dev/null || true } proc zshcomp { global pkgdesc := ""ZSH completions for $pkgname"" global depends := ''"" global install_if := ""$pkgname=$pkgver-r$pkgrel zsh"" _mv "$pkgdir"/usr/share/zsh "$subpkgdir"/usr/share/ rmdir "$pkgdir"/usr/share } proc _mv { var dest = ''for dest in @Argv { true; } # get last argument mkdir -p $dest mv $ifsjoin(Argv) } global sha512sums := '"561d6817555da802e99964daa74550cc47a285903301da12a245bb62e5857c18069d87a520c5cefb62aecfe5561666352d57dca8f75758f81ea82709565577d2 cargo-0.18.0.tar.gz 9ceb4755890ad3ae68ce141231c5114077261e0279d3a9a6208053f8d3386c9198e6b94d6321b456648dd5baa86dfc3ae81df44b67d41b428d11afd6763f0cff rust-installer-4f994850808a572e2cc8d43f968893c8e942e9bf.tar.gz 4df33353b6be1af822220ca03f9ec5a3b6421c9b10ec17b864be586ba495c6210bac70d904b0e0b35eff62ef2c9a681ded526e5cbd37e326dc3146742aa659de cargo-6e0c18cccc8b0c06fba8a8d76486f81a792fb420-x86_64-unknown-linux-musl.tar.gz 6a789fc1bf0eb19dde9267a10f7506787d6a4bb8316b09f4dee5da083c0fb0bad87630b238d92ef3aaf114d9a337a87797c8ac427f71c53ac06106925d459ee0 fix-test-build-auth.patch'" (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgname) op:Equal rhs:{(cargo)} spids:[6])] spids: [6] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgver) op:Equal rhs:{(0.18.0)} spids:[9])] spids: [9] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_bootstrap_gitrev) op: Equal rhs: {(6e0c18cccc8b0c06fba8a8d76486f81a792fb420)} spids: [15] ) ] spids: [15] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_installer_gitrev) op: Equal rhs: {(4f994850808a572e2cc8d43f968893c8e942e9bf)} spids: [24] ) ] spids: [24] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgrel) op:Equal rhs:{(0)} spids:[27])] spids: [27] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("The Rust package manager"))} spids: [30] ) ] spids: [30] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ ("https://crates.io"))} spids: [35] ) ] spids: [35] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (x86_64))} spids:[40])] spids: [40] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ ("MIT ASL-2.0"))} spids:[48])] spids: [48] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:depends) op:Equal rhs:{(DQ (rust))} spids:[53])] spids: [53] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:makedepends) op: Equal rhs: {(DQ ("cmake curl-dev libgit2-dev libssh2-dev libressl-dev python2 zlib-dev"))} spids: [58] ) ] spids: [58] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:subpackages) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") ("-doc\n") ("\t") ($ VSub_Name "$pkgname") ("-bash-completion:bashcomp:noarch\n") ("\t") ($ VSub_Name "$pkgname") ("-zsh-completion:zshcomp:noarch") ) } spids: [63] ) ] spids: [63] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_cbuild) op: Equal rhs: {(DQ ($ VSub_Name "$CARCH") (-unknown-linux-musl))} spids: [105] ) ] spids: [105] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver") (".tar.gz::https://github.com/rust-lang/") ($ VSub_Name "$pkgname") (/archive/) ($ VSub_Name "$pkgver") (".tar.gz\n") ("\thttps://github.com/rust-lang/rust-installer/archive/") ($ VSub_Name "$_installer_gitrev") (/rust-installer-) ($ VSub_Name "$_installer_gitrev") (".tar.gz\n") ("\tcargo-") ($ VSub_Name "$_bootstrap_gitrev") (-) ($ VSub_Name "$_cbuild") (".tar.gz::https://s3.amazonaws.com/rust-lang-ci/cargo-builds/") ($ VSub_Name "$_bootstrap_gitrev") (/cargo-nightly-) ($ VSub_Name "$_cbuild") (".tar.gz\n") ("\tfix-test-build-auth.patch") ) } spids: [111] ) ] spids: [111] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:builddir) op: Equal rhs: {(DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver"))} spids: [138] ) ] spids: [138] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_bootstrap_cargo) op: Equal rhs: { (DQ ($ VSub_Name "$srcdir") (/cargo-nightly-) ($ VSub_Name "$_cbuild") (/cargo/bin/cargo)) } spids: [148] ) ] spids: [148] ) (C {(export)} {(Lit_VarLike "CARGOFLAGS=") (DQ (--locked))}) (C {(export)} {(Lit_VarLike "CARGO_HOME=") (DQ ($ VSub_Name "$srcdir") (/.cargo))}) (FuncDef name: prepare body: (BraceGroup children: [ (C {(default_prepare)}) (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(rmdir)} {(src/rust-installer)}) (C {(ln)} {(-s)} {(DQ ($ VSub_Name "$srcdir")) (/rust-installer-) ($ VSub_Name "$_installer_gitrev")} {(src/rust-installer)} ) ] spids: [177] ) spids: [173 176] ) (FuncDef name: build body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(./configure)} {(--prefix) (Lit_Other "=") (/usr)} {(--release-channel) (Lit_Other "=") (stable)} {(--cargo) (Lit_Other "=") (DQ ($ VSub_Name "$_bootstrap_cargo"))} ) (C {(make)} {(Lit_VarLike "LIBGIT2_SYS_USE_PKG_CONFIG=") (1)} {(Lit_VarLike "VERBOSE=") (1)}) ] spids: [215] ) spids: [211 214] ) (FuncDef name: check body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(./target/) ($ VSub_Name "$CTARGET") (/release/cargo)} {(--version)}) (AndOr children: [ (SimpleCommand words: [ {(DQ ($ VSub_Name "$_bootstrap_cargo"))} {(test)} {(--release)} {(--target)} {(DQ ($ VSub_Name "$CTARGET"))} {(--no-fail-fast)} {(--verbose)} ] more_env: [(env_pair name:CFG_DISABLE_CROSS_TESTS val:{(1)} spids:[294])] ) (C {(true)}) ] op_id: Op_DPipe ) ] spids: [271] ) spids: [267 270] ) (FuncDef name: package body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(make)} {(install)} {(Lit_VarLike "DESTDIR=") (DQ ($ VSub_Name "$pkgdir"))}) (C {(rm)} {(-rv)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/lib)}) ] spids: [336] ) spids: [332 335] ) (FuncDef name: bashcomp body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("Bash completions for ") ($ VSub_Name "$pkgname"))} spids: [381] ) ] spids: [381] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:depends) op:Equal rhs:{(DQ )} spids:[388])] spids: [388] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_if) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") ("=") ($ VSub_Name "$pkgver") (-r) ($ VSub_Name "$pkgrel") (" bash") ) } spids: [393] ) ] spids: [393] ) (C {(_mv)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/etc/bash_completion.d/) (Lit_Other "*")} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/share/bash-completion/completions/)} ) (AndOr children: [ (SimpleCommand words: [{(rmdir)} {(-p)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/etc/bash_completion.d)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[435])] ) (C {(true)}) ] op_id: Op_DPipe ) ] spids: [378] ) spids: [374 377] ) (FuncDef name: zshcomp body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("ZSH completions for ") ($ VSub_Name "$pkgname"))} spids: [452] ) ] spids: [452] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:depends) op:Equal rhs:{(DQ )} spids:[459])] spids: [459] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_if) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") ("=") ($ VSub_Name "$pkgver") (-r) ($ VSub_Name "$pkgrel") (" zsh") ) } spids: [464] ) ] spids: [464] ) (C {(_mv)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/share/zsh)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/share/)} ) (C {(rmdir)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/share)}) ] spids: [449] ) spids: [445 448] ) (FuncDef name: _mv body: (BraceGroup children: [ (Sentence child: (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:dest) op:Equal spids:[508])] spids: [506] ) terminator: ) (ForEach iter_name: dest do_arg_iter: True body: (DoGroup children: [(Sentence child:(C {(true)}) terminator:)] spids: [516 521] ) spids: [-1 -1] ) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$dest"))}) (C {(mv)} {($ VSub_At "$@")}) ] spids: [503] ) spids: [499 502] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha512sums) op: Equal rhs: { (DQ ( "561d6817555da802e99964daa74550cc47a285903301da12a245bb62e5857c18069d87a520c5cefb62aecfe5561666352d57dca8f75758f81ea82709565577d2 cargo-0.18.0.tar.gz\n" ) ( "9ceb4755890ad3ae68ce141231c5114077261e0279d3a9a6208053f8d3386c9198e6b94d6321b456648dd5baa86dfc3ae81df44b67d41b428d11afd6763f0cff rust-installer-4f994850808a572e2cc8d43f968893c8e942e9bf.tar.gz\n" ) ( "4df33353b6be1af822220ca03f9ec5a3b6421c9b10ec17b864be586ba495c6210bac70d904b0e0b35eff62ef2c9a681ded526e5cbd37e326dc3146742aa659de cargo-6e0c18cccc8b0c06fba8a8d76486f81a792fb420-x86_64-unknown-linux-musl.tar.gz\n" ) ( "6a789fc1bf0eb19dde9267a10f7506787d6a4bb8316b09f4dee5da083c0fb0bad87630b238d92ef3aaf114d9a337a87797c8ac427f71c53ac06106925d459ee0 fix-test-build-auth.patch" ) ) } spids: [543] ) ] spids: [543] ) ] )