diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index e91b80ed7..fa23fb9ca 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -49,10 +49,6 @@ #endif #include "opthelper.h" -#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) - -#undef CLIPD -#define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f) namespace { @@ -426,10 +422,8 @@ namespace rtengine { #undef ABS -#undef DIST #define ABS(a) ((a)<0?-(a):(a)) -#define DIST(a,b) (ABS(a-b)) RawImageSource::RawImageSource() : ImageSource() @@ -2927,7 +2921,7 @@ lab2ProphotoRgbD50(float L, float A, float B, float& r, float& g, float& b) float X; float Y; float Z; -#define CLIP01(a) ((a)>0?((a)<1?(a):1):0) + { // convert from Lab to XYZ float x, y, z, fx, fy, fz; @@ -2962,9 +2956,6 @@ lab2ProphotoRgbD50(float L, float A, float B, float& r, float& g, float& b) r = prophoto_xyz[0][0] * X + prophoto_xyz[0][1] * Y + prophoto_xyz[0][2] * Z; g = prophoto_xyz[1][0] * X + prophoto_xyz[1][1] * Y + prophoto_xyz[1][2] * Z; b = prophoto_xyz[2][0] * X + prophoto_xyz[2][1] * Y + prophoto_xyz[2][2] * Z; - // r = CLIP01(r); - // g = CLIP01(g); - // b = CLIP01(b); } // Converts raw image including ICC input profile to working space - floating point version diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index a6d172d46..535fc23da 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -61,7 +61,7 @@ void setprogressStrUI(double val, const Glib::ustring str, MyProgressBar* pProgr } } - +#if !defined(__APPLE__) // monitor profile not supported on apple bool find_default_monitor_profile (GdkWindow *rootwin, Glib::ustring &defprof, Glib::ustring &defprofname) { #ifdef WIN32 @@ -91,7 +91,7 @@ bool find_default_monitor_profile (GdkWindow *rootwin, Glib::ustring &defprof, G ReleaseDC (NULL, hDC); } -#elif !defined(__APPLE__) +#elif // taken from geeqie (image.c) and adapted // Originally licensed as GPL v2+, with the following copyright: // * Copyright (C) 2006 John Ellis @@ -129,7 +129,7 @@ bool find_default_monitor_profile (GdkWindow *rootwin, Glib::ustring &defprof, G #endif return false; } - +#endif } diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index f21915cab..08740f696 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -114,60 +114,31 @@ msg "Copying release files:" ditto "${CMAKE_BUILD_TYPE}/MacOS" "${MACOS}" ditto "Resources" "${RESOURCES}" +# Copy the Lensfun database into the app bundle +mkdir -p "${RESOURCES}/share/lensfun" +ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" + +# Copy liblensfun to Frameworks +ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" + +# Copy libomp to Frameworks +ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks" + msg "Copying dependencies from ${GTK_PREFIX}:" CheckLink "${EXECUTABLE}" -msg "Copying library modules from ${GTK_PREFIX}:" -ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 -ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gtk-3.0 - -msg "Removing static libraries and cache files:" -find -E "${LIB}" -type f -regex '.*\.(a|la|cache)$' | while read -r; do rm "${REPLY}"; done - -msg "Copying configuration files from ${GTK_PREFIX}:" -install -d "${ETC}/gtk-3.0" - -# Make Frameworks folder flat -ditto "${LIB}"/gdk-pixbuf-2.0/2*/loaders/*.so "${LIB}" -ditto "${LIB}"/gtk-3.0/3*/immodules/*.{dylib,so} "${LIB}" -rm -r "${LIB}"/gtk-3.0 -rm -r "${LIB}"/gdk-pixbuf-2.0 - -"${LOCAL_PREFIX}"/local/bin/gdk-pixbuf-query-loaders "${LIB}"/libpix*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders -"${LOCAL_PREFIX}"/local/bin/gtk-query-immodules-3.0 "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules -sed -i "" -e "s|${PWD}/RawTherapee.app/Contents/|/Applications/RawTherapee.app/Contents/|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules" -sed -i "" -e "s|/opt/local/|/usr/|" "${ETC}/gtk-3.0/gtk.immodules" - -mkdir -p ${RESOURCES}/share/glib-2.0 -ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/glib-2.0/schemas -"${LOCAL_PREFIX}/local/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" - -msg "Copying shared files from ${GTK_PREFIX}:" -ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime - -# GTK3 themes -ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css -ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css -# Adwaita icons -iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "48x48/devices") -for f in "${iconfolders[@]}"; do - mkdir -p ${RESOURCES}/share/icons/Adwaita/${f} - ditto ${LOCAL_PREFIX}/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f} -done -ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/icons/Adwaita/index.theme -"${LOCAL_PREFIX}/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" -ditto "${LOCAL_PREFIX}/local/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor" - # Copy libjpeg-turbo ("62") into the app bundle ditto ${LOCAL_PREFIX}/local/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib" # Copy libexpat into the app bundle (which is keg-only) - if [[ -d /usr/local/Cellar/expat ]]; then ditto /usr/local/Cellar/expat/*/lib/libexpat.1.dylib "${CONTENTS}/Frameworks"; else ditto "${EXPATLIB}" "${CONTENTS}/Frameworks/libexpat.1.dylib"; fi # Copy libz into the app bundle ditto ${LOCAL_PREFIX}/local/lib/libz.1.dylib "${CONTENTS}/Frameworks" +# Copy libpng16 to the app bundle +ditto ${LOCAL_PREFIX}/local/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16.dylib" + # Copy libtiff 5 into the app bundle ditto ${LOCAL_PREFIX}/local/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib" @@ -181,6 +152,43 @@ ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/lible # Copy libomp to Frameworks ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks" +# Prepare GTK+3 installation +msg "Copying configuration files from ${GTK_PREFIX}:" +install -d "${ETC}/gtk-3.0" +msg "Copying library modules from ${GTK_PREFIX}:" +ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 +ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gtk-3.0 +msg "Removing static libraries and cache files:" +find -E "${LIB}" -type f -regex '.*\.(a|la|cache)$' | while read -r; do rm "${REPLY}"; done + +# Make Frameworks folder flat +msg "Flattening the Frameworks folder" +ditto "${LIB}"/gdk-pixbuf-2.0/2*/loaders/*.so "${LIB}" +ditto "${LIB}"/gtk-3.0/3*/immodules/*.{dylib,so} "${LIB}" +rm -r "${LIB}"/gtk-3.0 +rm -r "${LIB}"/gdk-pixbuf-2.0 + +msg "Build glib database:" +mkdir -p ${RESOURCES}/share/glib-2.0 +ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/glib-2.0/schemas +"${LOCAL_PREFIX}/local/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" + +# GTK+3 themes +msg "Copy GTK+3 theme and icon resources:" +ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css +ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css + +# Adwaita icons +msg "Copy Adwaita icons" +iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "48x48/devices") +for f in "${iconfolders[@]}"; do + mkdir -p ${RESOURCES}/share/icons/Adwaita/${f} + ditto ${LOCAL_PREFIX}/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f} +done +ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/icons/Adwaita/index.theme +"${LOCAL_PREFIX}/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" +ditto "${LOCAL_PREFIX}/local/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor" + # Install names find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do msg "Modifying install names: ${x}" @@ -194,7 +202,23 @@ find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib } | bash -v done +# fix @rpath in Frameworks +msg "Registering @rpath in Frameworks folder:" +for frameworklibs in ${CONTENTS}/Frameworks/* ; do + echo " install_name_tool -delete_rpath /opt/local/lib '${frameworklibs}'" | bash -v + echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${frameworklibs}'" | bash -v +done +# pixbuf loaders & immodules +msg "Build GTK3 databases:" +"${LOCAL_PREFIX}"/local/bin/gdk-pixbuf-query-loaders "${LIB}"/libpix*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders +"${LOCAL_PREFIX}"/local/bin/gtk-query-immodules-3.0 "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules +sed -i "" -e "s|${PWD}/RawTherapee.app/Contents/|/Applications/RawTherapee.app/Contents/|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules" +sed -i "" -e "s|/opt/local/|/usr/|" "${ETC}/gtk-3.0/gtk.immodules" + +# Mime directory +msg "Copying shared files from ${GTK_PREFIX}:" +ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime msg "Installing required application bundle files:" PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx" @@ -203,7 +227,7 @@ ditto "${PROJECT_SOURCE_DIR}/build/Resources" "${RESOURCES}" # Note: executable is renamed to 'rawtherapee-bin'. mkdir "${MACOS}/bin" ditto "${MACOS}/rawtherapee" "${MACOS}/bin/rawtherapee-bin" -rm "${MACOS}/rawtherappe" +rm "${MACOS}/rawtherapee" install -m 0755 "${PROJECT_SOURCE_DATA_DIR}/executable_loader.in" "${MACOS}/rawtherapee" # App bundle resources ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}" @@ -218,15 +242,13 @@ plutil -convert xml1 "${CONTENTS}/Info.plist" plutil -convert xml1 "${CONTENTS}/MacOS/bin/Info.plist" update-mime-database -V "${CONTENTS}/Resources/share/mime" +# Append an LC_RPATH msg "Registering @rpath into the executable:" echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${MACOS}/bin/rawtherapee-bin'" | bash -v echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${EXECUTABLE}-cli'" | bash -v -for frameworklibs in ${CONTENTS}/Frameworks/* ; do - echo " install_name_tool -delete_rpath /opt/local/lib '${frameworklibs}'" | bash -v - echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${frameworklibs}'" | bash -v -done # Sign the app +msg "Codesigning:" CODESIGNID="$(cmake .. -LA -N | grep "CODESIGNID" | cut -d "=" -f2)" if ! test -z "$CODESIGNID" ; then install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt.entitlements" "${CONTENTS}/Entitlements.plist" @@ -237,17 +259,16 @@ codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee-bin" -o runtime - for frameworklibs in ${CONTENTS}/Frameworks/* ; do codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee-bin" -o runtime --timestamp "${frameworklibs}" done -codesign --deep --preserve-metadata=identifier,entitlements,runtime --timestamp --strict -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee" -o runtime --entitlements "${CONTENTS}/Entitlements.plist" "${APP}" +codesign --deep --preserve-metadata=identifier,entitlements,runtime --timestamp --strict -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --entitlements "${CONTENTS}/Entitlements.plist" "${APP}" spctl -a -vvvv "${APP}" fi # Notarize the app - NOTARY="$(cmake .. -LA -N | grep "NOTARY" | cut -d "=" -f2)" if ! test -z "$NOTARY" ; then msg "Notarizing the application:" ditto -c -k --sequesterRsrc --keepParent "${APP}" "${APP}.zip" - uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee.rawtherapee" ${NOTARY} --file "${APP}.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'` + uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee.RawTherapee" ${NOTARY} --file "${APP}.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'` echo "Result= $uuid" # Display identifier string sleep 15 while : @@ -329,7 +350,6 @@ function CreateDmg { done fi - # Zip disk image for redistribution msg "Zipping disk image for redistribution:" @@ -340,3 +360,5 @@ function CreateDmg { rm -rf "${srcDir}" } CreateDmg +msg "Finishing build:" +echo "Script complete."