From 0aef146cdd397e5109255aa2e49b2ab9bd27d418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Thu, 16 Jul 2020 17:57:09 +0200 Subject: [PATCH] darktable: fix OpenCL support The OpenCL compiler does not properly support -I flags to include the kernel paths, breaking relative includes. Simply replace the included files by absolute paths. OpenCL kernels verified to compile and work on an RX 580. Credits for the fix go to nixos-rocm. --- pkgs/applications/graphics/darktable/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/applications/graphics/darktable/default.nix b/pkgs/applications/graphics/darktable/default.nix index 948b4ddd54db..6327548dc142 100644 --- a/pkgs/applications/graphics/darktable/default.nix +++ b/pkgs/applications/graphics/darktable/default.nix @@ -43,6 +43,10 @@ stdenv.mkDerivation rec { libPathEnvVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; libPathPrefix = "$out/lib/darktable" + stdenv.lib.optionalString stdenv.isLinux ":${ocl-icd}/lib"; in '' + for f in $out/share/darktable/kernels/*.cl; do + sed -r "s|#include \"(.*)\"|#include \"$out/share/darktable/kernels/\1\"|g" -i "$f" + done + gappsWrapperArgs+=( --prefix ${libPathEnvVar} ":" "${libPathPrefix}" )