Webseiten-Werkzeuge


Build RawTherapee and ART on MacOS

The following instructions works for me, they do not create a properly signed and portable DMG. The binaries from Benitoite should be your first try.

Changelog:

  • January 27th 2023, successful build on MacOS Ventura 13.1 x86_64, RawTherapee 5.9, ART 1.18.1

Links, read them to get some understanding of the stuff I do:

Install dependencies

MacPorts are too far away from RawTherapee's cmake configuration, stuff like the MacIntegration is no longer found. Homebrew works fine.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
eval "$(/usr/local/bin/brew shellenv)"

# RawTherapee dependencies
brew install gtk+3 gtkmm3 gtk-mac-integration adwaita-icon-theme \
  libomp libsigc++ little-cms2 libiptcdata fftw lensfun \
  cmake expat pkgconfig shared-mime-info

# ART requires additional stuff
brew install exiv2 libraw OpenColorIO mimalloc

We may omit expat, the build process picks up the system wide variant anyway.

Build RawTherapee

Personal notes: RawTherapee in its current stable release doesn't support metadata from CR3 files, preventing me from doing automation. The metadata-exiv2 and its fork from Lawrence27 do not contain various MacOS related fixes. There is hard work wating to merge current dev and metadata-exiv2.

export PATH=/usr/bin:/bin:/usr/sbin:/sbin
eval "$(/usr/local/bin/brew shellenv)"

git clone https://github.com/Beep6581/RawTherapee.git
cd RawTherapee
git checkout 5.9
mkdir build
cd build

cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.1 \
-DPROC_TARGET_NUMBER="2" \
-DCACHE_NAME_SUFFIX="" \
-DCMAKE_C_COMPILER="clang" \
-DCMAKE_CXX_COMPILER="clang++" \
-DWITH_LTO="ON" \
-DLOCAL_PREFIX:STRING="/usr/local" \
-DLENSFUNDBDIR="/Applications/RawTherapee.app/Contents/Resources/share/lensfun" \
-DCMAKE_CXX_FLAGS_RELEASE="-I/usr/local/include -I/usr/local/opt/libomp/include -Wno-pass-failed -Wno-deprecated-register -Wno-unused-command-line-argument -std=c++11 -DNDEBUG=1 -O3" \
-DCMAKE_C_FLAGS_RELEASE="-I/usr/local/include -I/usr/local/opt/libomp/include -Wno-pass-failed -Wno-deprecated-register -Wno-unused-command-line-argument" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-undefined,dynamic_lookup -Wl,-headerpad_max_install_names -O3 -DNDEBUG=1" \
-DOpenMP_C_FLAGS="-fopenmp=lomp" \
-DOpenMP_CXX_FLAGS=-fopenmp=lomp \
-DOpenMP_C_LIB_NAMES="libomp" \
-DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="/usr/local/opt/libomp/lib/libomp.dylib" \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp /usr/local/opt/libomp/lib/libomp.dylib -I/usr/local/include -I/usr/local/opt/libomp/include" \
-DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp /usr/local/opt/libomp/lib/libomp.dylib -I/usr/local/include -I/usr/local/opt/libomp/include" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON  \
..

make -j8 install
sudo make macosx_bundle
  • Open DMG, drag & drop application.
  • To run the application from command line, one needs to set a few environment variables - they are set through Info.plist when started as an App:
#!/bin/bash

export XDG_CONFIG_DIRS=/Applications/RawTherapee.app/Contents/Resources/share/gtk-3.0
export XDG_CONFIG_HOME=/Applications/RawTherapee.app/Contents/Resources/share
export XDG_DATA_DIRS=/Applications/RawTherapee.app/Contents/Resources/share/gtk-3.0
export GTK_PATH=/Applications/RawTherapee.app/Contents/Resources/share/gtk-3.0
export GTK_IM_MODULE_FILE=/Applications/RawTherapee.app/Contents/Resources/etc/gtk-3.0/g
export XDG_DATA_HOME=/Applications/RawTherapee.app/Contents/Resources/share
export GSETTINGS_SCHEMA_DIR=/Applications/RawTherapee.app/Contents/Resources/share/glib-
export GDK_PIXBUF_MODULE_FILE=/Applications/RawTherapee.app/Contents/Resources/etc/gtk-3
export GDK_PIXBUF_MODULEDIR=/Applications/RawTherapee.app/Contents/Frameworks
export LIBDIR=/Applications/RawTherapee.app/Contents/Frameworks
export DATADIR=/Applications/RawTherapee.app/Contents/Resources
export GDK_RENDERING=similar
export GTK_OVERLAY_SCROLLING=0

exec /Applications/RawTherapee.app/Contents/MacOS/RawTherapee "@$"

Build ART

Personal notes: ART happily parses CR3 files and optionally uses exiftool to do so. It looks like this magic slows down operation significantly with my large collection of DarkFrames.

A recent change in ART requires to set DATADIR to make an MacOS build work without the build/ directory available.

export PATH=/usr/bin:/bin:/usr/sbin:/sbin
eval "$(/usr/local/bin/brew shellenv)"

git clone https://beatrubi@bitbucket.org/agriggio/art.git
cd art
git checkout 1.18.1
mkdir build
cd build

cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=13.1 \
-DPROC_TARGET_NUMBER="2" \
-DCACHE_NAME_SUFFIX="" \
-DCMAKE_C_COMPILER="clang" \
-DCMAKE_CXX_COMPILER="clang++" \
-DWITH_LTO="ON" \
-DLOCAL_PREFIX:STRING="/usr/local" \
-DDATADIR="/Applications/ART.app/Contents/Resources/share" \
-DLENSFUNDBDIR="/Applications/ART.app/Contents/Resources/share/lensfun" \
-DCMAKE_CXX_FLAGS_RELEASE="-I/usr/local/include -I/usr/local/opt/libomp/include -Wno-pass-failed -Wno-deprecated-register -Wno-unused-command-line-argument -std=c++11 -DNDEBUG=1 -O3" \
-DCMAKE_C_FLAGS_RELEASE="-I/usr/local/include -I/usr/local/opt/libomp/include -Wno-pass-failed -Wno-deprecated-register -Wno-unused-command-line-argument" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-undefined,dynamic_lookup -Wl,-headerpad_max_install_names -O3 -DNDEBUG=1" \
-DOpenMP_C_FLAGS="-fopenmp=lomp" \
-DOpenMP_CXX_FLAGS=-fopenmp=lomp \
-DOpenMP_C_LIB_NAMES="libomp" \
-DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="/usr/local/opt/libomp/lib/libomp.dylib" \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp /usr/local/opt/libomp/lib/libomp.dylib -I/usr/local/include -I/usr/local/opt/libomp/include" \
-DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp /usr/local/opt/libomp/lib/libomp.dylib -I/usr/local/include -I/usr/local/opt/libomp/include" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON  \
..

make -j8 install
sudo make macosx_bundle
  • Open DMG, drag & drop application.
  • One need to symlink the config folder to keep it outside of the application:
cd /Applications/ART.app/Contents/Resources/share
rm -Rf ART
ln -s ~/.config/ART .
  • To run the application from command line, one needs to set a few environment variables - they are set through Info.plist when started as an App:
#!/bin/bash

export XDG_CONFIG_DIRS=/Applications/ART.app/Contents/Resources/share/gtk-3.0
export XDG_CONFIG_HOME=/Applications/ART.app/Contents/Resources/share
export XDG_DATA_DIRS=/Applications/ART.app/Contents/Resources/share/gtk-3.0
export GTK_PATH=/Applications/ART.app/Contents/Resources/share/gtk-3.0
export GTK_IM_MODULE_FILE=/Applications/ART.app/Contents/Resources/etc/gtk-3.0/g
export XDG_DATA_HOME=/Applications/ART.app/Contents/Resources/share
export GSETTINGS_SCHEMA_DIR=/Applications/ART.app/Contents/Resources/share/glib-
export GDK_PIXBUF_MODULE_FILE=/Applications/ART.app/Contents/Resources/etc/gtk-3
export GDK_PIXBUF_MODULEDIR=/Applications/ART.app/Contents/Frameworks
export LIBDIR=/Applications/ART.app/Contents/Frameworks
export DATADIR=/Applications/ART.app/Contents/Resources
export GDK_RENDERING=similar
export GTK_OVERLAY_SCROLLING=0

exec /Applications/ART.app/Contents/MacOS/ART "@$"

Workaround for CR3 handling in RawTherapee

The following patch enables execution of the external profile generator even we do not have EXIF metadata available. I use this approach to automate processing of CR3 files, my profile generator runs exiftool to get the necessairy input. It's an ugly hack, doesn't work for geometry correction of zoom lenses. Use on your own risk 8-)

diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc
index cc8e9ad81..f0fd15f9f 100644
--- a/rtgui/thumbnail.cc
+++ b/rtgui/thumbnail.cc
@@ -249,7 +249,9 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
     const CacheImageData* cfs = getCacheImageData();
     Glib::ustring defaultPparamsPath = options.findProfilePath(defProf);
     const bool create = (!hasProcParams() || force);
-    const bool run_cpb = !options.CPBPath.empty() && !defaultPparamsPath.empty() && cfs && cfs->exifValid && create;
+    // RUBI's hack - run the profile generator even we do not have valid EXIF data
+    // const bool run_cpb = !options.CPBPath.empty() && !defaultPparamsPath.empty() && cfs && cfs->exifValid && create;
+    const bool run_cpb = !options.CPBPath.empty() && !defaultPparamsPath.empty() && cfs && create;
 
     const Glib::ustring outFName =
         (options.paramsLoadLocation == PLL_Input && options.saveParamsFile) ?
@@ -302,6 +304,17 @@ rtengine::procparams::ProcParams* Thumbnail::createProcParamsForUpdate(bool retu
                              defaultPparamsPath == DEFPROFILE_INTERNAL ? DEFPROFILE_INTERNAL : Glib::build_filename(defaultPparamsPath, Glib::path_get_basename(defProf) + paramFileExtension),
                              cfs,
                              flaggingMode);
+        } else {
+            // RUBI's hack - build a dummy communication file for images RT doesn't carry EXIF data
+            printf("RUBI's hack:\n  tmpFileName: %s\n  fname: %s\n  outFName: %s\n",
+                                       Glib::ustring(tmpFileName).c_str(),
+                                       Glib::ustring(fname).c_str(),
+                                       Glib::ustring(outFName).c_str());
+            FILE *f = g_fopen (tmpFileName.c_str (), "wt");
+            fprintf (f, "[RT General]\n");
+            fprintf (f, "ImageFileName=%s\n", Glib::ustring(fname).c_str());
+            fprintf (f, "OutputProfileFileName=%s\n", Glib::ustring(outFName).c_str());
+            fclose (f);
         }
         delete imageMetaData;
 

Seiten-Werkzeuge