From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1040970-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id B022F138334
	for <garchives@archives.gentoo.org>; Thu,  9 Aug 2018 02:05:09 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id A5AC6E0905;
	Thu,  9 Aug 2018 02:05:05 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 2E74BE08FB
	for <gentoo-commits@lists.gentoo.org>; Thu,  9 Aug 2018 02:05:05 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 9C997335DA5
	for <gentoo-commits@lists.gentoo.org>; Wed,  8 Aug 2018 13:30:06 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 4FC36380
	for <gentoo-commits@lists.gentoo.org>; Wed,  8 Aug 2018 13:30:04 +0000 (UTC)
From: "Dirkjan Ochtman" <djc@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Dirkjan Ochtman" <djc@gentoo.org>
Message-ID: <1533734991.598ec1ea3e6164061dea2f0f6d5ff4a7b74e3a50.djc@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/rust-bin/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-lang/rust-bin/rust-bin-1.28.0-r1.ebuild
X-VCS-Directories: dev-lang/rust-bin/
X-VCS-Committer: djc
X-VCS-Committer-Name: Dirkjan Ochtman
X-VCS-Revision: 598ec1ea3e6164061dea2f0f6d5ff4a7b74e3a50
X-VCS-Branch: master
Date: Wed,  8 Aug 2018 13:30:04 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 1a90ffbd-343b-4baa-801f-21d7020ce86b
X-Archives-Hash: e9eb25060c7d89628f40b9ed6799be37

commit:     598ec1ea3e6164061dea2f0f6d5ff4a7b74e3a50
Author:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  8 13:19:36 2018 +0000
Commit:     Dirkjan Ochtman <djc <AT> gentoo <DOT> org>
CommitDate: Wed Aug  8 13:29:51 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=598ec1ea

dev-lang/rust-bin: add run-time Cargo deps, fix eselect provider

Closes: https://bugs.gentoo.org/662842
Closes: https://bugs.gentoo.org/662932
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 dev-lang/rust-bin/rust-bin-1.28.0-r1.ebuild | 161 ++++++++++++++++++++++++++++
 1 file changed, 161 insertions(+)

diff --git a/dev-lang/rust-bin/rust-bin-1.28.0-r1.ebuild b/dev-lang/rust-bin/rust-bin-1.28.0-r1.ebuild
new file mode 100644
index 00000000000..34f0792b018
--- /dev/null
+++ b/dev-lang/rust-bin/rust-bin-1.28.0-r1.ebuild
@@ -0,0 +1,161 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils bash-completion-r1 versionator toolchain-funcs
+
+MY_P="rust-${PV}"
+
+DESCRIPTION="Systems programming language from Mozilla"
+HOMEPAGE="https://www.rust-lang.org/"
+SRC_URI="amd64? ( https://static.rust-lang.org/dist/${MY_P}-x86_64-unknown-linux-gnu.tar.xz )
+	arm? (
+		https://static.rust-lang.org/dist/${MY_P}-arm-unknown-linux-gnueabi.tar.xz
+		https://static.rust-lang.org/dist/${MY_P}-arm-unknown-linux-gnueabihf.tar.xz
+		https://static.rust-lang.org/dist/${MY_P}-armv7-unknown-linux-gnueabihf.tar.xz
+		)
+	x86? ( https://static.rust-lang.org/dist/${MY_P}-i686-unknown-linux-gnu.tar.xz )"
+
+LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
+SLOT="stable"
+KEYWORDS="~amd64 ~x86"
+IUSE="cargo doc libressl rustfmt"
+
+CARGO_DEPEND_VERSION="0.$(($(get_version_component_range 2) + 1)).0"
+
+DEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
+	!dev-lang/rust:0
+	cargo? ( !dev-util/cargo )
+	rustfmt? ( !dev-util/rustfmt )
+"
+RDEPEND="${DEPEND}
+		cargo? (
+			sys-libs/zlib
+			!libressl? ( dev-libs/openssl:0= )
+			libressl? ( dev-libs/libressl:0= )
+			net-libs/libssh2
+			net-libs/http-parser
+			net-misc/curl[ssl]
+		)"
+PDEPEND="!cargo? ( >=dev-util/cargo-${CARGO_DEPEND_VERSION} )"
+
+QA_PREBUILT="
+	opt/${P}/bin/*-${PV}
+	opt/${P}/lib/*.so
+	opt/${P}/lib/rustlib/*/lib/*.so
+	opt/${P}/lib/rustlib/*/lib/*.rlib*
+"
+
+pkg_pretend () {
+	if [[ "$(tc-is-softfloat)" != "no" ]] && [[ ${CHOST} == armv7* ]]; then
+		die "${CHOST} is not supported by upstream Rust. You must use a hard float version."
+	fi
+}
+
+src_unpack() {
+	default
+
+	local postfix
+	use amd64 && postfix=x86_64-unknown-linux-gnu
+
+	if use arm && [[ "$(tc-is-softfloat)" != "no" ]] && [[ ${CHOST} == armv6* ]]; then
+		postfix=arm-unknown-linux-gnueabi
+	elif use arm && [[ ${CHOST} == armv6*h* ]]; then
+		postfix=arm-unknown-linux-gnueabihf
+	elif use arm && [[ ${CHOST} == armv7*h* ]]; then
+		postfix=armv7-unknown-linux-gnueabihf
+	fi
+
+	use x86 && postfix=i686-unknown-linux-gnu
+	mv "${WORKDIR}/${MY_P}-${postfix}" "${S}" || die
+}
+
+src_install() {
+	local std=$(grep 'std' ./components)
+	local components="rustc,${std}"
+	use doc && components="${components},rust-docs"
+	use cargo && components="${components},cargo"
+	use rustfmt && components="${components},rustfmt-preview"
+	./install.sh \
+		--components="${components}" \
+		--disable-verify \
+		--prefix="${D}/opt/${P}" \
+		--mandir="${D}/usr/share/${P}/man" \
+		--disable-ldconfig \
+		|| die
+
+	local rustc=rustc-bin-${PV}
+	local rustdoc=rustdoc-bin-${PV}
+	local rustgdb=rust-gdb-bin-${PV}
+	local rustlldb=rust-lldb-bin-${PV}
+
+	mv "${D}/opt/${P}/bin/rustc" "${D}/opt/${P}/bin/${rustc}" || die
+	mv "${D}/opt/${P}/bin/rustdoc" "${D}/opt/${P}/bin/${rustdoc}" || die
+	mv "${D}/opt/${P}/bin/rust-gdb" "${D}/opt/${P}/bin/${rustgdb}" || die
+	mv "${D}/opt/${P}/bin/rust-lldb" "${D}/opt/${P}/bin/${rustlldb}" || die
+
+	dosym "../../opt/${P}/bin/${rustc}" "/usr/bin/${rustc}"
+	dosym "../../opt/${P}/bin/${rustdoc}" "/usr/bin/${rustdoc}"
+	dosym "../../opt/${P}/bin/${rustgdb}" "/usr/bin/${rustgdb}"
+	dosym "../../opt/${P}/bin/${rustlldb}" "/usr/bin/${rustlldb}"
+
+	if use cargo; then
+		local cargo=cargo-bin-${PV}
+		mv "${D}/opt/${P}/bin/cargo" "${D}/opt/${P}/bin/${cargo}" || die
+		dosym "../../opt/${P}/bin/${cargo}" "/usr/bin/${cargo}"
+	fi
+	if use rustfmt; then
+		local rustfmt=rustfmt-bin-${PV}
+		local cargo_fmt=cargo-fmt-bin-${PV}
+		mv "${D}/opt/${P}/bin/rustfmt" "${D}/opt/${P}/bin/${rustfmt}" || die
+		mv "${D}/opt/${P}/bin/cargo-fmt" "${D}/opt/${P}/bin/${cargo_fmt}" || die
+		dosym "../../opt/${P}/bin/${rustfmt}" "/usr/bin/${rustfmt}"
+		dosym "../../opt/${P}/bin/${cargo_fmt}" "/usr/bin/${cargo_fmt}"
+	fi
+
+	cat <<-EOF > "${T}"/50${P}
+	LDPATH="/opt/${P}/lib"
+	MANPATH="/usr/share/${P}/man"
+	EOF
+	doenvd "${T}"/50${P}
+
+	cat <<-EOF > "${T}/provider-${P}"
+	/usr/bin/rustdoc
+	/usr/bin/rust-gdb
+	/usr/bin/rust-lldb
+	EOF
+	if use cargo; then
+		echo /usr/bin/cargo >> "${T}/provider-${P}"
+	fi
+	if use rustfmt; then
+		echo /usr/bin/rustfmt >> "${T}/provider-${P}"
+		echo /usr/bin/cargo-fmt >> "${T}/provider-${P}"
+	fi
+	dodir /etc/env.d/rust
+	insinto /etc/env.d/rust
+	doins "${T}/provider-${P}"
+}
+
+pkg_postinst() {
+	eselect rust update --if-unset
+
+	elog "Rust installs a helper script for calling GDB now,"
+	elog "for your convenience it is installed under /usr/bin/rust-gdb-bin-${PV},"
+
+	if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
+		elog "install app-emacs/rust-mode to get emacs support for rust."
+	fi
+
+	if has_version app-editors/gvim || has_version app-editors/vim; then
+		elog "install app-vim/rust-vim to get vim support for rust."
+	fi
+
+	if has_version 'app-shells/zsh'; then
+		elog "install app-shells/rust-zshcomp to get zsh completion for rust."
+	fi
+}
+
+pkg_postrm() {
+	eselect rust unset --if-invalid
+}