From b65baed79c44f4e9ee97057135d87b909b0e3102 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Wed, 3 Jun 2020 10:37:15 -0700 Subject: [PATCH 01/34] mac: use sed -i.bak, add X's to mktemp template in macosx_bundle.sh --- tools/osx/macosx_bundle.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index bc1a2dc3bb..81f97bc7e6 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -241,12 +241,12 @@ for lib in "${LIB}"/*; do install_name_tool -change libfreetype.6.dylib "${LIB}"/libfreetype.6.dylib "${lib}" done -# pixbuf loaders & immodules +# Build GTK3 pixbuf loaders & immodules database 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/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules" +"${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.bak "" -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.bak "" -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules" # Install names ModifyInstallNames @@ -265,7 +265,7 @@ ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}" ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/cliInfo.plist.in" "${LIB}/Info.plist" -sed -i "" -e "s|@version@|${PROJECT_FULL_VERSION}| +sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}| s|@shortVersion@|${PROJECT_VERSION}| s|@arch@|${arch}|" \ "${CONTENTS}/Info.plist" @@ -334,7 +334,7 @@ if [[ -n $NOTARY ]]; then fi function CreateDmg { - local srcDir="$(mktemp -dt $$)" + local srcDir="$(mktemp -dt $$.XXXXXXXXXXXX)" msg "Preparing disk image sources at ${srcDir}:" cp -R "${APP}" "${srcDir}" @@ -379,6 +379,7 @@ function CreateDmg { # Sign disk image if [[ -n $CODESIGNID ]]; then + msg "Signing disk image" codesign --deep --force -v -s "${CODESIGNID}" --timestamp "${dmg_name}.dmg" fi From fb18ca6e0a7582c8191a3c29f34c58302cefc3d5 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Thu, 4 Jun 2020 12:47:17 -0700 Subject: [PATCH 02/34] mac: test lensfun version in macosx_bundle.sh to select correct lensfun database version (version_1 for 3.2 and version_2 for 3.95) --- tools/osx/macosx_bundle.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 81f97bc7e6..471184993b 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -165,7 +165,13 @@ echo "Bundle UUID: $(uuidgen|tr 'A-Z' 'a-z')" >> "${RESOURCES}/AboutThisBuild. # Copy the Lensfun database into the app bundle mkdir -p "${RESOURCES}/share/lensfun" -ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" +lensfunversion=$(pkg-config --modversion lensfun | cut -f3 -d'.') +if [ $lensfunversion = 95 ] +then + ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" +else + ditto ${LOCAL_PREFIX}/local/share/lensfun/version_1/* "${RESOURCES}/share/lensfun" +fi # Copy liblensfun to Frameworks ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" From 9bd0e54aea189640fd90913994d94a83d27b0ea0 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Thu, 4 Jun 2020 12:53:25 -0700 Subject: [PATCH 03/34] mac: remove DYLD_FALLBACK_LIBRARY_PATH from main Info.plist --- tools/osx/Info.plist.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/osx/Info.plist.in b/tools/osx/Info.plist.in index 6970ed4da0..79a004885a 100644 --- a/tools/osx/Info.plist.in +++ b/tools/osx/Info.plist.in @@ -5,8 +5,6 @@ XDG_DATA_DIRS /Applications/RawTherapee.app/Contents/Resources/share - DYLD_FALLBACK_LIBRARY_PATH - /Applications/RawTherapee.app/Contents/Frameworks GTK_PATH /Applications/RawTherapee.app/Contents/Frameworks GTK_IM_MODULE_FILE @@ -202,4 +200,4 @@ - \ No newline at end of file + From d190f469086b8de1bcaca714da6764e98d0331f4 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Thu, 4 Jun 2020 12:58:09 -0700 Subject: [PATCH 04/34] mac: removes some -cli codesigning commands --- tools/osx/macosx_bundle.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 471184993b..6410d8b989 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -270,7 +270,6 @@ ditto "${PROJECT_SOURCE_DIR}/rtdata/fonts" "${ETC}/fonts" ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}" ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" -install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/cliInfo.plist.in" "${LIB}/Info.plist" sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}| s|@shortVersion@|${PROJECT_VERSION}| s|@arch@|${arch}|" \ @@ -302,7 +301,6 @@ ditto "${EXECUTABLE}"-cli "${APP}"/.. if [[ -n $CODESIGNID ]]; then msg "Codesigning Application." iconv -f UTF-8 -t ASCII "${PROJECT_SOURCE_DATA_DIR}"/rt.entitlements > "${CMAKE_BUILD_TYPE}"/rt.entitlements - iconv -f UTF-8 -t ASCII "${PROJECT_SOURCE_DATA_DIR}"/rt-cli.entitlements > "${CMAKE_BUILD_TYPE}"/rt-cli.entitlements mv "${EXECUTABLE}"-cli "${LIB}" for frameworklibs in "${LIB}"/*{dylib,so}; do codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee --force --verbose -o runtime --timestamp --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${frameworklibs}" From 6856046c514de5cab239584d7bd4d54bf6226871 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Fri, 5 Jun 2020 13:33:13 -0700 Subject: [PATCH 05/34] mac: remove another -cli codesign command --- tools/osx/macosx_bundle.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 6410d8b989..fdaa7eed7d 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -305,7 +305,6 @@ if [[ -n $CODESIGNID ]]; then for frameworklibs in "${LIB}"/*{dylib,so}; do codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee --force --verbose -o runtime --timestamp --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${frameworklibs}" done - codesign --force -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt-cli.entitlements "${LIB}"/rawtherapee-cli codesign --deep --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${APP}" spctl -a -vvvv "${APP}" fi From ec7dc0b6044f94aa5af5cefbb83d91a3d6c19e3a Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 6 Jun 2020 15:42:29 -0700 Subject: [PATCH 06/34] mac: remove erroneous newlines in macosx_bundle.sh and suppress superfluous codesigning of Contents/Frameworks/*dylib --- tools/osx/macosx_bundle.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index fdaa7eed7d..9688729409 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -251,8 +251,8 @@ done 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.bak "" -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.bak "" -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules" +sed -i.bak -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.bak -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules" # Install names ModifyInstallNames @@ -270,10 +270,7 @@ ditto "${PROJECT_SOURCE_DIR}/rtdata/fonts" "${ETC}/fonts" ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}" ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" -sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}| -s|@shortVersion@|${PROJECT_VERSION}| -s|@arch@|${arch}|" \ -"${CONTENTS}/Info.plist" +sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}|s|@shortVersion@|${PROJECT_VERSION}|s|@arch@|${arch}|" "${CONTENTS}/Info.plist" update-mime-database -V "${RESOURCES}/share/mime" msg "Build glib database:" @@ -302,10 +299,10 @@ if [[ -n $CODESIGNID ]]; then msg "Codesigning Application." iconv -f UTF-8 -t ASCII "${PROJECT_SOURCE_DATA_DIR}"/rt.entitlements > "${CMAKE_BUILD_TYPE}"/rt.entitlements mv "${EXECUTABLE}"-cli "${LIB}" - for frameworklibs in "${LIB}"/*{dylib,so}; do - codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee --force --verbose -o runtime --timestamp --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${frameworklibs}" - done - codesign --deep --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${APP}" + # for frameworklibs in "${LIB}"/*{dylib,so}; do + # codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee --force --verbose -o runtime --timestamp --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${frameworklibs}" + # done + codesign --force --deep --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${APP}" spctl -a -vvvv "${APP}" fi @@ -313,6 +310,7 @@ fi if [[ -n $NOTARY ]]; then msg "Notarizing the application:" ditto -c -k --sequesterRsrc --keepParent "${APP}" "${APP}.zip" + echo "Uploading..." 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 @@ -390,6 +388,7 @@ function CreateDmg { if ! test -z "$NOTARY"; then msg "Notarizing the dmg:" zip "${dmg_name}.dmg.zip" "${dmg_name}.dmg" + echo "Uploading..." uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee" ${NOTARY} --file "${dmg_name}.dmg.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'` echo "dmg Result= $uuid" # Display identifier string sleep 15 From c320888381426d5a23ae959679910730ec20b071 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Fri, 5 Feb 2021 21:06:30 -0800 Subject: [PATCH 07/34] mac: Apple arm64/homebrew compatibility update --- tools/osx/macosx_bundle.sh | 48 ++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 9688729409..1d20257fa5 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -138,7 +138,7 @@ MACOS="${CONTENTS}/MacOS" LIB="${CONTENTS}/Frameworks" ETC="${RESOURCES}/etc" EXECUTABLE="${MACOS}/rawtherapee" -GDK_PREFIX="${LOCAL_PREFIX}/local/" +GDK_PREFIX="${LOCAL_PREFIX}/" msg "Removing old files:" rm -rf "${APP}" *.dmg *.zip @@ -168,16 +168,16 @@ mkdir -p "${RESOURCES}/share/lensfun" lensfunversion=$(pkg-config --modversion lensfun | cut -f3 -d'.') if [ $lensfunversion = 95 ] then - ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" + ditto ${LOCAL_PREFIX}/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" else - ditto ${LOCAL_PREFIX}/local/share/lensfun/version_1/* "${RESOURCES}/share/lensfun" + ditto ${LOCAL_PREFIX}/share/lensfun/version_1/* "${RESOURCES}/share/lensfun" fi # Copy liblensfun to Frameworks -ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" +ditto ${LOCAL_PREFIX}/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" # Copy libomp to Frameworks -ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks" +ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks" msg "Copying dependencies from ${GTK_PREFIX}." CheckLink "${EXECUTABLE}" @@ -186,29 +186,29 @@ CheckLink "${EXECUTABLE}" ModifyInstallNames # Copy libjpeg-turbo ("62") into the app bundle -ditto ${LOCAL_PREFIX}/local/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib" +ditto ${LOCAL_PREFIX}/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" +ditto ${LOCAL_PREFIX}/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" +ditto ${LOCAL_PREFIX}/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" +ditto ${LOCAL_PREFIX}/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib" # Copy the Lensfun database into the app bundle mkdir -p "${RESOURCES}/share/lensfun" -ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" +ditto ${LOCAL_PREFIX}/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" # Copy liblensfun to Frameworks -ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" +ditto ${LOCAL_PREFIX}/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" # Copy libomp to Frameworks -ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks" +ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks" # Prepare GTK+3 installation msg "Copying configuration files from ${GTK_PREFIX}:" @@ -228,19 +228,19 @@ rm -r "${LIB}"/gdk-pixbuf-2.0 # 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 +ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css +ditto {"${LOCAL_PREFIX}","${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} + ditto ${LOCAL_PREFIX}/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" +ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme +"${LOCAL_PREFIX}/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" +ditto "${LOCAL_PREFIX}/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor" # fix libfreetype install name for lib in "${LIB}"/*; do @@ -250,7 +250,7 @@ done # Build GTK3 pixbuf loaders & immodules database 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" +"${LOCAL_PREFIX}/bin/gtk-query-immodules-3.0" "${LIB}/im-*" > "${ETC}/gtk-3.0/gtk.immodules" sed -i.bak -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.bak -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules" @@ -259,7 +259,7 @@ ModifyInstallNames # Mime directory msg "Copying shared files from ${GTK_PREFIX}:" -ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime +ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/mime msg "Installing required application bundle files:" PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx" @@ -275,8 +275,8 @@ update-mime-database -V "${RESOURCES}/share/mime" 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" +ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/glib-2.0/schemas +"${LOCAL_PREFIX}/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" # Append an LC_RPATH msg "Registering @rpath into the main executable." @@ -287,7 +287,7 @@ ModifyInstallNames # fix @rpath in Frameworks msg "Registering @rpath in Frameworks folder." for frameworklibs in "${LIB}"/*{dylib,so,cli}; do - install_name_tool -delete_rpath ${LOCAL_PREFIX}/local/lib "${frameworklibs}" + install_name_tool -delete_rpath ${LOCAL_PREFIX}/lib "${frameworklibs}" install_name_tool -add_rpath /Applications/"${LIB}" "${frameworklibs}" done install_name_tool -delete_rpath RawTherapee.app/Contents/Frameworks "${EXECUTABLE}"-cli @@ -425,5 +425,3 @@ function CreateDmg { CreateDmg msg "Finishing build:" echo "Script complete." -# -# TODO filter out the benign errors From ea7b4349cb2b274d0b46febc2470b337f2fec9ca Mon Sep 17 00:00:00 2001 From: Benitoite Date: Fri, 5 Feb 2021 21:13:56 -0800 Subject: [PATCH 08/34] mac: CMakeLists.txt arm64 homebrew compatibility --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c65307343..751755b845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -376,11 +376,11 @@ if(APPLE) if("${LOCAL_PREFIX}") set(LOCAL_PREFIX "${LOCAL_PREFIX}" - CACHE STRING "macos/gtk parent directory ie /usr or /opt") + CACHE STRING "macos/gtk parent directory ie /usr/local or /opt/local or /opt/homebrew (for arm64)") else() set(LOCAL_PREFIX - /usr - CACHE STRING "macos/gtk parent directory ie /usr or /opt") + /usr/local + CACHE STRING "macos/gtk parent directory ie /usr/local (default) or /opt/local (macports) or /opt/homebrew (for arm64)") endif() if("${FANCY_DMG}") set(FANCY_DMG From ea8c4e6e849ca687143a932d1b5813fe67ef67f2 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 6 Feb 2021 22:01:09 -0800 Subject: [PATCH 09/34] mac: add Apple arm64 CPU native flag --- ProcessorTargets.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ProcessorTargets.cmake b/ProcessorTargets.cmake index aa06b29ee7..9dbf34637e 100644 --- a/ProcessorTargets.cmake +++ b/ProcessorTargets.cmake @@ -32,5 +32,8 @@ set(PROC_TARGET_8_FLAGS "-march=athlon64" CACHE STRING "Processor-8 flags") set(PROC_TARGET_9_LABEL phenomX4 CACHE STRING "Processor-9 label - use it to provide a phenomX4 optimized build, if you have this processor") set(PROC_TARGET_9_FLAGS "-march=amdfam10" CACHE STRING "Processor-9 flags") +set(PROC_TARGET_10_LABEL cpu-native CACHE STRING "Processor-10 label - use it to provide an arm64 (Apple ARM) native build with llvm-clang, if you have this processor") +set(PROC_TARGET_10_FLAGS "-mcpu=native" CACHE STRING "Processor-10 flags") + #set(PROC_TARGET__LABEL procLabel CACHE STRING "Processor- label") #set(PROC_TARGET__FLAGS "procFlags" CACHE STRING "Processor- flags") From 7f838106abb77ddccb69d1975991929e666ff5c5 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Fri, 5 Mar 2021 13:24:33 -0800 Subject: [PATCH 10/34] mac: fix pixbuf query syntax --- tools/osx/macosx_bundle.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 46654976f5..0338f343fd 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -249,10 +249,10 @@ done # Build GTK3 pixbuf loaders & immodules database msg "Build GTK3 databases:" -"${LOCAL_PREFIX}"/local/bin/gdk-pixbuf-query-loaders "${LIB}/libpix*.so" > "${ETC}/gtk-3.0/gdk-pixbuf.loaders" -"${LOCAL_PREFIX}/bin/gtk-query-immodules-3.0" "${LIB}/im-*" > "${ETC}/gtk-3.0/gtk.immodules" -sed -i.bak -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.bak -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules" +"${LOCAL_PREFIX}"/bin/gdk-pixbuf-query-loaders "${LIB}"/libpixbufloader-*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders +"${LOCAL_PREFIX}"/bin/gtk-query-immodules-3.0 "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules +sed -i.bak -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.bak -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}"/gtk-3.0/gtk.immodules # Install names ModifyInstallNames From 819bc831658de2000daa51953bbb9ae23a102289 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Fri, 5 Mar 2021 14:13:14 -0800 Subject: [PATCH 11/34] mac: adapt. of Pandagrapher's patch --- tools/osx/macosx_bundle.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 0338f343fd..80dc289a83 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -233,13 +233,13 @@ ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.c # Adwaita icons msg "Copy Adwaita icons" -iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "48x48/devices") +iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "16x16/ui" "48x48/devices") for f in "${iconfolders[@]}"; do mkdir -p ${RESOURCES}/share/icons/Adwaita/${f} ditto ${LOCAL_PREFIX}/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f} done ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme -"${LOCAL_PREFIX}/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" +"${LOCAL_PREFIX}/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" || "${LOCAL_PREFIX}/bin/gtk-update-icon-cache-3.0" "${RESOURCES}/share/icons/Adwaita" ditto "${LOCAL_PREFIX}/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor" # fix libfreetype install name @@ -250,7 +250,7 @@ done # Build GTK3 pixbuf loaders & immodules database msg "Build GTK3 databases:" "${LOCAL_PREFIX}"/bin/gdk-pixbuf-query-loaders "${LIB}"/libpixbufloader-*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders -"${LOCAL_PREFIX}"/bin/gtk-query-immodules-3.0 "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules +"${LOCAL_PREFIX}"/bin/gtk-query-immodules-3.0 "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules || "${LOCAL_PREFIX}"/bin/gtk-query-immodules "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules sed -i.bak -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.bak -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}"/gtk-3.0/gtk.immodules From b7ae4a45bde9babceafb24deb8bb56be2c83945b Mon Sep 17 00:00:00 2001 From: Benitoite Date: Fri, 5 Mar 2021 17:20:07 -0800 Subject: [PATCH 12/34] mac: additional instructions for the -cli exec. --- tools/osx/INSTALL.readme.rtf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tools/osx/INSTALL.readme.rtf diff --git a/tools/osx/INSTALL.readme.rtf b/tools/osx/INSTALL.readme.rtf new file mode 100644 index 0000000000..799ff5bd77 --- /dev/null +++ b/tools/osx/INSTALL.readme.rtf @@ -0,0 +1,3 @@ +An unsigned -cli is in the zip along with the .dmg. +You must install the app from the .dmg into /Applications and copy the -cli to your /usr/local/bin. +The -cli will load its libraries dynamically from the app in /Applications. From 45c7b62db248b45a1b9b6d808a7271231efac34b Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 6 Mar 2021 20:29:31 -0800 Subject: [PATCH 13/34] mac: revert target 10 --- ProcessorTargets.cmake | 3 --- 1 file changed, 3 deletions(-) diff --git a/ProcessorTargets.cmake b/ProcessorTargets.cmake index b4aa7cf0fc..a752dceeb5 100644 --- a/ProcessorTargets.cmake +++ b/ProcessorTargets.cmake @@ -43,8 +43,5 @@ set(PROC_TARGET_8_FLAGS "-march=athlon64" CACHE STRING "Processor-8 flags") set(PROC_TARGET_9_LABEL phenomX4 CACHE STRING "Processor-9 label - use it to provide a phenomX4 optimized build, if you have this processor") set(PROC_TARGET_9_FLAGS "-march=amdfam10" CACHE STRING "Processor-9 flags") -set(PROC_TARGET_10_LABEL cpu-native CACHE STRING "Processor-10 label - use it to provide an arm64 (Apple ARM) native build with llvm-clang, if you have this processor") -set(PROC_TARGET_10_FLAGS "-mcpu=native" CACHE STRING "Processor-10 flags") - #set(PROC_TARGET__LABEL procLabel CACHE STRING "Processor- label") #set(PROC_TARGET__FLAGS "procFlags" CACHE STRING "Processor- flags") From 8db6b4769ef7a390204727e60e63980593ceb9fd Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sun, 7 Mar 2021 17:46:59 -0800 Subject: [PATCH 14/34] mac: remove legacy environment variable Per https://github.com/Beep6581/RawTherapee/pull/5786#issuecomment-792276656 --- tools/osx/Info.plist.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/osx/Info.plist.in b/tools/osx/Info.plist.in index 79a004885a..4004248cd3 100644 --- a/tools/osx/Info.plist.in +++ b/tools/osx/Info.plist.in @@ -29,8 +29,6 @@ similar GTK_OVERLAY_SCROLLING 0 - GDK_NATIVE_WINDOWS - 1 ATSApplicationFontsPath etc/fonts From 09ceab5f8e7a4f97173e5118c2b4420173a96c9d Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sun, 7 Mar 2021 22:20:14 -0800 Subject: [PATCH 15/34] mac: fix destination of credits/license --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d7d98aa73..83833304e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,7 +304,7 @@ endif() if(NOT DEFINED CREDITSDIR) if(BUILD_BUNDLE) if(APPLE) - set(CREDITSDIR "${DATADIR}") + set(CREDITSDIR "${DATADIR}/..") else() set(CREDITSDIR "${DATADIR}") endif() From b6e26469ba2945f4fb104c28e5cada4b2d01438b Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sun, 7 Mar 2021 22:31:28 -0800 Subject: [PATCH 16/34] mac: copy {LOCAL_PREFIX}/share/locale to bundle --- tools/osx/macosx_bundle.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 80dc289a83..9145036650 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -272,6 +272,7 @@ ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}|s|@shortVersion@|${PROJECT_VERSION}|s|@arch@|${arch}|" "${CONTENTS}/Info.plist" update-mime-database -V "${RESOURCES}/share/mime" +ditto "${LOCAL_PREFIX}/share/locale" "${RESOURCES}/share/locale" msg "Build glib database:" mkdir -p ${RESOURCES}/share/glib-2.0 From d32b04d1fcecfdcb92b3204e4f1c6bd8de82a0b5 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sun, 7 Mar 2021 22:35:47 -0800 Subject: [PATCH 17/34] mac: fixes a path for the License --- tools/osx/macosx_bundle.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 9145036650..d10a3b55d2 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -340,7 +340,7 @@ function CreateDmg { msg "Preparing disk image sources at ${srcDir}:" cp -R "${APP}" "${srcDir}" - cp "${RESOURCES}"/share/LICENSE.txt "${srcDir}" + cp "${RESOURCES}"/LICENSE.txt "${srcDir}" ln -s /Applications "${srcDir}" # Web bookmarks From 80d3486e8d62478747c6a52e5f1a06c93d160c9f Mon Sep 17 00:00:00 2001 From: Benitoite Date: Tue, 9 Mar 2021 17:05:14 -0800 Subject: [PATCH 18/34] mac: fix of UpdateInfo command structure --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83833304e9..0dc2353035 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -371,6 +371,8 @@ if(NOT APPLE) if(DEFINED LENSFUNDBDIR AND NOT IS_ABSOLUTE "${LENSFUNDBDIR}") set(LENSFUNDBDIR "${DATADIR}/${LENSFUNDBDIR}") endif() +else() + set(LENSFUNDBDIR "${LENSFUNDBDIR}") endif() if(APPLE) @@ -683,14 +685,21 @@ if(WIN32) elseif(APPLE) set( ABOUT_COMMAND_WITH_ARGS - cmake + ${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR:STRING=${PROJECT_SOURCE_DIR} -DCACHE_NAME_SUFFIX:STRING=${CACHE_NAME_SUFFIX} - -P ${PROJECT_SOURCE_DIR}/UpdateInfo.cmake -DSYSTEM:STRING=Apple -DCXX_FLAGS:STRING=${CXX_FLAGS} -DLFLAGS:STRING=${LFLAGS} - -DCOMPILER_INFO:STRING=${COMPILER_INFO}) + -DCOMPILER_INFO:STRING=${COMPILER_INFO} + -DPROC_LABEL:STRING="${PROC_LABEL}" + -DPROC_BIT_DEPTH:STRING="${PROC_BIT_DEPTH}" + -DBUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DGTKMM_VERSION:STRING=${GTKMM_VERSION} + -DOPTION_OMP:STRING=${OPTION_OMP} + -DWITH_MYFILE_MMAP:STRING=${WITH_MYFILE_MMAP} + -DLENSFUN_VERSION:STRING=${LENSFUN_VERSION} + -P ${PROJECT_SOURCE_DIR}/UpdateInfo.cmake) else() list(APPEND ABOUT_COMMAND_WITH_ARGS -DSYSTEM:STRING=Linux -DCXX_FLAGS:STRING=${CXX_FLAGS} -DLFLAGS:STRING=${LFLAGS} From 479115665a45a1aaef88dec349d452750f2a4c00 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Tue, 9 Mar 2021 17:28:45 -0800 Subject: [PATCH 19/34] mac: remove redundant copying --- tools/osx/macosx_bundle.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index d10a3b55d2..64e0130f37 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -153,7 +153,7 @@ msg "Copying binary executable files." ditto "${CMAKE_BUILD_TYPE}/MacOS" "${MACOS}" msg "Copying Resources directory." -cp AboutThisBuild.txt "${RESOURCES}" +#cp AboutThisBuild.txt "${RESOURCES}" ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}" echo "\n--------\n" >> "${RESOURCES}/AboutThisBuild.txt" @@ -201,11 +201,11 @@ ditto ${LOCAL_PREFIX}/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16. ditto ${LOCAL_PREFIX}/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib" # Copy the Lensfun database into the app bundle -mkdir -p "${RESOURCES}/share/lensfun" -ditto ${LOCAL_PREFIX}/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" +#mkdir -p "${RESOURCES}/share/lensfun" +#ditto ${LOCAL_PREFIX}/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" # Copy liblensfun to Frameworks -ditto ${LOCAL_PREFIX}/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" +#ditto ${LOCAL_PREFIX}/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" # Copy libomp to Frameworks ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks" @@ -263,14 +263,14 @@ ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/mime msg "Installing required application bundle files:" PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx" -ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}" +#ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}" ditto "${PROJECT_SOURCE_DIR}/rtdata/fonts" "${ETC}/fonts" # App bundle resources ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}" ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" -sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}|s|@shortVersion@|${PROJECT_VERSION}|s|@arch@|${arch}|" "${CONTENTS}/Info.plist" +sed -i "" -e "s|@version@|${PROJECT_FULL_VERSION}|s|@shortVersion@|${PROJECT_VERSION}|s|@arch@|${arch}|" "${CONTENTS}/Info.plist" update-mime-database -V "${RESOURCES}/share/mime" ditto "${LOCAL_PREFIX}/share/locale" "${RESOURCES}/share/locale" From a42329fc41ca3725405ece45be043fe2fb225ced Mon Sep 17 00:00:00 2001 From: Benitoite Date: Tue, 9 Mar 2021 22:21:48 -0800 Subject: [PATCH 20/34] mac: use cmake to configure Info.plist values --- tools/osx/macosx_bundle.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 64e0130f37..aee341ef3b 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -269,8 +269,9 @@ ditto "${PROJECT_SOURCE_DIR}/rtdata/fonts" "${ETC}/fonts" # App bundle resources ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}" ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" -install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" -sed -i "" -e "s|@version@|${PROJECT_FULL_VERSION}|s|@shortVersion@|${PROJECT_VERSION}|s|@arch@|${arch}|" "${CONTENTS}/Info.plist" +#install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" +#sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}|s|@shortVersion@|${PROJECT_VERSION}|s|@arch@|${arch}|" "${CONTENTS}/Info.plist" +cmake -DPROJECT_SOURCE_DATA_DIR=${PROJECT_SOURCE_DATA_DIR} -DCONTENTS=${CONTENTS} -Dversion=${PROJECT_FULL_VERSION} -DshortVersion=${PROJECT_VERSION} -Darch=${arch} -P "${PROJECT_SOURCE_DATA_DIR}/info-plist.cmake" update-mime-database -V "${RESOURCES}/share/mime" ditto "${LOCAL_PREFIX}/share/locale" "${RESOURCES}/share/locale" From 02842b91947f3a6f93d11a94a75c1b73c0080a8a Mon Sep 17 00:00:00 2001 From: Benitoite Date: Tue, 9 Mar 2021 22:24:04 -0800 Subject: [PATCH 21/34] mac: configurator for Info.plist version values --- tools/osx/info-plist.cmake | 1 + 1 file changed, 1 insertion(+) create mode 100644 tools/osx/info-plist.cmake diff --git a/tools/osx/info-plist.cmake b/tools/osx/info-plist.cmake new file mode 100644 index 0000000000..9d64529f30 --- /dev/null +++ b/tools/osx/info-plist.cmake @@ -0,0 +1 @@ +configure_file(${PROJECT_SOURCE_DATA_DIR}/Info.plist.in ${CONTENTS}/Info.plist) From a70646196254f371b3950f489cea1c07ddb6d586 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Wed, 10 Mar 2021 03:56:15 -0800 Subject: [PATCH 22/34] mac: fix locale detection / language --- rtgui/multilangmgr.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rtgui/multilangmgr.cc b/rtgui/multilangmgr.cc index ecf7445195..77e3f1cf60 100644 --- a/rtgui/multilangmgr.cc +++ b/rtgui/multilangmgr.cc @@ -228,7 +228,7 @@ Glib::ustring MultiLangMgr::getOSUserLanguage () langName = localeToLang (localeName); -#elif defined (__linux__) || defined (__APPLE__) +#elif defined (__linux__) // Query the current locale and force decimal point to dot. const char *locale = getenv("LANG"); @@ -238,6 +238,16 @@ Glib::ustring MultiLangMgr::getOSUserLanguage () setlocale (LC_NUMERIC, "C"); +#elif defined (__APPLE__) + + int status = std::system("defaults read -g AppleLocale > mylocale"); + std::ifstream input("mylocale"); + std::stringstream sstr; + while(input >> sstr.rdbuf()); + std::string locale = sstr.str(); + langName = localeToLang (locale); + setlocale (LC_NUMERIC, "C"); + #endif return langName; From 0b00192232134ec0f1033d1d0c08da517d9e4650 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sun, 14 Mar 2021 03:31:56 -0700 Subject: [PATCH 23/34] mac: remove an outdated key from Info.plist --- tools/osx/Info.plist.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/osx/Info.plist.in b/tools/osx/Info.plist.in index 4004248cd3..cc43e48e71 100644 --- a/tools/osx/Info.plist.in +++ b/tools/osx/Info.plist.in @@ -9,8 +9,6 @@ /Applications/RawTherapee.app/Contents/Frameworks GTK_IM_MODULE_FILE /Applications/RawTherapee.app/Contents/Resources/etc/gtk-3.0/gtk.immodules - GTK_MODULES - /Applications/RawTherapee.app/Contents/Frameworks/im-quartz.so XDG_DATA_HOME /Applications/RawTherapee.app/Contents/Resources/share GSETTINGS_SCHEMA_DIR From 6241676b62c4905e946be56218872d13d6bdde88 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sun, 14 Mar 2021 03:34:27 -0700 Subject: [PATCH 24/34] mac: fix path usage for gtk.immodules / locale dir --- tools/osx/macosx_bundle.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index aee341ef3b..c2ccd44cf0 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -252,7 +252,9 @@ msg "Build GTK3 databases:" "${LOCAL_PREFIX}"/bin/gdk-pixbuf-query-loaders "${LIB}"/libpixbufloader-*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders "${LOCAL_PREFIX}"/bin/gtk-query-immodules-3.0 "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules || "${LOCAL_PREFIX}"/bin/gtk-query-immodules "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules sed -i.bak -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.bak -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}"/gtk-3.0/gtk.immodules +sed -i.bak -e "s|${LOCAL_PREFIX}/share/|/Applications/RawTherapee.app/Contents/Resources/share/|" "${ETC}"/gtk-3.0/gtk.immodules +sed -i.bak -e "s|${LOCAL_PREFIX}/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}"/gtk-3.0/gtk.immodules +rm "${ETC}"/*.bak # Install names ModifyInstallNames From 5a85b02a480f606b9a12dc85fdf14f591bbc97bd Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 20 Mar 2021 00:49:04 -0700 Subject: [PATCH 25/34] mac: revert a change merged elsewhere --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dc2353035..e22bf81c26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -685,7 +685,7 @@ if(WIN32) elseif(APPLE) set( ABOUT_COMMAND_WITH_ARGS - ${CMAKE_COMMAND} + cmake -DPROJECT_SOURCE_DIR:STRING=${PROJECT_SOURCE_DIR} -DCACHE_NAME_SUFFIX:STRING=${CACHE_NAME_SUFFIX} -DSYSTEM:STRING=Apple From 964cc4ae2d172205f3501bf36dbb07a60ec27435 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 20 Mar 2021 02:51:59 -0700 Subject: [PATCH 26/34] mac: follow more symlinks for 'brew builds --- tools/osx/macosx_bundle.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index c2ccd44cf0..6df02aeafc 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -236,11 +236,11 @@ msg "Copy Adwaita icons" iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "16x16/ui" "48x48/devices") for f in "${iconfolders[@]}"; do mkdir -p ${RESOURCES}/share/icons/Adwaita/${f} - ditto ${LOCAL_PREFIX}/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f} + cp -RL ${LOCAL_PREFIX}/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f} done -ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme +cp -RL {"${LOCAL_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme "${LOCAL_PREFIX}/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" || "${LOCAL_PREFIX}/bin/gtk-update-icon-cache-3.0" "${RESOURCES}/share/icons/Adwaita" -ditto "${LOCAL_PREFIX}/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor" +cp -RL "${LOCAL_PREFIX}/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor" # fix libfreetype install name for lib in "${LIB}"/*; do @@ -275,11 +275,11 @@ ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" #sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}|s|@shortVersion@|${PROJECT_VERSION}|s|@arch@|${arch}|" "${CONTENTS}/Info.plist" cmake -DPROJECT_SOURCE_DATA_DIR=${PROJECT_SOURCE_DATA_DIR} -DCONTENTS=${CONTENTS} -Dversion=${PROJECT_FULL_VERSION} -DshortVersion=${PROJECT_VERSION} -Darch=${arch} -P "${PROJECT_SOURCE_DATA_DIR}/info-plist.cmake" update-mime-database -V "${RESOURCES}/share/mime" -ditto "${LOCAL_PREFIX}/share/locale" "${RESOURCES}/share/locale" +cp -RL "${LOCAL_PREFIX}/share/locale" "${RESOURCES}/share/locale" msg "Build glib database:" mkdir -p ${RESOURCES}/share/glib-2.0 -ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/glib-2.0/schemas +cp -LR {"${LOCAL_PREFIX}","${RESOURCES}"}/share/glib-2.0/schemas "${LOCAL_PREFIX}/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" # Append an LC_RPATH From b57373f5f76f3553a3b7727c7fb858daa8175e4f Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 20 Mar 2021 02:59:12 -0700 Subject: [PATCH 27/34] mac: link to CoreFoundation for locale detection --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dc2353035..ce731274a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,7 +175,7 @@ if(APPLE) # TODO make -mtune generic conditional and/or specifiable. if(CMAKE_CXX_COMPILER MATCHES "g\\+\\+-mp-4.[5-8]" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "g\\+\\+-mp-4.[5-8]") set(CMAKE_EXE_LINKER_FLAGS - "${CMAKE_EXE_LINKER_FLAGS} /usr/lib/libstdc++.6.dylib -Wl,-headerpad_max_install_names -mtune=generic" + "${CMAKE_EXE_LINKER_FLAGS} /usr/lib/libstdc++.6.dylib -Wl,-headerpad_max_install_names -mtune=generic -framework Foundation" ) message( STATUS From b0ac0427bdf13be6a6a6c422bb1380a18acc60aa Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 20 Mar 2021 03:01:46 -0700 Subject: [PATCH 28/34] mac: link CoreFoundation for locale / C --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce731274a3..2e6cf0b30f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -190,7 +190,7 @@ if(APPLE) # TODO make -mtune generic conditional and/or specifiable. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") set(CMAKE_EXE_LINKER_FLAGS - "${CMAKE_EXE_LINKER_FLAGS} -Wl,-headerpad_max_install_names -mtune=generic" + "${CMAKE_EXE_LINKER_FLAGS} -Wl,-headerpad_max_install_names -mtune=generic -framework Foundation" ) endif() From 2f206d518a26cb4a1485c7552609e5b9b12535a1 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 20 Mar 2021 03:08:49 -0700 Subject: [PATCH 29/34] mac: detect locale with CoreFoundation per https://github.com/Beep6581/RawTherapee/pull/5786#issuecomment-798926898 --- rtgui/multilangmgr.cc | 73 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/rtgui/multilangmgr.cc b/rtgui/multilangmgr.cc index 77e3f1cf60..f02672deb2 100644 --- a/rtgui/multilangmgr.cc +++ b/rtgui/multilangmgr.cc @@ -24,6 +24,9 @@ #include #include #endif +#ifdef __APPLE__ +#include +#endif namespace { @@ -122,6 +125,22 @@ void setGtkLanguage(const Glib::ustring &language) { if(language != "default") { // nothing to change when using default std::string lang = localeToLang.getLocale(language); +#ifdef __APPLE__ + + // On MacOS, LANG environment variable is not defined when running app bundle + // So we should set all locale data + const Glib::ustring localeUTF8 = lang + ".UTF-8"; + + if (setlocale(LC_ALL, localeUTF8.c_str())) { // Check if this language is available in UTF-8 + lang = localeUTF8; + } + + g_setenv("LANG", lang.c_str(), true); + setlocale(LC_ALL, lang.c_str()); + setlocale (LC_NUMERIC, "C"); // Force decimal point to dot. + +#else + const gchar *env_langc = g_getenv("LANG"); if(env_langc) { const std::string env_lang(env_langc); @@ -134,6 +153,8 @@ void setGtkLanguage(const Glib::ustring &language) } g_setenv("LANG", lang.c_str(), true); + +#endif } } @@ -240,13 +261,51 @@ Glib::ustring MultiLangMgr::getOSUserLanguage () #elif defined (__APPLE__) - int status = std::system("defaults read -g AppleLocale > mylocale"); - std::ifstream input("mylocale"); - std::stringstream sstr; - while(input >> sstr.rdbuf()); - std::string locale = sstr.str(); - langName = localeToLang (locale); - setlocale (LC_NUMERIC, "C"); + // "LANG" environment variable is not defined. Retrieving it from CoreFundation API + // Get used Mac string encoding + CFStringEncoding strEncoding = CFStringGetSystemEncoding(); + // Get user locale data + CFLocaleRef cfLocale = CFLocaleCopyCurrent(); + // Get locale language code + CFStringRef langCodeStr = (CFStringRef)CFLocaleGetValue(cfLocale, kCFLocaleLanguageCode); + Glib::ustring langCode(""); + + if (langCodeStr != NULL) { + const auto langCodeStrLength = CFStringGetLength(langCodeStr) + 1; + char langCodeBuffer[langCodeStrLength]; + CFStringGetCString(langCodeStr, langCodeBuffer, langCodeStrLength, strEncoding); + langCode = Glib::ustring(langCodeBuffer); + } + + // Get locale country code + CFStringRef countryCodeStr = (CFStringRef)CFLocaleGetValue(cfLocale, kCFLocaleCountryCode); + Glib::ustring countryCode(""); + + if (countryCodeStr != NULL) { + const auto countryCodeStrLength = CFStringGetLength(countryCodeStr) + 1; + char countryCodeBuffer[countryCodeStrLength]; + CFStringGetCString(countryCodeStr, countryCodeBuffer, countryCodeStrLength, strEncoding); + countryCode = Glib::ustring(countryCodeBuffer); + } + + // Concatenate locale data + Glib::ustring locale = langCode + "_" + countryCode; + + // Release user locale data + CFRelease(cfLocale); + + // Set locale environment data + const Glib::ustring localeUTF8 = locale + ".UTF-8"; + + if (setlocale(LC_ALL, localeUTF8.c_str())) { // Check if this language is available in UTF-8 + locale = localeUTF8; + } + + g_setenv("LANG", locale.c_str(), true); + setlocale(LC_ALL, locale.c_str()); + setlocale (LC_NUMERIC, "C"); // Force decimal point to dot. + + langName = localeToLang(locale); #endif From 82edc6a18b2a01921ad6b05f6f877759862cf41d Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sat, 20 Mar 2021 03:36:41 -0700 Subject: [PATCH 30/34] mac: remove outdated lines --- tools/osx/macosx_bundle.sh | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 6df02aeafc..c26c99e01a 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -200,13 +200,6 @@ ditto ${LOCAL_PREFIX}/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16. # Copy libtiff 5 into the app bundle ditto ${LOCAL_PREFIX}/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib" -# Copy the Lensfun database into the app bundle -#mkdir -p "${RESOURCES}/share/lensfun" -#ditto ${LOCAL_PREFIX}/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" - -# Copy liblensfun to Frameworks -#ditto ${LOCAL_PREFIX}/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" - # Copy libomp to Frameworks ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks" @@ -265,14 +258,11 @@ ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/mime msg "Installing required application bundle files:" PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx" -#ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}" ditto "${PROJECT_SOURCE_DIR}/rtdata/fonts" "${ETC}/fonts" # App bundle resources ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}" ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" -#install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" -#sed -i.bak "" -e "s|@version@|${PROJECT_FULL_VERSION}|s|@shortVersion@|${PROJECT_VERSION}|s|@arch@|${arch}|" "${CONTENTS}/Info.plist" cmake -DPROJECT_SOURCE_DATA_DIR=${PROJECT_SOURCE_DATA_DIR} -DCONTENTS=${CONTENTS} -Dversion=${PROJECT_FULL_VERSION} -DshortVersion=${PROJECT_VERSION} -Darch=${arch} -P "${PROJECT_SOURCE_DATA_DIR}/info-plist.cmake" update-mime-database -V "${RESOURCES}/share/mime" cp -RL "${LOCAL_PREFIX}/share/locale" "${RESOURCES}/share/locale" @@ -303,9 +293,6 @@ if [[ -n $CODESIGNID ]]; then msg "Codesigning Application." iconv -f UTF-8 -t ASCII "${PROJECT_SOURCE_DATA_DIR}"/rt.entitlements > "${CMAKE_BUILD_TYPE}"/rt.entitlements mv "${EXECUTABLE}"-cli "${LIB}" - # for frameworklibs in "${LIB}"/*{dylib,so}; do - # codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee --force --verbose -o runtime --timestamp --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${frameworklibs}" - # done codesign --force --deep --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${APP}" spctl -a -vvvv "${APP}" fi @@ -422,9 +409,6 @@ function CreateDmg { mkdir "${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}_folder" ditto {"${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}.dmg","rawtherapee-cli","${PROJECT_SOURCE_DATA_DIR}/INSTALL.readme.rtf"} "${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}_folder" zip -r "${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}.zip" "${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}_folder/" - # rm "${dmg_name}.dmg" - # msg "Removing disk image caches:" - # rm -rf "${srcDir}" } CreateDmg msg "Finishing build:" From d25f85076fd1b6f62ee01ed4093513a97f178561 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 28 Jun 2021 00:43:55 -0700 Subject: [PATCH 31/34] Update multilangmgr.cc --- rtgui/multilangmgr.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/rtgui/multilangmgr.cc b/rtgui/multilangmgr.cc index f02672deb2..57d1eff5f7 100644 --- a/rtgui/multilangmgr.cc +++ b/rtgui/multilangmgr.cc @@ -131,9 +131,7 @@ void setGtkLanguage(const Glib::ustring &language) // So we should set all locale data const Glib::ustring localeUTF8 = lang + ".UTF-8"; - if (setlocale(LC_ALL, localeUTF8.c_str())) { // Check if this language is available in UTF-8 - lang = localeUTF8; - } + lang = lang + ".UTF-8"; // According to Apple documentation, UTF-8 is a built-in encoding on all platforms on which macOS runs g_setenv("LANG", lang.c_str(), true); setlocale(LC_ALL, lang.c_str()); @@ -293,14 +291,11 @@ Glib::ustring MultiLangMgr::getOSUserLanguage () // Release user locale data CFRelease(cfLocale); + CFRelease(langCodeStr); + CFRelease(countryCodeStr); // Set locale environment data - const Glib::ustring localeUTF8 = locale + ".UTF-8"; - - if (setlocale(LC_ALL, localeUTF8.c_str())) { // Check if this language is available in UTF-8 - locale = localeUTF8; - } - + locale = locale + ".UTF-8"; // According to Apple documentation, UTF-8 is a built-in encoding on all platforms on which macOS runs g_setenv("LANG", locale.c_str(), true); setlocale(LC_ALL, locale.c_str()); setlocale (LC_NUMERIC, "C"); // Force decimal point to dot. From 999a88670a5c0dae3f717fc96e59569649c10dec Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 28 Jun 2021 00:49:28 -0700 Subject: [PATCH 32/34] mac: Info.plist language fixes (Pandagrapher) https://github.com/Beep6581/RawTherapee/pull/5786#issuecomment-813004475 --- tools/osx/Info.plist.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/osx/Info.plist.in b/tools/osx/Info.plist.in index cc43e48e71..d1582a4f11 100644 --- a/tools/osx/Info.plist.in +++ b/tools/osx/Info.plist.in @@ -17,8 +17,6 @@ /Applications/RawTherapee.app/Contents/Resources/etc/gtk-3.0/gdk-pixbuf.loaders GDK_PIXBUF_MODULEDIR /Applications/RawTherapee.app/Contents/Frameworks - FONTCONFIG_PATH - /Applications/RawTherapee.app/Contents/Resources/etc/fonts LIBDIR /Applications/RawTherapee.app/Contents/Frameworks DATADIR @@ -28,14 +26,12 @@ GTK_OVERLAY_SCROLLING 0 - ATSApplicationFontsPath - etc/fonts LSMultipleInstancesProhibited LSMinimumSystemVersion @minimum_macos_version@ - CFBundleDevelopmentRegion - English + CFBundleAllowMixedLocalizations + CFBundleDisplayName RawTherapee CFBundleDocumentTypes From 85090c54566d94e2b8611d9c11acc7f9d0b97fe8 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Wed, 14 Jul 2021 23:01:33 -0700 Subject: [PATCH 33/34] Mac: also package libpng12 for homebrew compatibility. --- tools/osx/macosx_bundle.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index c26c99e01a..3fc70223a0 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -194,8 +194,9 @@ if [[ -d /usr/local/Cellar/expat ]]; then ditto /usr/local/Cellar/expat/*/lib/li # Copy libz into the app bundle ditto ${LOCAL_PREFIX}/lib/libz.1.dylib "${CONTENTS}/Frameworks" -# Copy libpng16 to the app bundle +# Copy libpng12 & 16 to the app bundle ditto ${LOCAL_PREFIX}/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16.dylib" +ditto ${LOCAL_PREFIX}/lib/libpng12.0.dylib "${CONTENTS}/Frameworks/libpng12.0.dylib" # Copy libtiff 5 into the app bundle ditto ${LOCAL_PREFIX}/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib" @@ -205,17 +206,17 @@ ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks" # Prepare GTK+3 installation msg "Copying configuration files from ${GTK_PREFIX}:" -install -d "${ETC}/gtk-3.0" +cp -RL {"${GDK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 msg "Copying library modules from ${GTK_PREFIX}:" -ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 +cp -RL {"${GDK_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}" +cp -RL "${LIB}"/gdk-pixbuf-2.0/2*/loaders/* "${LIB}" +cp "${LIB}"/gtk-3.0/3*/immodules/*.{dylib,so} "${LIB}" rm -r "${LIB}"/gtk-3.0 rm -r "${LIB}"/gdk-pixbuf-2.0 From 9441f003698d58a071c88022ffef4575a9c94883 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sun, 8 Aug 2021 21:41:29 -0700 Subject: [PATCH 34/34] macOS packaging and language updates --- CMakeLists.txt | 25 ++++++--- rtgui/multilangmgr.cc | 66 +++++++++++++++++++++- tools/osx/INSTALL.readme.rtf | 3 + tools/osx/Info.plist.in | 16 +----- tools/osx/info-plist.cmake | 1 + tools/osx/macosx_bundle.sh | 106 ++++++++++++++++------------------- 6 files changed, 137 insertions(+), 80 deletions(-) create mode 100644 tools/osx/INSTALL.readme.rtf create mode 100644 tools/osx/info-plist.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 68eeccd5f8..2e6cf0b30f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,7 +175,7 @@ if(APPLE) # TODO make -mtune generic conditional and/or specifiable. if(CMAKE_CXX_COMPILER MATCHES "g\\+\\+-mp-4.[5-8]" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "g\\+\\+-mp-4.[5-8]") set(CMAKE_EXE_LINKER_FLAGS - "${CMAKE_EXE_LINKER_FLAGS} /usr/lib/libstdc++.6.dylib -Wl,-headerpad_max_install_names -mtune=generic" + "${CMAKE_EXE_LINKER_FLAGS} /usr/lib/libstdc++.6.dylib -Wl,-headerpad_max_install_names -mtune=generic -framework Foundation" ) message( STATUS @@ -190,7 +190,7 @@ if(APPLE) # TODO make -mtune generic conditional and/or specifiable. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") set(CMAKE_EXE_LINKER_FLAGS - "${CMAKE_EXE_LINKER_FLAGS} -Wl,-headerpad_max_install_names -mtune=generic" + "${CMAKE_EXE_LINKER_FLAGS} -Wl,-headerpad_max_install_names -mtune=generic -framework Foundation" ) endif() @@ -304,7 +304,7 @@ endif() if(NOT DEFINED CREDITSDIR) if(BUILD_BUNDLE) if(APPLE) - set(CREDITSDIR "${DATADIR}") + set(CREDITSDIR "${DATADIR}/..") else() set(CREDITSDIR "${DATADIR}") endif() @@ -371,6 +371,8 @@ if(NOT APPLE) if(DEFINED LENSFUNDBDIR AND NOT IS_ABSOLUTE "${LENSFUNDBDIR}") set(LENSFUNDBDIR "${DATADIR}/${LENSFUNDBDIR}") endif() +else() + set(LENSFUNDBDIR "${LENSFUNDBDIR}") endif() if(APPLE) @@ -387,11 +389,11 @@ if(APPLE) if("${LOCAL_PREFIX}") set(LOCAL_PREFIX "${LOCAL_PREFIX}" - CACHE STRING "macos/gtk parent directory ie /usr or /opt") + CACHE STRING "macos/gtk parent directory ie /usr/local or /opt/local or /opt/homebrew (for arm64)") else() set(LOCAL_PREFIX - /usr - CACHE STRING "macos/gtk parent directory ie /usr or /opt") + /usr/local + CACHE STRING "macos/gtk parent directory ie /usr/local (default) or /opt/local (macports) or /opt/homebrew (for arm64)") endif() if("${FANCY_DMG}") set(FANCY_DMG @@ -686,11 +688,18 @@ elseif(APPLE) ${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR:STRING=${PROJECT_SOURCE_DIR} -DCACHE_NAME_SUFFIX:STRING=${CACHE_NAME_SUFFIX} - -P ${PROJECT_SOURCE_DIR}/UpdateInfo.cmake -DSYSTEM:STRING=Apple -DCXX_FLAGS:STRING=${CXX_FLAGS} -DLFLAGS:STRING=${LFLAGS} - -DCOMPILER_INFO:STRING=${COMPILER_INFO}) + -DCOMPILER_INFO:STRING=${COMPILER_INFO} + -DPROC_LABEL:STRING="${PROC_LABEL}" + -DPROC_BIT_DEPTH:STRING="${PROC_BIT_DEPTH}" + -DBUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DGTKMM_VERSION:STRING=${GTKMM_VERSION} + -DOPTION_OMP:STRING=${OPTION_OMP} + -DWITH_MYFILE_MMAP:STRING=${WITH_MYFILE_MMAP} + -DLENSFUN_VERSION:STRING=${LENSFUN_VERSION} + -P ${PROJECT_SOURCE_DIR}/UpdateInfo.cmake) else() list(APPEND ABOUT_COMMAND_WITH_ARGS -DSYSTEM:STRING=Linux -DCXX_FLAGS:STRING=${CXX_FLAGS} -DLFLAGS:STRING=${LFLAGS} diff --git a/rtgui/multilangmgr.cc b/rtgui/multilangmgr.cc index ecf7445195..57d1eff5f7 100644 --- a/rtgui/multilangmgr.cc +++ b/rtgui/multilangmgr.cc @@ -24,6 +24,9 @@ #include #include #endif +#ifdef __APPLE__ +#include +#endif namespace { @@ -122,6 +125,20 @@ void setGtkLanguage(const Glib::ustring &language) { if(language != "default") { // nothing to change when using default std::string lang = localeToLang.getLocale(language); +#ifdef __APPLE__ + + // On MacOS, LANG environment variable is not defined when running app bundle + // So we should set all locale data + const Glib::ustring localeUTF8 = lang + ".UTF-8"; + + lang = lang + ".UTF-8"; // According to Apple documentation, UTF-8 is a built-in encoding on all platforms on which macOS runs + + g_setenv("LANG", lang.c_str(), true); + setlocale(LC_ALL, lang.c_str()); + setlocale (LC_NUMERIC, "C"); // Force decimal point to dot. + +#else + const gchar *env_langc = g_getenv("LANG"); if(env_langc) { const std::string env_lang(env_langc); @@ -134,6 +151,8 @@ void setGtkLanguage(const Glib::ustring &language) } g_setenv("LANG", lang.c_str(), true); + +#endif } } @@ -228,7 +247,7 @@ Glib::ustring MultiLangMgr::getOSUserLanguage () langName = localeToLang (localeName); -#elif defined (__linux__) || defined (__APPLE__) +#elif defined (__linux__) // Query the current locale and force decimal point to dot. const char *locale = getenv("LANG"); @@ -238,6 +257,51 @@ Glib::ustring MultiLangMgr::getOSUserLanguage () setlocale (LC_NUMERIC, "C"); +#elif defined (__APPLE__) + + // "LANG" environment variable is not defined. Retrieving it from CoreFundation API + // Get used Mac string encoding + CFStringEncoding strEncoding = CFStringGetSystemEncoding(); + // Get user locale data + CFLocaleRef cfLocale = CFLocaleCopyCurrent(); + // Get locale language code + CFStringRef langCodeStr = (CFStringRef)CFLocaleGetValue(cfLocale, kCFLocaleLanguageCode); + Glib::ustring langCode(""); + + if (langCodeStr != NULL) { + const auto langCodeStrLength = CFStringGetLength(langCodeStr) + 1; + char langCodeBuffer[langCodeStrLength]; + CFStringGetCString(langCodeStr, langCodeBuffer, langCodeStrLength, strEncoding); + langCode = Glib::ustring(langCodeBuffer); + } + + // Get locale country code + CFStringRef countryCodeStr = (CFStringRef)CFLocaleGetValue(cfLocale, kCFLocaleCountryCode); + Glib::ustring countryCode(""); + + if (countryCodeStr != NULL) { + const auto countryCodeStrLength = CFStringGetLength(countryCodeStr) + 1; + char countryCodeBuffer[countryCodeStrLength]; + CFStringGetCString(countryCodeStr, countryCodeBuffer, countryCodeStrLength, strEncoding); + countryCode = Glib::ustring(countryCodeBuffer); + } + + // Concatenate locale data + Glib::ustring locale = langCode + "_" + countryCode; + + // Release user locale data + CFRelease(cfLocale); + CFRelease(langCodeStr); + CFRelease(countryCodeStr); + + // Set locale environment data + locale = locale + ".UTF-8"; // According to Apple documentation, UTF-8 is a built-in encoding on all platforms on which macOS runs + g_setenv("LANG", locale.c_str(), true); + setlocale(LC_ALL, locale.c_str()); + setlocale (LC_NUMERIC, "C"); // Force decimal point to dot. + + langName = localeToLang(locale); + #endif return langName; diff --git a/tools/osx/INSTALL.readme.rtf b/tools/osx/INSTALL.readme.rtf new file mode 100644 index 0000000000..799ff5bd77 --- /dev/null +++ b/tools/osx/INSTALL.readme.rtf @@ -0,0 +1,3 @@ +An unsigned -cli is in the zip along with the .dmg. +You must install the app from the .dmg into /Applications and copy the -cli to your /usr/local/bin. +The -cli will load its libraries dynamically from the app in /Applications. diff --git a/tools/osx/Info.plist.in b/tools/osx/Info.plist.in index 6970ed4da0..d1582a4f11 100644 --- a/tools/osx/Info.plist.in +++ b/tools/osx/Info.plist.in @@ -5,14 +5,10 @@ XDG_DATA_DIRS /Applications/RawTherapee.app/Contents/Resources/share - DYLD_FALLBACK_LIBRARY_PATH - /Applications/RawTherapee.app/Contents/Frameworks GTK_PATH /Applications/RawTherapee.app/Contents/Frameworks GTK_IM_MODULE_FILE /Applications/RawTherapee.app/Contents/Resources/etc/gtk-3.0/gtk.immodules - GTK_MODULES - /Applications/RawTherapee.app/Contents/Frameworks/im-quartz.so XDG_DATA_HOME /Applications/RawTherapee.app/Contents/Resources/share GSETTINGS_SCHEMA_DIR @@ -21,8 +17,6 @@ /Applications/RawTherapee.app/Contents/Resources/etc/gtk-3.0/gdk-pixbuf.loaders GDK_PIXBUF_MODULEDIR /Applications/RawTherapee.app/Contents/Frameworks - FONTCONFIG_PATH - /Applications/RawTherapee.app/Contents/Resources/etc/fonts LIBDIR /Applications/RawTherapee.app/Contents/Frameworks DATADIR @@ -31,17 +25,13 @@ similar GTK_OVERLAY_SCROLLING 0 - GDK_NATIVE_WINDOWS - 1 - ATSApplicationFontsPath - etc/fonts LSMultipleInstancesProhibited LSMinimumSystemVersion @minimum_macos_version@ - CFBundleDevelopmentRegion - English + CFBundleAllowMixedLocalizations + CFBundleDisplayName RawTherapee CFBundleDocumentTypes @@ -202,4 +192,4 @@ - \ No newline at end of file + diff --git a/tools/osx/info-plist.cmake b/tools/osx/info-plist.cmake new file mode 100644 index 0000000000..9d64529f30 --- /dev/null +++ b/tools/osx/info-plist.cmake @@ -0,0 +1 @@ +configure_file(${PROJECT_SOURCE_DATA_DIR}/Info.plist.in ${CONTENTS}/Info.plist) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index e3dc61857b..3fc70223a0 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -138,7 +138,7 @@ MACOS="${CONTENTS}/MacOS" LIB="${CONTENTS}/Frameworks" ETC="${RESOURCES}/etc" EXECUTABLE="${MACOS}/rawtherapee" -GDK_PREFIX="${LOCAL_PREFIX}/local/" +GDK_PREFIX="${LOCAL_PREFIX}/" msg "Removing old files:" rm -rf "${APP}" *.dmg *.zip @@ -153,7 +153,7 @@ msg "Copying binary executable files." ditto "${CMAKE_BUILD_TYPE}/MacOS" "${MACOS}" msg "Copying Resources directory." -cp AboutThisBuild.txt "${RESOURCES}" +#cp AboutThisBuild.txt "${RESOURCES}" ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}" echo "\n--------\n" >> "${RESOURCES}/AboutThisBuild.txt" @@ -165,13 +165,19 @@ echo "Bundle UUID: $(uuidgen|tr 'A-Z' 'a-z')" >> "${RESOURCES}/AboutThisBuild. # Copy the Lensfun database into the app bundle mkdir -p "${RESOURCES}/share/lensfun" -ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" +lensfunversion=$(pkg-config --modversion lensfun | cut -f3 -d'.') +if [ $lensfunversion = 95 ] +then + ditto ${LOCAL_PREFIX}/share/lensfun/version_2/* "${RESOURCES}/share/lensfun" +else + ditto ${LOCAL_PREFIX}/share/lensfun/version_1/* "${RESOURCES}/share/lensfun" +fi # Copy liblensfun to Frameworks -ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" +ditto ${LOCAL_PREFIX}/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks/liblensfun.2.dylib" # Copy libomp to Frameworks -ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks" +ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks" msg "Copying dependencies from ${GTK_PREFIX}." CheckLink "${EXECUTABLE}" @@ -180,101 +186,92 @@ CheckLink "${EXECUTABLE}" ModifyInstallNames # Copy libjpeg-turbo ("62") into the app bundle -ditto ${LOCAL_PREFIX}/local/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib" +ditto ${LOCAL_PREFIX}/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" +ditto ${LOCAL_PREFIX}/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 libpng12 & 16 to the app bundle +ditto ${LOCAL_PREFIX}/lib/libpng16.16.dylib "${CONTENTS}/Frameworks/libpng16.16.dylib" +ditto ${LOCAL_PREFIX}/lib/libpng12.0.dylib "${CONTENTS}/Frameworks/libpng12.0.dylib" # Copy libtiff 5 into the app bundle -ditto ${LOCAL_PREFIX}/local/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib" - -# 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" +ditto ${LOCAL_PREFIX}/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib" # Copy libomp to Frameworks -ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks" +ditto ${LOCAL_PREFIX}/lib/libomp.dylib "${CONTENTS}/Frameworks" # Prepare GTK+3 installation msg "Copying configuration files from ${GTK_PREFIX}:" -install -d "${ETC}/gtk-3.0" +cp -RL {"${GDK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 msg "Copying library modules from ${GTK_PREFIX}:" -ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 +cp -RL {"${GDK_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}" +cp -RL "${LIB}"/gdk-pixbuf-2.0/2*/loaders/* "${LIB}" +cp "${LIB}"/gtk-3.0/3*/immodules/*.{dylib,so} "${LIB}" rm -r "${LIB}"/gtk-3.0 rm -r "${LIB}"/gdk-pixbuf-2.0 # 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 +ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css +ditto {"${LOCAL_PREFIX}","${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") +iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "16x16/ui" "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} + cp -RL ${LOCAL_PREFIX}/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" +cp -RL {"${LOCAL_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme +"${LOCAL_PREFIX}/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita" || "${LOCAL_PREFIX}/bin/gtk-update-icon-cache-3.0" "${RESOURCES}/share/icons/Adwaita" +cp -RL "${LOCAL_PREFIX}/share/icons/hicolor" "${RESOURCES}/share/icons/hicolor" # fix libfreetype install name for lib in "${LIB}"/*; do install_name_tool -change libfreetype.6.dylib "${LIB}"/libfreetype.6.dylib "${lib}" done -# pixbuf loaders & immodules +# Build GTK3 pixbuf loaders & immodules database 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/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules" +"${LOCAL_PREFIX}"/bin/gdk-pixbuf-query-loaders "${LIB}"/libpixbufloader-*.so > "${ETC}"/gtk-3.0/gdk-pixbuf.loaders +"${LOCAL_PREFIX}"/bin/gtk-query-immodules-3.0 "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules || "${LOCAL_PREFIX}"/bin/gtk-query-immodules "${LIB}"/im-* > "${ETC}"/gtk-3.0/gtk.immodules +sed -i.bak -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.bak -e "s|${LOCAL_PREFIX}/share/|/Applications/RawTherapee.app/Contents/Resources/share/|" "${ETC}"/gtk-3.0/gtk.immodules +sed -i.bak -e "s|${LOCAL_PREFIX}/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}"/gtk-3.0/gtk.immodules +rm "${ETC}"/*.bak # Install names ModifyInstallNames # Mime directory msg "Copying shared files from ${GTK_PREFIX}:" -ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime +ditto {"${LOCAL_PREFIX}","${RESOURCES}"}/share/mime msg "Installing required application bundle files:" PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx" -ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}" ditto "${PROJECT_SOURCE_DIR}/rtdata/fonts" "${ETC}/fonts" # App bundle resources ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}" ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}" -install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist" -install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/cliInfo.plist.in" "${LIB}/Info.plist" -sed -i "" -e "s|@version@|${PROJECT_FULL_VERSION}| -s|@shortVersion@|${PROJECT_VERSION}| -s|@arch@|${arch}|" \ -"${CONTENTS}/Info.plist" +cmake -DPROJECT_SOURCE_DATA_DIR=${PROJECT_SOURCE_DATA_DIR} -DCONTENTS=${CONTENTS} -Dversion=${PROJECT_FULL_VERSION} -DshortVersion=${PROJECT_VERSION} -Darch=${arch} -P "${PROJECT_SOURCE_DATA_DIR}/info-plist.cmake" update-mime-database -V "${RESOURCES}/share/mime" +cp -RL "${LOCAL_PREFIX}/share/locale" "${RESOURCES}/share/locale" 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" +cp -LR {"${LOCAL_PREFIX}","${RESOURCES}"}/share/glib-2.0/schemas +"${LOCAL_PREFIX}/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" # Append an LC_RPATH msg "Registering @rpath into the main executable." @@ -285,7 +282,7 @@ ModifyInstallNames # fix @rpath in Frameworks msg "Registering @rpath in Frameworks folder." for frameworklibs in "${LIB}"/*{dylib,so,cli}; do - install_name_tool -delete_rpath ${LOCAL_PREFIX}/local/lib "${frameworklibs}" + install_name_tool -delete_rpath ${LOCAL_PREFIX}/lib "${frameworklibs}" install_name_tool -add_rpath /Applications/"${LIB}" "${frameworklibs}" done install_name_tool -delete_rpath RawTherapee.app/Contents/Frameworks "${EXECUTABLE}"-cli @@ -296,13 +293,8 @@ ditto "${EXECUTABLE}"-cli "${APP}"/.. if [[ -n $CODESIGNID ]]; then msg "Codesigning Application." iconv -f UTF-8 -t ASCII "${PROJECT_SOURCE_DATA_DIR}"/rt.entitlements > "${CMAKE_BUILD_TYPE}"/rt.entitlements - iconv -f UTF-8 -t ASCII "${PROJECT_SOURCE_DATA_DIR}"/rt-cli.entitlements > "${CMAKE_BUILD_TYPE}"/rt-cli.entitlements mv "${EXECUTABLE}"-cli "${LIB}" - for frameworklibs in "${LIB}"/*{dylib,so}; do - codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee --force --verbose -o runtime --timestamp --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${frameworklibs}" - done - codesign --force -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt-cli.entitlements "${LIB}"/rawtherapee-cli - codesign --deep --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${APP}" + codesign --force --deep --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements "${CMAKE_BUILD_TYPE}"/rt.entitlements "${APP}" spctl -a -vvvv "${APP}" fi @@ -310,6 +302,7 @@ fi if [[ -n $NOTARY ]]; then msg "Notarizing the application:" ditto -c -k --sequesterRsrc --keepParent "${APP}" "${APP}.zip" + echo "Uploading..." 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 @@ -334,11 +327,11 @@ if [[ -n $NOTARY ]]; then fi function CreateDmg { - local srcDir="$(mktemp -dt $$)" + local srcDir="$(mktemp -dt $$.XXXXXXXXXXXX)" msg "Preparing disk image sources at ${srcDir}:" cp -R "${APP}" "${srcDir}" - cp "${RESOURCES}"/share/LICENSE.txt "${srcDir}" + cp "${RESOURCES}"/LICENSE.txt "${srcDir}" ln -s /Applications "${srcDir}" # Web bookmarks @@ -379,6 +372,7 @@ function CreateDmg { # Sign disk image if [[ -n $CODESIGNID ]]; then + msg "Signing disk image" codesign --deep --force -v -s "${CODESIGNID}" --timestamp "${dmg_name}.dmg" fi @@ -386,6 +380,7 @@ function CreateDmg { if ! test -z "$NOTARY"; then msg "Notarizing the dmg:" zip "${dmg_name}.dmg.zip" "${dmg_name}.dmg" + echo "Uploading..." uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee" ${NOTARY} --file "${dmg_name}.dmg.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'` echo "dmg Result= $uuid" # Display identifier string sleep 15 @@ -415,12 +410,7 @@ function CreateDmg { mkdir "${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}_folder" ditto {"${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}.dmg","rawtherapee-cli","${PROJECT_SOURCE_DATA_DIR}/INSTALL.readme.rtf"} "${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}_folder" zip -r "${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}.zip" "${PROJECT_NAME}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}_folder/" - # rm "${dmg_name}.dmg" - # msg "Removing disk image caches:" - # rm -rf "${srcDir}" } CreateDmg msg "Finishing build:" echo "Script complete." -# -# TODO filter out the benign errors