beignet-1.2.1-r1.ebuild 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python2_7 )
  5. CMAKE_BUILD_TYPE="Release"
  6. inherit python-any-r1 cmake-multilib flag-o-matic toolchain-funcs
  7. DESCRIPTION="OpenCL implementation for Intel GPUs"
  8. HOMEPAGE="https://01.org/beignet"
  9. LICENSE="LGPL-2.1+"
  10. SLOT="0"
  11. IUSE="ocl-icd"
  12. if [[ "${PV}" == "9999" ]]; then
  13. inherit git-r3
  14. EGIT_REPO_URI="git://anongit.freedesktop.org/beignet"
  15. KEYWORDS=""
  16. else
  17. KEYWORDS="~amd64"
  18. SRC_URI="https://01.org/sites/default/files/${P}-source.tar.gz"
  19. S=${WORKDIR}/Beignet-${PV}-Source
  20. fi
  21. COMMON="${PYTHON_DEPS}
  22. media-libs/mesa
  23. sys-devel/clang:0
  24. >=sys-devel/llvm-3.5:0
  25. >=x11-libs/libdrm-2.4.70[video_cards_intel]
  26. x11-libs/libXext
  27. x11-libs/libXfixes"
  28. RDEPEND="${COMMON}
  29. app-eselect/eselect-opencl"
  30. DEPEND="${COMMON}
  31. ${PYTHON_DEPS}
  32. ocl-icd? ( dev-libs/ocl-icd )
  33. virtual/pkgconfig"
  34. PATCHES=(
  35. "${FILESDIR}"/no-debian-multiarch.patch
  36. "${FILESDIR}"/${P}-oclicd_optional_gentoo.patch
  37. "${FILESDIR}"/${PN}-1.2.0_no-hardcoded-cflags.patch
  38. "${FILESDIR}"/llvm-terminfo.patch
  39. )
  40. DOCS=(
  41. docs/.
  42. )
  43. pkg_pretend() {
  44. if [[ ${MERGE_TYPE} != "binary" ]]; then
  45. if tc-is-gcc; then
  46. if [[ $(gcc-major-version) -eq 4 ]] && [[ $(gcc-minor-version) -lt 6 ]]; then
  47. eerror "Compilation with gcc older than 4.6 is not supported"
  48. die "Too old gcc found."
  49. fi
  50. fi
  51. fi
  52. }
  53. pkg_setup() {
  54. python_setup
  55. }
  56. src_prepare() {
  57. # See Bug #593968
  58. append-flags -fPIC
  59. cmake-utils_src_prepare
  60. # We cannot run tests because they require permissions to access
  61. # the hardware, and building them is very time-consuming.
  62. cmake_comment_add_subdirectory utests
  63. }
  64. multilib_src_configure() {
  65. VENDOR_DIR="/usr/$(get_libdir)/OpenCL/vendors/${PN}"
  66. local mycmakeargs=(
  67. -DCMAKE_INSTALL_PREFIX="${VENDOR_DIR}"
  68. -DOCLICD_COMPAT=$(usex ocl-icd)
  69. )
  70. cmake-utils_src_configure
  71. }
  72. multilib_src_install() {
  73. VENDOR_DIR="/usr/$(get_libdir)/OpenCL/vendors/${PN}"
  74. cmake-utils_src_install
  75. insinto /etc/OpenCL/vendors/
  76. echo "${VENDOR_DIR}/lib/${PN}/libcl.so" > "${PN}-${ABI}.icd" || die "Failed to generate ICD file"
  77. doins "${PN}-${ABI}.icd"
  78. dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libOpenCL.so.1
  79. dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libOpenCL.so
  80. dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libcl.so.1
  81. dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libcl.so
  82. }