lld-4.0.0.ebuild 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. : ${CMAKE_MAKEFILE_GENERATOR:=ninja}
  5. # (needed due to CMAKE_BUILD_TYPE != Gentoo)
  6. CMAKE_MIN_VERSION=3.7.0-r1
  7. PYTHON_COMPAT=( python2_7 )
  8. inherit cmake-utils llvm python-any-r1
  9. DESCRIPTION="The LLVM linker (link editor)"
  10. HOMEPAGE="http://llvm.org/"
  11. SRC_URI="http://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz
  12. test? ( http://releases.llvm.org/${PV/_//}/llvm-${PV/_/}.src.tar.xz )"
  13. LICENSE="UoI-NCSA"
  14. SLOT="0"
  15. KEYWORDS="~amd64 ~arm64 ~x86"
  16. IUSE="test"
  17. RDEPEND="~sys-devel/llvm-${PV}"
  18. DEPEND="${RDEPEND}
  19. test? ( $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]") )"
  20. S=${WORKDIR}/${P/_/}.src
  21. # least intrusive of all
  22. CMAKE_BUILD_TYPE=RelWithDebInfo
  23. python_check_deps() {
  24. has_version "dev-python/lit[${PYTHON_USEDEP}]"
  25. }
  26. pkg_setup() {
  27. LLVM_MAX_SLOT=${PV%%.*} llvm_pkg_setup
  28. use test && python-any-r1_pkg_setup
  29. }
  30. src_unpack() {
  31. default
  32. if use test; then
  33. mv llvm-* llvm || die
  34. fi
  35. }
  36. src_prepare() {
  37. # backport stand-alone build test fixes from master
  38. eapply "${FILESDIR}/4.0.0/0001-cmake-Support-running-tests-in-stand-alone-builds.patch"
  39. eapply "${FILESDIR}/4.0.0/0002-test-Use-LLD-specific-binary-library-dirs-when-build.patch"
  40. eapply "${FILESDIR}/4.0.0/0003-test-Fix-zlib-cond-when-building-stand-alone-clean-u.patch"
  41. eapply_user
  42. }
  43. src_configure() {
  44. local mycmakeargs=(
  45. -DBUILD_SHARED_LIBS=ON
  46. -DLLVM_INCLUDE_TESTS=$(usex test)
  47. # TODO: fix detecting pthread upstream in stand-alone build
  48. -DPTHREAD_LIB='-lpthread'
  49. )
  50. use test && mycmakeargs+=(
  51. -DLLVM_BUILD_TESTS=ON
  52. -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
  53. -DLIT_COMMAND="${EPREFIX}/usr/bin/lit"
  54. )
  55. cmake-utils_src_configure
  56. }
  57. src_test() {
  58. cmake-utils_src_make check-lld
  59. }