libcxxrt-0.0_p20150423-r1.ebuild 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. EGIT_REPO_URI="git://github.com/pathscale/libcxxrt.git"
  5. [ "${PV%9999}" != "${PV}" ] && SCM="git-2" || SCM=""
  6. inherit flag-o-matic toolchain-funcs portability ${SCM} multilib-minimal
  7. DESCRIPTION="C++ Runtime from PathScale, FreeBSD and NetBSD"
  8. HOMEPAGE="https://github.com/pathscale/libcxxrt http://www.pathscale.com/node/265"
  9. if [ "${PV%9999}" = "${PV}" ] ; then
  10. SRC_URI="mirror://gentoo/${P}.tar.xz"
  11. DEPEND="app-arch/xz-utils"
  12. else
  13. SRC_URI=""
  14. fi
  15. LICENSE="BSD-2"
  16. SLOT="0"
  17. if [ "${PV%9999}" = "${PV}" ] ; then
  18. KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
  19. else
  20. KEYWORDS=""
  21. fi
  22. IUSE="libunwind +static-libs"
  23. RDEPEND="libunwind? ( || ( >=sys-libs/libunwind-1.0.1-r1[static-libs?,${MULTILIB_USEDEP}]
  24. sys-libs/llvm-libunwind[static-libs?,${MULTILIB_USEDEP}] ) )"
  25. DEPEND="${RDEPEND}
  26. ${DEPEND}"
  27. DOCS=( AUTHORS COPYRIGHT README )
  28. src_prepare() {
  29. cp "${FILESDIR}/Makefile" src/ || die
  30. cp "${FILESDIR}/Makefile.test" test/Makefile || die
  31. multilib_copy_sources
  32. }
  33. multilib_src_compile() {
  34. # Notes: we build -nodefaultlibs to avoid linking to gcc libs.
  35. # libcxxrt needs: dladdr (dlopen_lib), libunwind or libgcc_s and the libc.
  36. tc-export CC CXX AR
  37. append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
  38. cd "${BUILD_DIR}/src"
  39. LIBS="$(dlopen_lib) -l$(usex libunwind unwind gcc_s) -lc" emake shared
  40. use static-libs && emake static
  41. }
  42. multilib_src_test() {
  43. cd "${BUILD_DIR}/test"
  44. LD_LIBRARY_PATH="${BUILD_DIR}/src:${LD_LIBRARY_PATH}" \
  45. LIBS="-L${BUILD_DIR}/src -lcxxrt -l$(usex libunwind unwind gcc_s) -lc" \
  46. emake check
  47. }
  48. multilib_src_install() {
  49. # TODO: See README. Maybe hide it in a subdir and let only libcxx know about
  50. # it. FreeBSD head installs it in /lib
  51. dolib.so src/${PN}.so*
  52. use static-libs && dolib.a src/${PN}.a
  53. }
  54. multilib_src_install_all() {
  55. einstalldocs
  56. insinto /usr/include/libcxxrt/
  57. doins src/cxxabi.h src/unwind*.h
  58. }