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.
This commit is contained in:
Daniël de Kok 2020-07-16 17:57:09 +02:00
parent 6faba433b2
commit 0aef146cdd

View file

@ -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}"
)