Running nixpkgs-update (https://github.com/NixOS/infra/blob/main/non-critical-infra/modules/nixpkgs-update/README.md) with UPDATE_INFO: pocl 7.1 -> 7.2 https://repology.org/project/pocl/versions attrpath: pocl Checking auto update branch... No auto update branch exists Old version 7.1" not present in master derivation file with contents: { lib, stdenv, fetchFromGitHub, cmake, pkg-config, hwloc, llvmPackages, libxml2, # required for statically linked llvm spirv-llvm-translator, spirv-tools, lttng-ust, opencl-headers, ocl-icd, python3, runCommand, makeWrapper, writableTmpDirAsHomeHook, }: let clang = llvmPackages.clangUseLLVM; # Workaround to make sure libclang finds libgcc.a and libgcc_s.so when # invoked from within libpocl clangWrapped = if stdenv.hostPlatform.isDarwin then clang else runCommand "clang-pocl" { nativeBuildInputs = [ makeWrapper ]; } '' mkdir -p $out/bin cp -r ${clang}/bin/* $out/bin/ LIBGCC_DIR=$(dirname $(find ${stdenv.cc.cc}/lib/ -name libgcc.a)) for F in ${clang}/bin/ld*; do BASENAME=$(basename "$F") rm -f $out/bin/$BASENAME makeWrapper ${clang}/bin/$BASENAME $out/bin/$BASENAME \ --add-flags "-L$LIBGCC_DIR" \ --add-flags "-L${lib.getLib stdenv.cc.cc}/lib" done ''; in stdenv.mkDerivation (finalAttrs: { pname = "pocl"; version = "7.2"; src = fetchFromGitHub { owner = "pocl"; repo = "pocl"; tag = "v${finalAttrs.version}"; hash = "sha256-aAqg8AgiAny6FgYa+90Czeff3b6CPYBBIQshR7J2p64="; }; postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' substituteInPlace pocld/shared_cl_context.cc --replace-fail \ "Dev.getInfo()" \ "static_cast(Dev.getInfo())" ''; cmakeFlags = (lib.mapAttrsToList lib.cmakeBool { # avoid the runtime linker pulling in a different llvm e.g. from graphics drivers "STATIC_LLVM" = true; "ENABLE_POCL_BUILDING" = false; "POCL_ICD_ABSOLUTE_PATH" = true; "ENABLE_ICD" = true; "ENABLE_REMOTE_CLIENT" = true; "ENABLE_REMOTE_SERVER" = true; }) ++ (lib.mapAttrsToList lib.cmakeFeature { # Since 7.2, pocl's cmake prefers find_package(LLVM CONFIG) and then # assumes Clang's cmake config lives as a sibling dir under the same # prefix as LLVM's, which doesn't hold with nixpkgs' split llvm/clang # outputs. Forcing WITH_LLVM_CONFIG keeps it on the llvm-config path. "WITH_LLVM_CONFIG" = "${lib.getDev llvmPackages.llvm}/bin/llvm-config"; # On that path it then searches for host clang/LLVM tool binaries next # to llvm-config, which also doesn't hold here (nixpkgs' llvm-config # lives in a separate "dev" output from opt/llc/etc, and clang is a # wholly separate package). Pre-set every HOST_* cache var so # find_program()/find_llvm_program_or_die() short-circuit instead of # searching. The old CLANG/CLANGXX cache vars this replaces aren't # read by pocl's cmake at all anymore. "HOST_CLANG" = "${clangWrapped}/bin/clang"; "HOST_CLANGXX" = "${clangWrapped}/bin/clang++"; "HOST_LLVM_OPT" = "${lib.getBin llvmPackages.llvm}/bin/opt"; "HOST_LLVM_LLC" = "${lib.getBin llvmPackages.llvm}/bin/llc"; "HOST_LLVM_AS" = "${lib.getBin llvmPackages.llvm}/bin/llvm-as"; "HOST_LLVM_DIS" = "${lib.getBin llvmPackages.llvm}/bin/llvm-dis"; "HOST_LLVM_LINK" = "${lib.getBin llvmPackages.llvm}/bin/llvm-link"; "HOST_LLVM_SPIRV" = "${spirv-llvm-translator}/bin/llvm-spirv"; "HOST_SPIRV_LINK" = "${spirv-tools}/bin/spirv-link"; "HOST_LLVM_FILECHECK" = "${lib.getBin llvmPackages.llvm}/bin/FileCheck"; }) # Only x86_64 supports "distro" which allows runtime detection of SSE/AVX ++ lib.optionals stdenv.hostPlatform.isx86_64 [ (lib.cmakeFeature "KERNELLIB_HOST_CPU_VARIANTS" "distro") ] ++ lib.optionals (!stdenv.hostPlatform.isx86_64) [ (lib.cmakeFeature "LLC_HOST_CPU" "generic") ]; nativeBuildInputs = [ cmake pkg-config clangWrapped python3 ]; buildInputs = [ hwloc libxml2 llvmPackages.llvm llvmPackages.libclang opencl-headers ocl-icd spirv-tools spirv-llvm-translator ] ++ lib.optionals stdenv.hostPlatform.isLinux [ lttng-ust ]; nativeInstallCheckInputs = [ writableTmpDirAsHomeHook ]; doInstallCheck = true; installCheckPhase = '' runHook preInstallCheck export OCL_ICD_VENDORS=$out/etc/OpenCL/vendors $out/bin/poclcc -o poclcc.cl.pocl $src/examples/poclcc/poclcc.cl runHook postInstallCheck ''; setupHook = ./setup-hook.sh; meta = { description = "Portable open source (MIT-licensed) implementation of the OpenCL standard"; homepage = "https://portablecl.org"; changelog = "https://github.com/pocl/pocl/releases/tag/v${finalAttrs.version}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ jansol johnrtitor xddxdd ]; platforms = lib.platforms.unix; }; })