10 libxml2, # required for statically linked llvm
11 spirv-llvm-translator,
21 clang = llvmPackages.clangUseLLVM;
22 # Workaround to make sure libclang finds libgcc.a and libgcc_s.so when
23 # invoked from within libpocl
24 clangWrapped = runCommand "clang-pocl" { nativeBuildInputs = [ makeWrapper ]; } ''
26 cp -r ${clang}/bin/* $out/bin/
27 LIBGCC_DIR=$(dirname $(find ${stdenv.cc.cc}/lib/ -name libgcc.a))
28 for F in ${clang}/bin/ld*; do
29 BASENAME=$(basename "$F")
30 rm -f $out/bin/$BASENAME
31 makeWrapper ${clang}/bin/$BASENAME $out/bin/$BASENAME \
32 --add-flags "-L$LIBGCC_DIR" \
33 --add-flags "-L${stdenv.cc.cc.lib}/lib"
37 stdenv.mkDerivation (finalAttrs: {
41 src = fetchFromGitHub {
44 rev = "v${finalAttrs.version}";
45 hash = "sha256-NHR9yrI6Odb/s/OBnEVifdcLEXvwqzAMZWpGViv2cJg=";
49 "-DKERNELLIB_HOST_CPU_VARIANTS=distro"
50 # avoid the runtime linker pulling in a different llvm e.g. from graphics drivers
52 "-DENABLE_POCL_BUILDING=OFF"
53 "-DPOCL_ICD_ABSOLUTE_PATH=ON"
55 "-DCLANG=${clangWrapped}/bin/clang"
56 "-DCLANGXX=${clangWrapped}/bin/clang++"
57 "-DENABLE_REMOTE_CLIENT=ON"
58 "-DENABLE_REMOTE_SERVER=ON"
79 passthru.updateScript = nix-update-script { };
82 description = "A portable open source (MIT-licensed) implementation of the OpenCL standard";
83 homepage = "http://portablecl.org";
84 changelog = "https://github.com/pocl/pocl/releases/tag/v${finalAttrs.version}";
85 license = lib.licenses.mit;
86 maintainers = with lib.maintainers; [
90 platforms = lib.platforms.unix;