summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorFis Trivial <ybbs.daans@hotmail.com>2018-06-26 19:40:31 +0000
committerLudovic Courtès <ludo@gnu.org>2018-06-26 23:01:16 +0200
commitf19b26307829d528750264cd87e159a28bb5435c (patch)
tree8a0b95ebaa92c3ee82e9a4d81cca3a96366a40bf /gnu
parent184a214bad352a08d03ab34c7baa3cad2f57c14d (diff)
downloadguix-f19b26307829d528750264cd87e159a28bb5435c.tar.gz
gnu: Add beignet.
* gnu/packages/opencl.scm (beignet): New variable.
* gnu/packages/patches/beignet-correct-file-names.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/opencl.scm93
-rw-r--r--gnu/packages/patches/beignet-correct-file-names.patch32
3 files changed, 124 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 30d314c882..5818603802 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -583,6 +583,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/azr3.patch				\
   %D%/packages/patches/bash-completion-directories.patch	\
   %D%/packages/patches/bazaar-CVE-2017-14176.patch		\
+  %D%/packages/patches/beignet-correct-file-names.patch		\
   %D%/packages/patches/bind-CVE-2018-5738.patch			\
   %D%/packages/patches/binutils-aarch64-symbol-relocation.patch	\
   %D%/packages/patches/binutils-loongson-workaround.patch	\
diff --git a/gnu/packages/opencl.scm b/gnu/packages/opencl.scm
index 3ce8a14c4c..644cd95e93 100644
--- a/gnu/packages/opencl.scm
+++ b/gnu/packages/opencl.scm
@@ -21,11 +21,21 @@
   #:use-module (guix build-system cmake)
   #:use-module (guix download)
   #:use-module (guix git-download)
-  #:use-module (guix packages)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages libedit)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
-  #:use-module (gnu packages ruby))
+  #:use-module (gnu packages ruby)
+  #:use-module (gnu packages video)
+  #:use-module (gnu packages xdisorg)
+  #:use-module (gnu packages xorg))
 
 ;; This file adds OpenCL implementation related packages. Due to the fact that
 ;; OpenCL devices are not available during build (store environment), tests are
@@ -199,3 +209,82 @@ Loader as provided by this package.")
 possible (known) properties of the OpenCL platform and devices available on
 the system.")
     (license license:cc0)))
+
+(define-public beignet
+  (package
+    (name "beignet")
+    (version "1.3.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/intel/beignet/archive/Release_v"
+                    version
+                    ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "18r0lq3dkd4yn6bxa45s2lrr9cjbg70nr2nn6xablvgqwzw0jb0r"))
+              (patches (search-patches "beignet-correct-file-names.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; There's a suspicious .isa binary file under kernels/.
+               ;; Remove it.
+               '(for-each delete-file (find-files "." "\\.isa$")))))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("python" ,python)))
+    (inputs `(("clang@3.7" ,clang-3.7)
+              ("clang-runtime@3.7" ,clang-runtime-3.7)
+              ("glu" ,glu)
+              ("llvm@3.7" ,llvm-3.7)
+              ("libdrm" ,libdrm)
+              ("libedit" ,libedit)
+              ("libpthread-stubs", libpthread-stubs)
+              ("libsm" ,libsm)
+              ("libva" ,libva)
+              ("libxfixes" ,libxfixes)
+              ("libxext" ,libxext)
+              ("mesa-utils" ,mesa-utils)
+              ("ncurses" ,ncurses)
+              ("ocl-icd" ,ocl-icd)
+              ("opencl-headers" ,opencl-headers)
+              ("xextproto" ,xextproto)
+              ("zlib" ,zlib)))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list (string-append "-DCLANG_LIBRARY_DIR="
+                            (assoc-ref %build-inputs "clang@3.7") "/lib")
+             "-DENABLE_GL_SHARING=ON"
+             "-DEXPERIMENTAL_DOUBLE=ON")
+
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'remove-headers
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (delete-file-recursively
+                (string-append out "/include"))
+               #t)))
+         (add-after 'remove-headers 'install-kernels
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (builddir (getcwd))
+                    (source-dir (string-append
+                                 builddir
+                                 "/../beignet-Release_v1.3.2/kernels")))
+               (copy-recursively source-dir
+                                 (string-append out "/lib/beignet/kernels"))
+               #t))))
+       ;; Beignet tries to find GPU when running tests, which is not available
+       ;; during build.
+       #:tests? #f))
+    (home-page "https://wiki.freedesktop.org/www/Software/Beignet/")
+    (synopsis "OpenCL framework for Intel GPUs")
+    (description
+     "Beignet is an implementation of the OpenCL specification.  This code
+base contains the code to run OpenCL programs on Intel GPUs---IvyBridge,
+Haswell, Skylake, Apollolake, etc.  It defines and implements the OpenCL host
+functions required to initialize the device, create the command queues, the
+kernels and the programs, and run them on the GPU.  The code also contains a
+back-end for the LLVM compiler framework.")
+    (license license:lgpl2.1+)))
diff --git a/gnu/packages/patches/beignet-correct-file-names.patch b/gnu/packages/patches/beignet-correct-file-names.patch
new file mode 100644
index 0000000000..2c5d0bbaea
--- /dev/null
+++ b/gnu/packages/patches/beignet-correct-file-names.patch
@@ -0,0 +1,32 @@
+Help CMake find Clang's libraries.
+Have it install the ICD file in the right place.
+
+diff --git a/CMake/FindLLVM.cmake b/CMake/FindLLVM.cmake
+index 5457f248..e8e8f94a 100644
+--- a/CMake/FindLLVM.cmake
++++ b/CMake/FindLLVM.cmake
+@@ -107,7 +107,7 @@ endif (LLVM_VERSION_NODOT VERSION_GREATER 34)
+ macro(add_one_lib name)
+   FIND_LIBRARY(CLANG_LIB
+     NAMES ${name}
+-    PATHS ${LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
++    PATHS ${CLANG_LIBRARY_DIR} NO_DEFAULT_PATH)
+   set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_LIB})
+ 	unset(CLANG_LIB CACHE)
+ endmacro()
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c11acbb2..fb99e5c8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -217,7 +217,7 @@ IF(OCLIcd_FOUND)
+     "intel-beignet.icd.in"
+     "${ICD_FILE_NAME}"
+   )
+-  install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${ICD_FILE_NAME} DESTINATION /etc/OpenCL/vendors)
++  install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${ICD_FILE_NAME} DESTINATION etc/OpenCL/vendors COMPONENT config)
+ ELSE(OCLIcd_FOUND)
+   MESSAGE(STATUS "Looking for OCL ICD header file - not found")
+   MESSAGE(FATAL_ERROR "OCL ICD loader miss. If you really want to disable OCL ICD support, please run cmake with option -DOCLICD_COMPAT=0.")
+--
+2.14.3
+