darktable: Fix compilation on macOS

Only compile X11 and other components on Linux. Use DYLD_LIBRARY_PATH on
macOS instead of LD_LIBRARY_PATH.

+17 -9
+17 -9
pkgs/applications/graphics/darktable/default.nix
··· 3 3 , ilmbase, gtk3, intltool, lcms2, lensfun, libX11, libexif, libgphoto2, libjpeg 4 4 , libpng, librsvg, libtiff, openexr, osm-gps-map, pkgconfig, sqlite, libxslt 5 5 , openjpeg, lua, pugixml, colord, colord-gtk, libwebp, libsecret, gnome3 6 - , ocl-icd 6 + , ocl-icd, pcre, gtk-mac-integration 7 7 }: 8 8 9 9 stdenv.mkDerivation rec { ··· 18 18 nativeBuildInputs = [ cmake ninja llvm pkgconfig intltool perl desktop-file-utils wrapGAppsHook ]; 19 19 20 20 buildInputs = [ 21 - cairo curl exiv2 glib gtk3 ilmbase lcms2 lensfun libX11 libexif 21 + cairo curl exiv2 glib gtk3 ilmbase lcms2 lensfun libexif 22 22 libgphoto2 libjpeg libpng librsvg libtiff openexr sqlite libxslt 23 23 libsoup graphicsmagick json-glib openjpeg lua pugixml 24 - colord colord-gtk libwebp libsecret gnome3.adwaita-icon-theme 25 - osm-gps-map ocl-icd 26 - ]; 27 - 24 + libwebp libsecret gnome3.adwaita-icon-theme osm-gps-map pcre 25 + ] ++ stdenv.lib.optionals stdenv.isLinux [ 26 + colord colord-gtk libX11 ocl-icd 27 + ] ++ stdenv.lib.optional stdenv.isDarwin gtk-mac-integration; 28 + 28 29 cmakeFlags = [ 29 30 "-DBUILD_USERMANUAL=False" 31 + ] ++ stdenv.lib.optionals stdenv.isDarwin [ 32 + "-DUSE_COLORD=OFF" 33 + "-DUSE_KWALLET=OFF" 30 34 ]; 35 + 31 36 32 37 # darktable changed its rpath handling in commit 33 38 # 83c70b876af6484506901e6b381304ae0d073d3c and as a result the 34 39 # binaries can't find libdarktable.so, so change LD_LIBRARY_PATH in 35 40 # the wrappers: 36 - preFixup = '' 41 + preFixup = let 42 + libPathEnvVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; 43 + libPathPrefix = "$out/lib/darktable" + stdenv.lib.optionalString stdenv.isLinux ":${ocl-icd}/lib"; 44 + in '' 37 45 gappsWrapperArgs+=( 38 - --prefix LD_LIBRARY_PATH ":" "$out/lib/darktable:${ocl-icd}/lib" 46 + --prefix ${libPathEnvVar} ":" "${libPathPrefix}" 39 47 ) 40 48 ''; 41 49 ··· 43 51 description = "Virtual lighttable and darkroom for photographers"; 44 52 homepage = https://www.darktable.org; 45 53 license = licenses.gpl3Plus; 46 - platforms = platforms.linux; 54 + platforms = platforms.linux ++ platforms.darwin; 47 55 maintainers = with maintainers; [ goibhniu rickynils flosse mrVanDalo ]; 48 56 }; 49 57 }