# $Id$ PNAME="cargo" PVER="0.18.0" PBUILD="r1" PCAT="dev-util" DESCRIPTION="Systems programming language focused on safety, speed and concurrency." HOMEPAGE="https://crates.io/" # enable bootstrap of cargo with prebuild binary cargo # 0=no, 1=yes BOOTSTRAP=1 DEPEND=">= dev-lang/rust-1.18 >= net-misc/curl-7" SDEPEND=">= dev-util/cmake-3.6 >= dev-lang/python-2.7" if [[ ${BOOTSTRAP} = 0 ]] then SDEPEND=">= dev-util/cargo-0.18" fi SRCFILE="${PVER}.tar.gz" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" sminclude mbuild mtools SRC_URI=( https://github.com/rust-lang/${PNAME}/archive/${SRCFILE} mirror://${PNAME}/${SRCFILE} ) UP2SEPERATOR="\/" UP2DATE="updatecmd https://github.com/rust-lang/cargo/releases | highesttarball gz" if [[ ${BOOTSTRAP} = 1 ]] then CARGOBIN_PVER="${PVER}" CARGOBIN_SRCFILE_x86_64="cargo-${CARGOBIN_PVER}-x86_64-unknown-linux-gnu.tar.gz" CARGOBIN_SRCDIR_x86_64="${BUILDDIR}/cargo-${CARGOBIN_PVER}-x86_64-unknown-linux-gnu" CARGOBIN_SRCFILE_x86="cargo-${CARGOBIN_PVER}-i686-unknown-linux-gnu.tar.gz" CARGOBIN_SRCDIR_x86="${BUILDDIR}/cargo-${CARGOBIN_PVER}-i686-unknown-linux-gnu" CARGOBIN_SRCFILE="$(marchsrcfile CARGOBIN_SRCFILE)" CARGOBIN_SRCDIR="$(marchsrcfile CARGOBIN_SRCDIR)" SRC_URI+=( https://static.rust-lang.org/dist/${CARGOBIN_SRCFILE_x86_64} https://static.rust-lang.org/dist/${CARGOBIN_SRCFILE_x86} ) fi src_compile() { cd ${SRCDIR} local myconf # enforce rust-bin chost myconf+=" --host=${ARCH}-unknown-linux-gnu --build=${ARCH}-unknown-linux-gnu" if [[ ${BOOTSTRAP} = 1 ]] then myconf+=" --cargo=${CARGOBIN_SRCDIR}/cargo/bin/cargo" fi mconfigure \ --release-channel=stable \ --enable-optimize ${myconf} \ || die mmake || die } src_install() { cd ${SRCDIR} make prepare-image-${ARCH}-unknown-linux-gnu IMGDIR_${ARCH}-unknown-linux-gnu=${BINDIR}/usr || die # remove unnecessary files mdelete -r /usr/etc || die minstalldocs LICENSE-* || die }