libcxxrt-0.0_p20140322.ebuild 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. DEPEND="${RDEPEND}
  25. ${DEPEND}"
  26. DOCS=( AUTHORS COPYRIGHT README )
  27. src_prepare() {
  28. cp "${FILESDIR}/Makefile" src/ || die
  29. cp "${FILESDIR}/Makefile.test" test/Makefile || die
  30. multilib_copy_sources
  31. }
  32. multilib_src_compile() {
  33. # Notes: we build -nodefaultlibs to avoid linking to gcc libs.
  34. # libcxxrt needs: dladdr (dlopen_lib), libunwind or libgcc_s and the libc.
  35. tc-export CC CXX AR
  36. append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
  37. cd "${BUILD_DIR}/src"
  38. LIBS="$(dlopen_lib) -l$(usex libunwind unwind gcc_s) -lc" emake shared
  39. use static-libs && emake static
  40. }
  41. multilib_src_test() {
  42. cd "${BUILD_DIR}/test"
  43. LD_LIBRARY_PATH="${BUILD_DIR}/src:${LD_LIBRARY_PATH}" \
  44. LIBS="-L${BUILD_DIR}/src -lcxxrt -l$(usex libunwind unwind gcc_s) -lc" \
  45. emake check
  46. }
  47. multilib_src_install() {
  48. # TODO: See README. Maybe hide it in a subdir and let only libcxx know about
  49. # it. FreeBSD head installs it in /lib
  50. dolib.so src/${PN}.so*
  51. use static-libs && dolib.a src/${PN}.a
  52. }
  53. multilib_src_install_all() {
  54. einstalldocs
  55. insinto /usr/include/libcxxrt/
  56. doins src/cxxabi.h src/unwind*.h
  57. }