rust-bin-1.15.0.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils bash-completion-r1
  5. MY_P="rust-${PV}"
  6. DESCRIPTION="Systems programming language from Mozilla"
  7. HOMEPAGE="http://www.rust-lang.org/"
  8. SRC_URI="amd64? ( http://static.rust-lang.org/dist/${MY_P}-x86_64-unknown-linux-gnu.tar.gz )
  9. x86? ( http://static.rust-lang.org/dist/${MY_P}-i686-unknown-linux-gnu.tar.gz )"
  10. LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA"
  11. SLOT="stable"
  12. KEYWORDS="~amd64 ~x86"
  13. IUSE="doc"
  14. DEPEND=">=app-eselect/eselect-rust-0.3_pre20150425
  15. !dev-lang/rust:0
  16. "
  17. RDEPEND="${DEPEND}"
  18. QA_PREBUILT="
  19. opt/${P}/bin/rustc-bin-${PV}
  20. opt/${P}/bin/rustdoc-bin-${PV}
  21. opt/${P}/lib/*.so
  22. opt/${P}/lib/rustlib/*/lib/*.so
  23. "
  24. src_unpack() {
  25. default
  26. local postfix
  27. use amd64 && postfix=x86_64-unknown-linux-gnu
  28. use x86 && postfix=i686-unknown-linux-gnu
  29. mv "${WORKDIR}/${MY_P}-${postfix}" "${S}" || die
  30. }
  31. src_install() {
  32. local std=$(grep 'std' ./components)
  33. local components="rustc,${std}"
  34. use doc && components="${components},rust-docs"
  35. ./install.sh \
  36. --components="${components}" \
  37. --disable-verify \
  38. --prefix="${D}/opt/${P}" \
  39. --mandir="${D}/usr/share/${P}/man" \
  40. --disable-ldconfig \
  41. || die
  42. local rustc=rustc-bin-${PV}
  43. local rustdoc=rustdoc-bin-${PV}
  44. local rustgdb=rust-gdb-bin-${PV}
  45. mv "${D}/opt/${P}/bin/rustc" "${D}/opt/${P}/bin/${rustc}" || die
  46. mv "${D}/opt/${P}/bin/rustdoc" "${D}/opt/${P}/bin/${rustdoc}" || die
  47. mv "${D}/opt/${P}/bin/rust-gdb" "${D}/opt/${P}/bin/${rustgdb}" || die
  48. dosym "/opt/${P}/bin/${rustc}" "/usr/bin/${rustc}"
  49. dosym "/opt/${P}/bin/${rustdoc}" "/usr/bin/${rustdoc}"
  50. dosym "/opt/${P}/bin/${rustgdb}" "/usr/bin/${rustgdb}"
  51. cat <<-EOF > "${T}"/50${P}
  52. LDPATH="/opt/${P}/lib"
  53. MANPATH="/usr/share/${P}/man"
  54. EOF
  55. doenvd "${T}"/50${P}
  56. cat <<-EOF > "${T}/provider-${P}"
  57. /usr/bin/rustdoc
  58. /usr/bin/rust-gdb
  59. EOF
  60. dodir /etc/env.d/rust
  61. insinto /etc/env.d/rust
  62. doins "${T}/provider-${P}"
  63. }
  64. pkg_postinst() {
  65. eselect rust update --if-unset
  66. elog "Rust installs a helper script for calling GDB now,"
  67. elog "for your convenience it is installed under /usr/bin/rust-gdb-bin-${PV},"
  68. if has_version app-editors/emacs || has_version app-editors/emacs-vcs; then
  69. elog "install app-emacs/rust-mode to get emacs support for rust."
  70. fi
  71. if has_version app-editors/gvim || has_version app-editors/vim; then
  72. elog "install app-vim/rust-vim to get vim support for rust."
  73. fi
  74. if has_version 'app-shells/zsh'; then
  75. elog "install app-shells/rust-zshcomp to get zsh completion for rust."
  76. fi
  77. }
  78. pkg_postrm() {
  79. eselect rust unset --if-invalid
  80. }