nixpkgs/pkgs/by-name/in/intel-ocl/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

88 lines
2.2 KiB
Nix

{
lib,
stdenv,
fetchzip,
rpmextract,
ncurses5,
numactl,
zlib,
}:
stdenv.mkDerivation rec {
pname = "intel-ocl";
version = "5.0-63503";
src = fetchzip {
# 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"
"https://web.archive.org/web/20190526190814/http://registrationcenter-download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip"
];
sha256 = "0qbp63l74s0i80ysh9ya8x7r79xkddbbz4378nms9i7a0kprg9p2";
stripRoot = false;
};
buildInputs = [ rpmextract ];
sourceRoot = ".";
libPath = lib.makeLibraryPath [
stdenv.cc.cc
ncurses5
numactl
zlib
];
postUnpack = ''
# Extract the RPMs contained within the source ZIP.
rpmextract source/intel-opencl-r${version}.x86_64.rpm
rpmextract source/intel-opencl-cpu-r${version}.x86_64.rpm
'';
patchPhase = ''
runHook prePatch
# 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
'';
buildPhase = ''
runHook preBuild
# Create ICD file, which just contains the path of the corresponding shared library.
echo "$out/lib/intel-ocl/libintelocl.so" > intel.icd
runHook postBuild
'';
installPhase = ''
runHook preInstall
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
'';
dontStrip = true;
meta = {
description = "Official OpenCL runtime for Intel CPUs";
homepage = "https://software.intel.com/en-us/articles/opencl-drivers";
license = lib.licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = [ ];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
}