summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2016-11-28 14:55:34 +0100
committerMarek Szuba <marecki@gentoo.org>2016-11-28 14:57:46 +0100
commit3677ef1db84606d689bea66d9212ed2cd3346d62 (patch)
treeea1c7300be772f121f11b44601f7ce77d377ec6e /dev-libs
parentkde-base/libkworkspace -> kde-plasma/libkworkspace (diff)
downloadgentoo-3677ef1db84606d689bea66d9212ed2cd3346d62.tar.gz
gentoo-3677ef1db84606d689bea66d9212ed2cd3346d62.tar.bz2
gentoo-3677ef1db84606d689bea66d9212ed2cd3346d62.zip
dev-libs/beignet: fix detection of OCL ICD and installation of ICD files
In the past, Beignet CMake scripts would automatically enable its compatibility with the OCL ICD Loader depending on whether dev-libs/ocl-icd was found in the system or not. Patch the scripts so that ocl-icd is only searched for if an appropriate option is set, and define a local use flag which controls the value of this option (and of course the dependency on dev-libs/ocl-icd). Nb. the patch has been submitted upstream. Moreover, given we always install Beignet ICD files (they are needed by eselect-opencl) do not install another copy when OCL ICD Loader has been enabled. Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=599512 Package-Manager: portage-2.3.2
Diffstat (limited to 'dev-libs')
-rw-r--r--dev-libs/beignet/beignet-1.2.1-r1.ebuild103
-rw-r--r--dev-libs/beignet/files/beignet-1.2.1-oclicd_optional_gentoo.patch23
-rw-r--r--dev-libs/beignet/metadata.xml4
3 files changed, 130 insertions, 0 deletions
diff --git a/dev-libs/beignet/beignet-1.2.1-r1.ebuild b/dev-libs/beignet/beignet-1.2.1-r1.ebuild
new file mode 100644
index 000000000000..3501b108d667
--- /dev/null
+++ b/dev-libs/beignet/beignet-1.2.1-r1.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+CMAKE_BUILD_TYPE="Release"
+
+inherit python-any-r1 cmake-multilib flag-o-matic toolchain-funcs
+
+DESCRIPTION="OpenCL implementation for Intel GPUs"
+HOMEPAGE="https://01.org/beignet"
+
+LICENSE="LGPL-2.1+"
+SLOT="0"
+IUSE="ocl-icd"
+
+if [[ "${PV}" == "9999" ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="git://anongit.freedesktop.org/beignet"
+ KEYWORDS=""
+else
+ KEYWORDS="~amd64"
+ SRC_URI="https://01.org/sites/default/files/${P}-source.tar.gz"
+ S=${WORKDIR}/Beignet-${PV}-Source
+fi
+
+COMMON="${PYTHON_DEPS}
+ media-libs/mesa
+ sys-devel/clang
+ >=sys-devel/llvm-3.5
+ >=x11-libs/libdrm-2.4.70[video_cards_intel]
+ x11-libs/libXext
+ x11-libs/libXfixes"
+RDEPEND="${COMMON}
+ app-eselect/eselect-opencl"
+DEPEND="${COMMON}
+ ${PYTHON_DEPS}
+ ocl-icd? ( dev-libs/ocl-icd )
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/no-debian-multiarch.patch
+ "${FILESDIR}"/${P}-oclicd_optional_gentoo.patch
+ "${FILESDIR}"/${PN}-1.2.0_no-hardcoded-cflags.patch
+ "${FILESDIR}"/llvm-terminfo.patch
+)
+
+DOCS=(
+ docs/.
+)
+
+pkg_pretend() {
+ if [[ ${MERGE_TYPE} != "binary" ]]; then
+ if tc-is-gcc; then
+ if [[ $(gcc-major-version) -eq 4 ]] && [[ $(gcc-minor-version) -lt 6 ]]; then
+ eerror "Compilation with gcc older than 4.6 is not supported"
+ die "Too old gcc found."
+ fi
+ fi
+ fi
+}
+
+pkg_setup() {
+ python_setup
+}
+
+src_prepare() {
+ # See Bug #593968
+ append-flags -fPIC
+
+ cmake-utils_src_prepare
+ # We cannot run tests because they require permissions to access
+ # the hardware, and building them is very time-consuming.
+ cmake_comment_add_subdirectory utests
+}
+
+multilib_src_configure() {
+ VENDOR_DIR="/usr/$(get_libdir)/OpenCL/vendors/${PN}"
+
+ local mycmakeargs=(
+ -DCMAKE_INSTALL_PREFIX="${VENDOR_DIR}"
+ -DOCLICD_COMPAT=$(usex ocl-icd)
+ )
+
+ cmake-utils_src_configure
+}
+
+multilib_src_install() {
+ VENDOR_DIR="/usr/$(get_libdir)/OpenCL/vendors/${PN}"
+
+ cmake-utils_src_install
+
+ insinto /etc/OpenCL/vendors/
+ echo "${VENDOR_DIR}/lib/${PN}/libcl.so" > "${PN}-${ABI}.icd" || die "Failed to generate ICD file"
+ doins "${PN}-${ABI}.icd"
+
+ dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libOpenCL.so.1
+ dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libOpenCL.so
+ dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libcl.so.1
+ dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libcl.so
+}
diff --git a/dev-libs/beignet/files/beignet-1.2.1-oclicd_optional_gentoo.patch b/dev-libs/beignet/files/beignet-1.2.1-oclicd_optional_gentoo.patch
new file mode 100644
index 000000000000..89fed3308768
--- /dev/null
+++ b/dev-libs/beignet/files/beignet-1.2.1-oclicd_optional_gentoo.patch
@@ -0,0 +1,23 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -223,17 +223,15 @@
+ # MESSAGE(STATUS "Looking for mesa source code - not found, cl_khr_gl_sharing will be disabled.")
+ #ENDIF(MESA_SOURCE_FOUND)
+
++OPTION(OCLICD_COMPAT "OCL ICD compatibility mode" ON)
++IF(OCLICD_COMPAT)
+ Find_Package(OCLIcd)
+ IF(OCLIcd_FOUND)
+ MESSAGE(STATUS "Looking for OCL ICD header file - found")
+- configure_file (
+- "intel-beignet.icd.in"
+- "${ICD_FILE_NAME}"
+- )
+- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${ICD_FILE_NAME} DESTINATION /etc/OpenCL/vendors)
+ ELSE(OCLIcd_FOUND)
+ MESSAGE(STATUS "Looking for OCL ICD header file - not found")
+ ENDIF(OCLIcd_FOUND)
++ENDIF(OCLICD_COMPAT)
+
+ Find_Package(PythonInterp)
+
diff --git a/dev-libs/beignet/metadata.xml b/dev-libs/beignet/metadata.xml
index 3e5026ee3754..27418e8288f7 100644
--- a/dev-libs/beignet/metadata.xml
+++ b/dev-libs/beignet/metadata.xml
@@ -5,4 +5,8 @@
<email>marecki@gentoo.org</email>
<name>Marek Szuba</name>
</maintainer>
+ <use>
+ <flag name="ocl-icd">Enable compatibility with the
+ <pkg>dev-libs/ocl-icd</pkg> OpenCL ICD loader</flag>
+ </use>
</pkgmetadata>