Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/beignet/, dev-libs/beignet/files/
Date: Mon, 28 Nov 2016 13:57:55
Message-Id: 1480341466.3677ef1db84606d689bea66d9212ed2cd3346d62.marecki@gentoo
1 commit: 3677ef1db84606d689bea66d9212ed2cd3346d62
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 28 13:55:34 2016 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 28 13:57:46 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3677ef1d
7
8 dev-libs/beignet: fix detection of OCL ICD and installation of ICD files
9
10 In the past, Beignet CMake scripts would automatically enable its compatibility
11 with the OCL ICD Loader depending on whether dev-libs/ocl-icd was found in the
12 system or not. Patch the scripts so that ocl-icd is only searched for if an
13 appropriate option is set, and define a local use flag which controls the value
14 of this option (and of course the dependency on dev-libs/ocl-icd). Nb. the
15 patch has been submitted upstream.
16
17 Moreover, given we always install Beignet ICD files (they are needed by
18 eselect-opencl) do not install another copy when OCL ICD Loader has been
19 enabled.
20
21 Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=599512
22
23 Package-Manager: portage-2.3.2
24
25 dev-libs/beignet/beignet-1.2.1-r1.ebuild | 103 +++++++++++++++++++++
26 .../beignet-1.2.1-oclicd_optional_gentoo.patch | 23 +++++
27 dev-libs/beignet/metadata.xml | 4 +
28 3 files changed, 130 insertions(+)
29
30 diff --git a/dev-libs/beignet/beignet-1.2.1-r1.ebuild b/dev-libs/beignet/beignet-1.2.1-r1.ebuild
31 new file mode 100644
32 index 00000000..3501b10
33 --- /dev/null
34 +++ b/dev-libs/beignet/beignet-1.2.1-r1.ebuild
35 @@ -0,0 +1,103 @@
36 +# Copyright 1999-2016 Gentoo Foundation
37 +# Distributed under the terms of the GNU General Public License v2
38 +# $Id$
39 +
40 +EAPI=6
41 +
42 +PYTHON_COMPAT=( python2_7 )
43 +CMAKE_BUILD_TYPE="Release"
44 +
45 +inherit python-any-r1 cmake-multilib flag-o-matic toolchain-funcs
46 +
47 +DESCRIPTION="OpenCL implementation for Intel GPUs"
48 +HOMEPAGE="https://01.org/beignet"
49 +
50 +LICENSE="LGPL-2.1+"
51 +SLOT="0"
52 +IUSE="ocl-icd"
53 +
54 +if [[ "${PV}" == "9999" ]]; then
55 + inherit git-r3
56 + EGIT_REPO_URI="git://anongit.freedesktop.org/beignet"
57 + KEYWORDS=""
58 +else
59 + KEYWORDS="~amd64"
60 + SRC_URI="https://01.org/sites/default/files/${P}-source.tar.gz"
61 + S=${WORKDIR}/Beignet-${PV}-Source
62 +fi
63 +
64 +COMMON="${PYTHON_DEPS}
65 + media-libs/mesa
66 + sys-devel/clang
67 + >=sys-devel/llvm-3.5
68 + >=x11-libs/libdrm-2.4.70[video_cards_intel]
69 + x11-libs/libXext
70 + x11-libs/libXfixes"
71 +RDEPEND="${COMMON}
72 + app-eselect/eselect-opencl"
73 +DEPEND="${COMMON}
74 + ${PYTHON_DEPS}
75 + ocl-icd? ( dev-libs/ocl-icd )
76 + virtual/pkgconfig"
77 +
78 +PATCHES=(
79 + "${FILESDIR}"/no-debian-multiarch.patch
80 + "${FILESDIR}"/${P}-oclicd_optional_gentoo.patch
81 + "${FILESDIR}"/${PN}-1.2.0_no-hardcoded-cflags.patch
82 + "${FILESDIR}"/llvm-terminfo.patch
83 +)
84 +
85 +DOCS=(
86 + docs/.
87 +)
88 +
89 +pkg_pretend() {
90 + if [[ ${MERGE_TYPE} != "binary" ]]; then
91 + if tc-is-gcc; then
92 + if [[ $(gcc-major-version) -eq 4 ]] && [[ $(gcc-minor-version) -lt 6 ]]; then
93 + eerror "Compilation with gcc older than 4.6 is not supported"
94 + die "Too old gcc found."
95 + fi
96 + fi
97 + fi
98 +}
99 +
100 +pkg_setup() {
101 + python_setup
102 +}
103 +
104 +src_prepare() {
105 + # See Bug #593968
106 + append-flags -fPIC
107 +
108 + cmake-utils_src_prepare
109 + # We cannot run tests because they require permissions to access
110 + # the hardware, and building them is very time-consuming.
111 + cmake_comment_add_subdirectory utests
112 +}
113 +
114 +multilib_src_configure() {
115 + VENDOR_DIR="/usr/$(get_libdir)/OpenCL/vendors/${PN}"
116 +
117 + local mycmakeargs=(
118 + -DCMAKE_INSTALL_PREFIX="${VENDOR_DIR}"
119 + -DOCLICD_COMPAT=$(usex ocl-icd)
120 + )
121 +
122 + cmake-utils_src_configure
123 +}
124 +
125 +multilib_src_install() {
126 + VENDOR_DIR="/usr/$(get_libdir)/OpenCL/vendors/${PN}"
127 +
128 + cmake-utils_src_install
129 +
130 + insinto /etc/OpenCL/vendors/
131 + echo "${VENDOR_DIR}/lib/${PN}/libcl.so" > "${PN}-${ABI}.icd" || die "Failed to generate ICD file"
132 + doins "${PN}-${ABI}.icd"
133 +
134 + dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libOpenCL.so.1
135 + dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libOpenCL.so
136 + dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libcl.so.1
137 + dosym "lib/${PN}/libcl.so" "${VENDOR_DIR}"/libcl.so
138 +}
139
140 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
141 new file mode 100644
142 index 00000000..89fed33
143 --- /dev/null
144 +++ b/dev-libs/beignet/files/beignet-1.2.1-oclicd_optional_gentoo.patch
145 @@ -0,0 +1,23 @@
146 +--- a/CMakeLists.txt
147 ++++ b/CMakeLists.txt
148 +@@ -223,17 +223,15 @@
149 + # MESSAGE(STATUS "Looking for mesa source code - not found, cl_khr_gl_sharing will be disabled.")
150 + #ENDIF(MESA_SOURCE_FOUND)
151 +
152 ++OPTION(OCLICD_COMPAT "OCL ICD compatibility mode" ON)
153 ++IF(OCLICD_COMPAT)
154 + Find_Package(OCLIcd)
155 + IF(OCLIcd_FOUND)
156 + MESSAGE(STATUS "Looking for OCL ICD header file - found")
157 +- configure_file (
158 +- "intel-beignet.icd.in"
159 +- "${ICD_FILE_NAME}"
160 +- )
161 +- install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${ICD_FILE_NAME} DESTINATION /etc/OpenCL/vendors)
162 + ELSE(OCLIcd_FOUND)
163 + MESSAGE(STATUS "Looking for OCL ICD header file - not found")
164 + ENDIF(OCLIcd_FOUND)
165 ++ENDIF(OCLICD_COMPAT)
166 +
167 + Find_Package(PythonInterp)
168 +
169
170 diff --git a/dev-libs/beignet/metadata.xml b/dev-libs/beignet/metadata.xml
171 index 3e5026e..27418e8 100644
172 --- a/dev-libs/beignet/metadata.xml
173 +++ b/dev-libs/beignet/metadata.xml
174 @@ -5,4 +5,8 @@
175 <email>marecki@g.o</email>
176 <name>Marek Szuba</name>
177 </maintainer>
178 + <use>
179 + <flag name="ocl-icd">Enable compatibility with the
180 + <pkg>dev-libs/ocl-icd</pkg> OpenCL ICD loader</flag>
181 + </use>
182 </pkgmetadata>