summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirkjan Ochtman <djc@gentoo.org>2018-07-12 14:46:56 +0200
committerDirkjan Ochtman <djc@gentoo.org>2018-07-12 14:46:56 +0200
commitb9a8ae66e199136944e2a832a7c7e74cc2af0679 (patch)
treea26e57c6f756afe95f40edf7a7a82977a2d2150f /dev-lang
parentapp-emulation/containerd: Version bump to 1.1.1 (diff)
downloadgentoo-b9a8ae66e199136944e2a832a7c7e74cc2af0679.tar.gz
gentoo-b9a8ae66e199136944e2a832a7c7e74cc2af0679.tar.bz2
gentoo-b9a8ae66e199136944e2a832a7c7e74cc2af0679.zip
dev-lang/rust-bin: fix issues with cargo USE flag, add rustfmt flag
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=660974 Package-Manager: Portage-2.3.40, Repoman-2.3.9
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/rust-bin/metadata.xml1
-rw-r--r--dev-lang/rust-bin/rust-bin-1.27.1-r1.ebuild142
2 files changed, 143 insertions, 0 deletions
diff --git a/dev-lang/rust-bin/metadata.xml b/dev-lang/rust-bin/metadata.xml
index 7f14692ab9aa..3407a1ae8de4 100644
--- a/dev-lang/rust-bin/metadata.xml
+++ b/dev-lang/rust-bin/metadata.xml
@@ -7,5 +7,6 @@
</maintainer>
<use>
<flag name="cargo">Install cargo component</flag>
+ <flag name="rustfmt">Install rustfmt component</flag>
</use>
</pkgmetadata>
diff --git a/dev-lang/rust-bin/rust-bin-1.27.1-r1.ebuild b/dev-lang/rust-bin/rust-bin-1.27.1-r1.ebuild
new file mode 100644
index 000000000000..53d2d4e87ebe
--- /dev/null
+++ b/dev-lang/rust-bin/rust-bin-1.27.1-r1.ebuild
@@ -0,0 +1,142 @@
+# 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 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}"
+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}
+
+ 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
+
+ dosym "../../opt/${P}/bin/${rustc}" "/usr/bin/${rustc}"
+ dosym "../../opt/${P}/bin/${rustdoc}" "/usr/bin/${rustdoc}"
+ dosym "../../opt/${P}/bin/${rustgdb}" "/usr/bin/${rustgdb}"
+
+ if use cargo; then
+ local cargo=cargo-${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-${PV}
+ local cargo_fmt=cargo-fmt-${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
+ EOF
+ 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
+}