beignet-1.3.2-r12.ebuild 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Copyright 1999-2019 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit cmake-multilib flag-o-matic
  5. DESCRIPTION="OpenCL implementation for Intel Sandy Bridge, Ivy Bridge and Haswell GPUs"
  6. HOMEPAGE="https://01.org/beignet https://gitlab.freedesktop.org/beignet/beignet"
  7. #SRC_URI="https://01.org/sites/default/files/${P}-source.tar.gz"
  8. EGIT_COMMIT="419c041736c5d19cd9c9e7f90717792a01826638"
  9. SRC_URI="https://github.com/intel/${PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}-${EGIT_COMMIT}.tar.gz"
  10. LICENSE="LGPL-2.1+"
  11. SLOT="0"
  12. KEYWORDS="amd64"
  13. IUSE="ocl20"
  14. LLVM_MAX_SLOT=10
  15. BDEPEND="${PYTHON_DEPS}
  16. virtual/pkgconfig
  17. <=sys-devel/llvm-${LLVM_MAX_SLOT}*=[${MULTILIB_USEDEP}]"
  18. COMMON="
  19. media-libs/mesa[${MULTILIB_USEDEP}]
  20. >=x11-libs/libdrm-2.4.70[video_cards_intel,${MULTILIB_USEDEP}]
  21. x11-libs/libXext[${MULTILIB_USEDEP}]
  22. x11-libs/libXfixes[${MULTILIB_USEDEP}]
  23. "
  24. RDEPEND="${COMMON}"
  25. DEPEND="${COMMON}"
  26. RESTRICT="mirror"
  27. PATCHES=(
  28. "${FILESDIR}/${PN}-1.3.2-Debian-compliant-compiler-flags-handling.patch"
  29. "${FILESDIR}/${PN}-1.3.2-support-kfreebsd.patch"
  30. "${FILESDIR}/${PN}-1.3.2-reduce-notfound-output.patch"
  31. "${FILESDIR}/${PN}-1.3.2-ship-test-tool.patch"
  32. "${FILESDIR}/${PN}-1.3.2-find-python35.patch"
  33. "${FILESDIR}/${PN}-1.3.2-docs-broken-links.patch"
  34. "${FILESDIR}/${PN}-1.3.2-cl_accelerator_intel.patch"
  35. "${FILESDIR}/${PN}-1.3.2-reproducibility.patch"
  36. "${FILESDIR}/${PN}-1.2.0_no-hardcoded-cflags.patch"
  37. "${FILESDIR}/${PN}-9999-libOpenCL.patch"
  38. #"${FILESDIR}/${PN}-1.3.2-static-llvm.patch"
  39. "${FILESDIR}/llvm-terminfo.patch"
  40. "${FILESDIR}/llvm-libs-tr.patch"
  41. "${FILESDIR}/llvm-empty-system-libs.patch"
  42. )
  43. DOCS=(
  44. docs/.
  45. )
  46. S="${WORKDIR}"/${PN}-${EGIT_COMMIT}
  47. src_prepare() {
  48. for SLOT in 4..${LLVM_MAX_SLOT}; do
  49. has_version "sys-devel/llvm:${SLOT}" && LLVM_SLOT=${SLOT}
  50. done
  51. [[ ${LLVM_SLOT} -ge 6 ]] && eapply "${FILESDIR}/${PN}-1.3.2-llvm6-support.patch"
  52. [[ ${LLVM_SLOT} -ge 7 ]] && eapply "${FILESDIR}/${PN}-1.3.2-llvm7-support.patch"
  53. [[ ${LLVM_SLOT} -ge 8 ]] && eapply "${FILESDIR}/${PN}-1.3.2-llvm8-support.patch"
  54. [[ ${LLVM_SLOT} -ge 9 ]] && (
  55. eapply "${FILESDIR}/${PN}-1.3.2-llvm9-support.patch"
  56. eapply "${FILESDIR}/${PN}-1.3.2-llvm9-support-2.patch"
  57. )
  58. [[ ${LLVM_SLOT} -ge 10 ]] && eapply "${FILESDIR}/${PN}-1.3.2-llvm10-support.patch"
  59. cmake_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. CMAKE_BUILD_TYPE=Release
  67. if tc-is-clang; then
  68. filter-flags -f*graphite -f*loop-*
  69. filter-flags -mfpmath* -freorder-blocks-and-partition
  70. filter-flags -flto* -fuse-linker-plugin
  71. filter-flags -ftracer -fvect-cost-model -ftree*
  72. fi
  73. # Pre-compiled headers otherwise result in redefined symbols (gcc only)
  74. if tc-is-gcc; then
  75. append-flags -fpch-deps
  76. fi
  77. # See Bug #593968
  78. append-flags -fPIC -fno-strict-aliasing
  79. local mycmakeargs=(
  80. -DBEIGNET_INSTALL_DIR="${VENDOR_DIR}"
  81. -DCMAKE_INSTALL_PREFIX="${EPREFIX}${VENDOR_DIR}"
  82. -DOCLICD_COMPAT="$(has_version dev-libs/ocl-icd && echo 1 || echo 0)"
  83. $(usex ocl20 "" "-DENABLE_OPENCL_20=0")
  84. )
  85. multilib_is_native_abi || mycmakeargs+=(
  86. -DLLVM_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(get_abi_CHOST ${ABI})-llvm-config"
  87. )
  88. cmake_src_configure
  89. }
  90. multilib_src_install() {
  91. VENDOR_DIR="/usr/$(get_libdir)/OpenCL/vendors/${PN}"
  92. cmake_src_install
  93. # Headers should only be in VENDOR_DIR
  94. rm -rf "${ED}/usr/include"
  95. insinto "/etc/OpenCL/vendors/"
  96. echo "${EPREFIX}${VENDOR_DIR}/lib/${PN}/libcl.so" > "${PN}-${ABI}.icd" || die "Failed to generate ICD file"
  97. doins "${PN}-${ABI}.icd"
  98. dosym "libOpenCL.so.1.0.0" "${VENDOR_DIR}/libOpenCL.so.1"
  99. dosym "libOpenCL.so.1.0.0" "${VENDOR_DIR}/libOpenCL.so"
  100. }
  101. pkg_postinst() {
  102. elog ""
  103. elog "Please note that for Broadwell and newer architectures, Beignet has been deprecated upstream in favour of dev-libs/intel-neo."
  104. elog "It remains the recommended solution for Sandy Bridge, Ivy Bridge and Haswell."
  105. elog ""
  106. }