From 1fb5a5b7353fd08bc01cbac1358f2f4d976a9b48 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Sun, 16 Jul 2023 20:53:37 -0700 Subject: [PATCH 1/2] macOS: fixes -cli Fixes the Command Line Interface (CLI) rawtherapee-cli executable for macOS using ad hoc codesign. --- tools/osx/macosx_bundle.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index ca381ec14..0782e3fc8 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -316,7 +316,7 @@ for frameworklibs in "${LIB}"/*{dylib,so,cli}; do done install_name_tool -delete_rpath RawTherapee.app/Contents/Frameworks "${EXECUTABLE}"-cli 2>/dev/null install_name_tool -add_rpath /Applications/"${LIB}" "${EXECUTABLE}"-cli 2>/dev/null -ditto "${EXECUTABLE}"-cli "${APP}"/.. +# ditto "${EXECUTABLE}"-cli "${APP}"/.. # Merge the app with the other architecture to create the Universal app. if [[ -n $UNIVERSAL_URL ]]; then @@ -324,7 +324,7 @@ if [[ -n $UNIVERSAL_URL ]]; then curl -L ${UNIVERSAL_URL} -o univ.zip msg "Extracting app." unzip univ.zip -d univapp - hdiutil attach -mountpoint ./RawTherapeeuniv univapp/*/*dmg + hdiutil attach -mountpoint ./RawTherapeeuniv univapp/*dmg if [[ $arch = "arm64" ]]; then cp -R RawTherapee.app RawTherapee-arm64.app minimum_arm64_version=$(f=$(cat RawTherapee-arm64.app/Contents/Resources/AboutThisBuild.txt | grep mmacosx-version); echo "${f#*min=}" | cut -d ' ' -f1) @@ -344,13 +344,15 @@ if [[ -n $UNIVERSAL_URL ]]; then hdiutil unmount ./RawTherapeeuniv rm -r univapp # Create the fat main RawTherapee binary and move it into the new bundle - lipo -create -output RawTherapee RawTherapee-arm64.app/Contents/MacOS/RawTherapee RawTherapee-x86_64.app/Contents/MacOS/RawTherapee - mv RawTherapee RawTherapee.app/Contents/MacOS + lipo -create -output RawTherapee RawTherapee-arm64.app/Contents/MacOS/rawtherapee RawTherapee-x86_64.app/Contents/MacOS/rawtherapee + lipo -create -output rawtherapee-cli RawTherapee-arm64.app/Contents/MacOS/rawtherapee-cli RawTherapee-x86_64.app/Contents/MacOS/rawtherapee-cli + mv rawtherapee RawTherapee.app/Contents/MacOS # Create all the fat dependencies and move them into the bundle for lib in RawTherapee-arm64.app/Contents/Frameworks/* ; do lipo -create -output $(basename $lib) RawTherapee-arm64.app/Contents/Frameworks/$(basename $lib) RawTherapee-x86_64.app/Contents/Frameworks/$(basename $lib) done - sudo mv *cli *so *dylib RawTherapee.app/Contents/Frameworks + sudo mv *so *dylib RawTherapee.app/Contents/Frameworks + sudo mv *-cli RawTherapee.app/Contents/MacOS rm -r RawTherapee-arm64.app rm -r RawTherapee-x86_64.app else @@ -363,7 +365,8 @@ fi 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}" +# mv "${EXECUTABLE}"-cli "${LIB}" + codesign --force --deep --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee-cli "${APP}"/Contents/MacOS/rawtherapee-cli 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 @@ -441,7 +444,8 @@ function CreateDmg { # Zip disk image for redistribution msg "Zipping disk image for redistribution:" mkdir "${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}_folder" - cp {"${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}.dmg","${PROJECT_NAME}.app/Contents/Frameworks/rawtherapee-cli","${PROJECT_SOURCE_DATA_DIR}/INSTALL.readme.rtf"} "${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}_folder" + cp {"${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}.dmg","${PROJECT_NAME}.app/Contents/MacOS/rawtherapee-cli","${PROJECT_SOURCE_DATA_DIR}/INSTALL.readme.rtf"} "${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}_folder" + codesign -s - -i com.rawtherapee.rawtherapee-cli -f "${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}_folder/rawtherapee-cli" zip -r "${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}.zip" "${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}_folder/" if [[ -n $NIGHTLY ]]; then cp "${PROJECT_NAME}_macOS_${MINIMUM_SYSTEM_VERSION}_${arch}_${PROJECT_FULL_VERSION}.zip" "${PROJECT_NAME}_macOS_${arch}_latest.zip" From 655447b0f1bcb5512bb72e5c597befdeddecb146 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Wed, 26 Jul 2023 17:19:35 +0700 Subject: [PATCH 2/2] macos: gitignore .DS_Store files A .DS_Store file is automatically generated by the macOS Finder that contains the parent folder's metadata (a database of icon positions and background image selections). Adding this to the .gitignore so we don't have to manually remove them when committing to the repository. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fc65c877c..043daf27a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ .settings .directory .vscode +.DS_Store CMakeCache.txt CMakeFiles