forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Marek Szuba
committed
Nov 28, 2016
1 parent
c1a792b
commit 3677ef1
Showing
3 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
23 changes: 23 additions & 0 deletions
23
dev-libs/beignet/files/beignet-1.2.1-oclicd_optional_gentoo.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,8 @@ | |
<email>[email protected]</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> |