mac:bundle simplification cont'd

This commit is contained in:
Richard Barber
2020-02-16 06:08:12 -08:00
parent e0b23b4387
commit 338c2aacce
2 changed files with 156 additions and 192 deletions

View File

@@ -9,6 +9,7 @@
# which can be useful if you want to keep the application and all the cache data in a single place,
# an external HD for example
MultiUser=true
UseSystemTheme=false
[File Browser]
# Image filename extensions to be looked for, and their corresponding search state (0/1 -> skip/include)
@@ -38,5 +39,5 @@ CustomProfileBuilder=
#ImgDefault=Neutral
[GUI]
FontFamily=Helvetica Regular
CPFontFamily=Helvetica Regular
FontFamily=DroidSansMonoSlashed Regular
CPFontFamily=DroidSansMonoSlashed Regular

View File

@@ -34,22 +34,6 @@ function CheckLink {
done
}
function ModifyInstallNames {
find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do
msg "Modifying install names: ${x}"
{
# id
if [ ${x:(-6)} == ".dylib" ]; then
echo " install_name_tool -id '@rpath/$(basename "${x}")' '${x}'"
fi
GetDependencies "${x}" | while read -r y
do
echo " install_name_tool -change '${y}' '@rpath/$(basename "${y}")' '${x}'"
done
} | bash -v
done
}
function ModifyInstallNames {
find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do
msg "Modifying install names: ${x}"
@@ -141,13 +125,6 @@ install -d "${RESOURCES}" \
"${LIB}" \
"${ETC}"
echo "\n--------\n" >> Resources/AboutThisBuild.txt
echo "Bundle system: $(sysctl -n machdep.cpu.brand_string)" >> Resources/AboutThisBuild.txt
echo "Bundle OS: $(sw_vers -productName) $(sw_vers -productVersion) $(sw_vers -buildVersion) $(uname -mrs)" >> Resources/AboutThisBuild.txt
echo "Bundle date: $(date -Ru) ZULU" >> Resources/AboutThisBuild.txt
echo "Bundle epoch: $(date +%s)" >> Resources/AboutThisBuild.txt
echo "Bundle UUID: $(uuidgen)" >> Resources/AboutThisBuild.txt
echo "\n--------\n" >> "${CMAKE_BUILD_TYPE}"/Resources/AboutThisBuild.txt
echo "Bundle system: $(sysctl -n machdep.cpu.brand_string)" >> "${CMAKE_BUILD_TYPE}"/Resources/AboutThisBuild.txt
echo "Bundle OS: $(sw_vers -productName) $(sw_vers -productVersion) $(sw_vers -buildVersion) $(uname -mrs)" >> "${CMAKE_BUILD_TYPE}"/Resources/AboutThisBuild.txt
@@ -175,9 +152,6 @@ CheckLink "${EXECUTABLE}"
# dylib install names
ModifyInstallNames
# dylib install names
ModifyInstallNames
# Copy libjpeg-turbo ("62") into the app bundle
ditto ${LOCAL_PREFIX}/local/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib"
@@ -240,47 +214,39 @@ 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"
# Install names
ModifyInstallNames
# 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
sed -i "" -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules"
# Mime directory
msg "Copying shared files from ${GTK_PREFIX}:"
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime
# Install names
ModifyInstallNames
msg "Installing required application bundle files:"
PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx"
ditto "${PROJECT_SOURCE_DIR}/build/Resources" "${RESOURCES}"
# Executable loader
# Note: executable is renamed to 'rawtherapee-bin'.
mkdir "${MACOS}/bin"
ditto "${MACOS}/rawtherapee" "${MACOS}/bin/rawtherapee-bin"
rm "${MACOS}/rawtherapee"
install -m 0755 "${PROJECT_SOURCE_DATA_DIR}/executable_loader.in" "${MACOS}/rawtherapee"
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}/Info.plist-bin.in" "${CONTENTS}/MacOS/bin/Info.plist"
sed -i "" -e "s|@version@|${PROJECT_FULL_VERSION}|
s|@shortVersion@|${PROJECT_VERSION}|
s|@arch@|${arch}|" \
"${CONTENTS}/Info.plist"
plutil -convert xml1 "${CONTENTS}/Info.plist"
plutil -convert xml1 "${CONTENTS}/MacOS/bin/Info.plist"
plutil -convert binary1 "${CONTENTS}/Info.plist"
update-mime-database -V "${CONTENTS}/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"
# 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}'" | bash -v
echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${EXECUTABLE}-cli'" | bash -v
ModifyInstallNames
@@ -288,7 +254,7 @@ ModifyInstallNames
# 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 -delete_rpath ${LOCAL_PREFIX}/local/lib '${frameworklibs}'" | bash -v
echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${frameworklibs}'" | bash -v
done
@@ -296,15 +262,15 @@ done
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"
plutil -convert xml1 "${CONTENTS}/Entitlements.plist"
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt-bin.entitlements" "${CONTENTS}/MacOS/bin/Entitlements.plist"
plutil -convert xml1 "${CONTENTS}/MacOS/bin/Entitlements.plist"
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee-bin" -o runtime --timestamp --entitlements "${APP}/Contents/MacOS/bin/Entitlements.plist" "${APP}/Contents/MacOS/bin/rawtherapee-bin"
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt.entitlements" "${CONTENTS}/rt.entitlements"
plutil -convert binary1 "${CONTENTS}/rt.entitlements"
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${CONTENTS}/rt.entitlements"
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${EXECUTABLE}"
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${EXECUTABLE}-cli"
for frameworklibs in ${CONTENTS}/Frameworks/* ; do
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee-bin" -o runtime --timestamp "${frameworklibs}"
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -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}/rt.entitlements" "${APP}"
spctl -a -vvvv "${APP}"
fi
@@ -341,7 +307,7 @@ function CreateDmg {
msg "Preparing disk image sources at ${srcDir}:"
cp -R "${APP}" "${srcDir}"
ditto Resources/AboutThisBuild.txt "${srcDir}"
ditto "${CMAKE_BUILD_TYPE}"/Resources/AboutThisBuild.txt "${srcDir}"
ln -s /Applications "${srcDir}"
# Web bookmarks
@@ -368,7 +334,6 @@ function CreateDmg {
fi
# Notarize the dmg
if ! test -z "$NOTARY" ; then
msg "Notarizing the dmg:"
zip "${dmg_name}.dmg.zip" "${dmg_name}.dmg"
@@ -397,10 +362,8 @@ function CreateDmg {
# Zip disk image for redistribution
msg "Zipping disk image for redistribution:"
zip "${dmg_name}.zip" "${dmg_name}.dmg" Resources/AboutThisBuild.txt
zip "${dmg_name}.zip" "${dmg_name}.dmg" "${CMAKE_BUILD_TYPE}/Resources/AboutThisBuild.txt"
rm "${dmg_name}.dmg"
msg "Removing disk image caches:"
rm -rf "${srcDir}"
}