summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/os-specific/linux/intel-compute-runtime/default.nix57
-rw-r--r--pkgs/os-specific/linux/intel-compute-runtime/etc-dir.patch15
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 74 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/intel-compute-runtime/default.nix b/pkgs/os-specific/linux/intel-compute-runtime/default.nix
new file mode 100644
index 00000000000..5021d12acec
--- /dev/null
+++ b/pkgs/os-specific/linux/intel-compute-runtime/default.nix
@@ -0,0 +1,57 @@
+{ stdenv
+, fetchFromGitHub
+, patchelf
+, cmake
+, pkgconfig
+
+, intel-gmmlib
+, intel-graphics-compiler
+, libva
+}:
+
+stdenv.mkDerivation rec {
+  pname = "intel-compute-runtime";
+  version = "19.34.13959";
+
+  src = fetchFromGitHub {
+    owner = "intel";
+    repo = "compute-runtime";
+    rev = version;
+    sha256 = "1m54w5p5pilrkmlmqgvgrsm3d5dqfdr4jai5siq5ccsqj4gnv1wz";
+  };
+
+  # Build script tries to write the ICD to /etc
+  patches = [ ./etc-dir.patch ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+
+  buildInputs = [ intel-gmmlib intel-graphics-compiler libva ];
+
+  cmakeFlags = [
+    "-DSKIP_UNIT_TESTS=1"
+
+    "-DIGC_DIR=${intel-graphics-compiler}"
+    "-DETC_DIR=${placeholder "out"}/etc"
+
+    # The install script assumes this path is relative to CMAKE_INSTALL_PREFIX
+    "-DCMAKE_INSTALL_LIBDIR=lib"
+  ];
+
+  postInstall = ''
+    # Avoid clash with intel-ocl
+    mv $out/etc/OpenCL/vendors/intel.icd $out/etc/OpenCL/vendors/intel-neo.icd
+  '';
+
+  postFixup = ''
+    patchelf --set-rpath ${stdenv.lib.makeLibraryPath [ intel-gmmlib intel-graphics-compiler libva ]} \
+      $out/lib/intel-opencl/libigdrcl.so
+  '';
+
+  meta = with stdenv.lib; {
+    homepage    = https://github.com/intel/compute-runtime;
+    description = "Intel Graphics Compute Runtime for OpenCL. Replaces Beignet for Gen8 (Broadwell) and beyond.";
+    license     = licenses.mit;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ gloaming ];
+  };
+}
diff --git a/pkgs/os-specific/linux/intel-compute-runtime/etc-dir.patch b/pkgs/os-specific/linux/intel-compute-runtime/etc-dir.patch
new file mode 100644
index 00000000000..d9a80ffa6f9
--- /dev/null
+++ b/pkgs/os-specific/linux/intel-compute-runtime/etc-dir.patch
@@ -0,0 +1,15 @@
+diff --git a/package.cmake b/package.cmake
+index 24960d5..e9a21e7 100644
+--- a/package.cmake
++++ b/package.cmake
+@@ -24,7 +24,9 @@ if(UNIX)
+ 
+   get_os_release_info(os_name os_version)
+ 
+-  if("${os_name}" STREQUAL "clear-linux-os")
++  if(DEFINED ETC_DIR)
++    set(_dir_etc ${ETC_DIR})
++  elseif("${os_name}" STREQUAL "clear-linux-os")
+     # clear-linux-os distribution avoids /etc for distribution defaults.
+     set(_dir_etc "/usr/share/defaults/etc")
+   else()
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 4057d391992..9b3791ea897 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15586,6 +15586,8 @@ in
 
   intel2200BGFirmware = callPackage ../os-specific/linux/firmware/intel2200BGFirmware { };
 
+  intel-compute-runtime = callPackage ../os-specific/linux/intel-compute-runtime { };
+
   intel-ocl = callPackage ../os-specific/linux/intel-ocl { };
 
   iomelt = callPackage ../os-specific/linux/iomelt { };