Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-lang/rust-bin: initial commit for armv7a #366

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev-lang/rust-bin/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST rust-1.44.1-armv7a-unknown-linux-musleabihf.tar.xz 81889780 BLAKE2B c1d9e153f35abbfc50aa99ef0ad8763e3279edbb2e4ad3f4eaa36f1c1a567603096a3ed9a73b9388e5c2f7ceb6810838ff8948f37753bdbf49c3fa0c0e1f2d01 SHA512 67351a92d8c574f8370edc16fd24cc09216345fd50002e1159f3844c9583c7ec4311b1c0df5b1b4044324a187acd6414bfd1223e97801c82a6b893c5e8a0f297
9 changes: 9 additions & 0 deletions dev-lang/rust-bin/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>[email protected]</email>
<name>Steffen Kuhn</name>
</maintainer>
</pkgmetadata>

129 changes: 129 additions & 0 deletions dev-lang/rust-bin/rust-bin-1.44.1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# 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="arm? ( https://portage.smaeul.xyz/distfiles/${MY_P}-armv7a-unknown-linux-musleabihf.tar.xz )"

LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
SLOT="stable"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
IUSE="doc extended"

DEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
sys-libs/zlib
net-libs/libssh2
net-misc/curl[ssl]
!dev-lang/rust:0
"
RDEPEND="${DEPEND}"

QA_PREBUILT="
opt/${P}/bin/rustc-bin-${PV}
opt/${P}/bin/rustdoc-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."
elif [[ ${CHOST} == armv6*h* ]]; then
die "${CHOST} is not supported on musl. You must use a soft float version."
fi
}

src_unpack() {
default

local postfix
# use amd64 && postfix=x86_64-unknown-linux-musl

if use arm && [[ ${CHOST} == armv7*h* ]]; then
postfix=armv7a-unknown-linux-musleabihf
fi

# use arm64 && postfix=aarch64-unknown-linux-musl
# use x86 && postfix=i686-unknown-linux-musl

mv "${WORKDIR}/${MY_P}-${postfix}" "${S}" || die
}

src_install() {
local std=$(grep 'std' ./components)
local components="rustc,${std},cargo"
use doc && components="${components},rust-docs"
./install.sh \
--components="${components}" \
--disable-verify \
--prefix="${D}/opt/${P}" \
--mandir="${D}/usr/share/${P}/man" \
--disable-ldconfig \
|| die

if use extended; then
dosym "/opt/${P}/bin/cargo" /usr/bin/cargo
dosym "/opt/${P}/share/zsh/site-functions/_cargo" /usr/share/zsh/site-functions/_cargo
newbashcomp "${D}/opt/${P}/etc/bash_completion.d/cargo" cargo
fi

rm -r "${D}/usr/share/${P}/man" || die
rm -r "${D}/opt/${P}/share/doc" || 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}"

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
}