2021-01-15 15:45:37 +01:00
|
|
|
{ lib, stdenv, fetchzip, rpmextract, ncurses5, numactl, zlib }:
|
2017-02-04 21:24:48 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "intel-ocl";
|
2017-11-01 18:58:20 +01:00
|
|
|
version = "5.0-63503";
|
2017-02-04 21:24:48 +01:00
|
|
|
|
|
|
|
src = fetchzip {
|
2022-04-02 04:56:33 +02:00
|
|
|
# https://github.com/NixOS/nixpkgs/issues/166886
|
|
|
|
urls = [
|
|
|
|
"https://registrationcenter-download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip"
|
|
|
|
"http://registrationcenter-download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip"
|
2022-06-27 15:40:11 +02:00
|
|
|
"https://web.archive.org/web/20190526190814/http://registrationcenter-download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip"
|
2022-04-02 04:56:33 +02:00
|
|
|
];
|
2017-11-01 18:58:20 +01:00
|
|
|
sha256 = "0qbp63l74s0i80ysh9ya8x7r79xkddbbz4378nms9i7a0kprg9p2";
|
2017-02-04 21:24:48 +01:00
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ rpmextract ];
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
2021-01-15 15:45:37 +01:00
|
|
|
libPath = lib.makeLibraryPath [
|
2017-02-04 21:24:48 +01:00
|
|
|
stdenv.cc.cc.lib
|
|
|
|
ncurses5
|
|
|
|
numactl
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
# Extract the RPMs contained within the source ZIP.
|
2017-11-01 18:58:20 +01:00
|
|
|
rpmextract source/intel-opencl-r${version}.x86_64.rpm
|
|
|
|
rpmextract source/intel-opencl-cpu-r${version}.x86_64.rpm
|
2017-02-04 21:24:48 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
patchPhase = ''
|
2017-06-05 20:08:07 +02:00
|
|
|
runHook prePatch
|
|
|
|
|
2017-02-04 21:24:48 +01:00
|
|
|
# Remove libOpenCL.so, since we use ocl-icd's libOpenCL.so instead and this would cause a clash.
|
|
|
|
rm opt/intel/opencl/libOpenCL.so*
|
|
|
|
|
|
|
|
# Patch shared libraries.
|
|
|
|
for lib in opt/intel/opencl/*.so; do
|
|
|
|
patchelf --set-rpath "${libPath}:$out/lib/intel-ocl" $lib || true
|
|
|
|
done
|
2017-06-05 20:08:07 +02:00
|
|
|
|
|
|
|
runHook postPatch
|
2017-02-04 21:24:48 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
2017-06-05 20:08:07 +02:00
|
|
|
runHook preBuild
|
|
|
|
|
2017-02-04 21:24:48 +01:00
|
|
|
# Create ICD file, which just contains the path of the corresponding shared library.
|
|
|
|
echo "$out/lib/intel-ocl/libintelocl.so" > intel.icd
|
2017-06-05 20:08:07 +02:00
|
|
|
|
|
|
|
runHook postBuild
|
2017-02-04 21:24:48 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2017-06-05 20:08:07 +02:00
|
|
|
runHook preInstall
|
|
|
|
|
2017-02-04 21:24:48 +01:00
|
|
|
install -D -m 0755 opt/intel/opencl/*.so* -t $out/lib/intel-ocl
|
|
|
|
install -D -m 0644 opt/intel/opencl/*.{o,rtl,bin} -t $out/lib/intel-ocl
|
|
|
|
install -D -m 0644 opt/intel/opencl/{LICENSE,NOTICES} -t $out/share/doc/intel-ocl
|
|
|
|
install -D -m 0644 intel.icd -t $out/etc/OpenCL/vendors
|
2017-06-05 20:08:07 +02:00
|
|
|
|
|
|
|
runHook postInstall
|
2017-02-04 21:24:48 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Official OpenCL runtime for Intel CPUs";
|
2022-06-27 15:40:11 +02:00
|
|
|
homepage = "https://software.intel.com/en-us/articles/opencl-drivers";
|
|
|
|
license = lib.licenses.unfree;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
2021-01-15 15:45:37 +01:00
|
|
|
maintainers = [ lib.maintainers.kierdavis ];
|
2017-02-04 21:24:48 +01:00
|
|
|
};
|
|
|
|
}
|