nixpkgs-suyu/pkgs/os-specific/linux/intel-ocl/default.nix

74 lines
1.9 KiB
Nix
Raw Normal View History

2017-02-04 21:24:48 +01:00
{ stdenv, fetchzip, rpmextract, ncurses5, numactl, zlib }:
stdenv.mkDerivation rec {
name = "intel-ocl-${version}";
2017-11-01 18:58:20 +01:00
version = "5.0-63503";
2017-02-04 21:24:48 +01:00
src = fetchzip {
2017-11-01 18:58:20 +01:00
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip";
sha256 = "0qbp63l74s0i80ysh9ya8x7r79xkddbbz4378nms9i7a0kprg9p2";
2017-02-04 21:24:48 +01:00
stripRoot = false;
};
buildInputs = [ rpmextract ];
sourceRoot = ".";
libPath = stdenv.lib.makeLibraryPath [
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 = ''
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
runHook postPatch
2017-02-04 21:24:48 +01:00
'';
buildPhase = ''
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
runHook postBuild
2017-02-04 21:24:48 +01:00
'';
installPhase = ''
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
runHook postInstall
2017-02-04 21:24:48 +01:00
'';
dontStrip = true;
meta = {
description = "Official OpenCL runtime for Intel CPUs";
homepage = https://software.intel.com/en-us/articles/opencl-drivers;
license = stdenv.lib.licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = [ stdenv.lib.maintainers.kierdavis ];
};
}