mac:bundle simplification cont'd
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
# which can be useful if you want to keep the application and all the cache data in a single place,
|
# 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
|
# an external HD for example
|
||||||
MultiUser=true
|
MultiUser=true
|
||||||
|
UseSystemTheme=false
|
||||||
|
|
||||||
[File Browser]
|
[File Browser]
|
||||||
# Image filename extensions to be looked for, and their corresponding search state (0/1 -> skip/include)
|
# Image filename extensions to be looked for, and their corresponding search state (0/1 -> skip/include)
|
||||||
@@ -38,5 +39,5 @@ CustomProfileBuilder=
|
|||||||
#ImgDefault=Neutral
|
#ImgDefault=Neutral
|
||||||
|
|
||||||
[GUI]
|
[GUI]
|
||||||
FontFamily=Helvetica Regular
|
FontFamily=DroidSansMonoSlashed Regular
|
||||||
CPFontFamily=Helvetica Regular
|
CPFontFamily=DroidSansMonoSlashed Regular
|
||||||
|
@@ -16,95 +16,79 @@ fMagenta="$(tput setaf 5)"
|
|||||||
fRed="$(tput setaf 1)"
|
fRed="$(tput setaf 1)"
|
||||||
|
|
||||||
function msg {
|
function msg {
|
||||||
printf "\\n${fBold}-- %s${fNormal}\\n" "${@}"
|
printf "\\n${fBold}-- %s${fNormal}\\n" "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function msgError {
|
function msgError {
|
||||||
printf "\\n${fBold}Error:${fNormal}\\n%s\\n" "${@}"
|
printf "\\n${fBold}Error:${fNormal}\\n%s\\n" "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetDependencies {
|
function GetDependencies {
|
||||||
otool -L "$1" | awk 'NR >= 2 && $1 !~ /^(\/usr\/lib|\/System|@executable_path|@rpath)\// { print $1 }'
|
otool -L "$1" | awk 'NR >= 2 && $1 !~ /^(\/usr\/lib|\/System|@executable_path|@rpath)\// { print $1 }'
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckLink {
|
function CheckLink {
|
||||||
GetDependencies "$1" | while read -r; do
|
GetDependencies "$1" | while read -r; do
|
||||||
local dest="${LIB}/$(basename "${REPLY}")"
|
local dest="${LIB}/$(basename "${REPLY}")"
|
||||||
test -f "${dest}" || { ditto --arch "${arch}" "${REPLY}" "${dest}"; CheckLink "${dest}"; }
|
test -f "${dest}" || { ditto --arch "${arch}" "${REPLY}" "${dest}"; CheckLink "${dest}"; }
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function ModifyInstallNames {
|
function ModifyInstallNames {
|
||||||
find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do
|
find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do
|
||||||
msg "Modifying install names: ${x}"
|
msg "Modifying install names: ${x}"
|
||||||
{
|
{
|
||||||
# id
|
# id
|
||||||
if [ ${x:(-6)} == ".dylib" ]; then
|
if [ ${x:(-6)} == ".dylib" ] || [ f${x:(-3)} == ".so" ]; then
|
||||||
echo " install_name_tool -id '@rpath/$(basename "${x}")' '${x}'"
|
echo " install_name_tool -id '@rpath/$(basename "${x}")' '${x}'"
|
||||||
fi
|
fi
|
||||||
GetDependencies "${x}" | while read -r y
|
GetDependencies "${x}" | while read -r y
|
||||||
do
|
do
|
||||||
echo " install_name_tool -change '${y}' '@rpath/$(basename "${y}")' '${x}'"
|
echo " install_name_tool -change '${y}' '@rpath/$(basename "${y}")' '${x}'"
|
||||||
done
|
done
|
||||||
} | bash -v
|
} | bash -v
|
||||||
done
|
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" ] || [ f${x:(-3)} == ".so" ]; 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Source check
|
# Source check
|
||||||
if [[ ! -d "${CMAKE_BUILD_TYPE}" ]]; then
|
if [[ ! -d "${CMAKE_BUILD_TYPE}" ]]; then
|
||||||
msgError "${PWD}/${CMAKE_BUILD_TYPE} folder does not exist. Please execute 'make install' first."
|
msgError "${PWD}/${CMAKE_BUILD_TYPE} folder does not exist. Please execute 'make install' first."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update project version
|
# Update project version
|
||||||
if [[ -x "$(which git)" && -d "${PROJECT_SOURCE_DIR}/.git" ]]; then
|
if [[ -x "$(which git)" && -d "${PROJECT_SOURCE_DIR}/.git" ]]; then
|
||||||
### This section is copied from tools/generateReleaseInfo
|
### This section is copied from tools/generateReleaseInfo
|
||||||
# Get version description.
|
# Get version description.
|
||||||
# Depending on whether you checked out a branch (dev) or a tag (release),
|
# Depending on whether you checked out a branch (dev) or a tag (release),
|
||||||
# "git describe" will return "5.0-gtk2-2-g12345678" or "5.0-gtk2", respectively.
|
# "git describe" will return "5.0-gtk2-2-g12345678" or "5.0-gtk2", respectively.
|
||||||
gitDescribe="$(git describe --tags --always)"
|
gitDescribe="$(git describe --tags --always)"
|
||||||
|
|
||||||
# Apple requires a numeric version of the form n.n.n
|
# Apple requires a numeric version of the form n.n.n
|
||||||
# https://goo.gl/eWDQv6
|
# https://goo.gl/eWDQv6
|
||||||
|
|
||||||
# Get number of commits since tagging. This is what gitDescribe uses.
|
# Get number of commits since tagging. This is what gitDescribe uses.
|
||||||
# Works when checking out branch, tag or commit.
|
# Works when checking out branch, tag or commit.
|
||||||
gitCommitsSinceTag="$(git rev-list --count HEAD --not $(git tag --merged HEAD))"
|
gitCommitsSinceTag="$(git rev-list --count HEAD --not $(git tag --merged HEAD))"
|
||||||
|
|
||||||
# Create numeric version.
|
# Create numeric version.
|
||||||
# This version is nonsense, either don't use it at all or use it only where you have no other choice, e.g. Inno Setup's VersionInfoVersion.
|
# This version is nonsense, either don't use it at all or use it only where you have no other choice, e.g. Inno Setup's VersionInfoVersion.
|
||||||
# Strip everything after hyphen, e.g. "5.0-gtk2" -> "5.0", "5.1-rc1" -> "5.1" (ergo BS).
|
# Strip everything after hyphen, e.g. "5.0-gtk2" -> "5.0", "5.1-rc1" -> "5.1" (ergo BS).
|
||||||
if [[ -z $gitCommitsSinceTag ]]; then
|
if [[ -z $gitCommitsSinceTag ]]; then
|
||||||
gitVersionNumericBS="0.0.0"
|
gitVersionNumericBS="0.0.0"
|
||||||
else
|
else
|
||||||
gitVersionNumericBS="${gitDescribe%%-*}" # Remove everything after first hyphen.
|
gitVersionNumericBS="${gitDescribe%%-*}" # Remove everything after first hyphen.
|
||||||
gitVersionNumericBS="${gitVersionNumericBS}.${gitCommitsSinceTag}" # Remove everything until after first hyphen: 5.0
|
gitVersionNumericBS="${gitVersionNumericBS}.${gitCommitsSinceTag}" # Remove everything until after first hyphen: 5.0
|
||||||
fi
|
fi
|
||||||
### Copy end.
|
### Copy end.
|
||||||
|
|
||||||
PROJECT_FULL_VERSION="$gitDescribe"
|
PROJECT_FULL_VERSION="$gitDescribe"
|
||||||
PROJECT_VERSION="$gitVersionNumericBS"
|
PROJECT_VERSION="$gitVersionNumericBS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MINIMUM_SYSTEM_VERSION="$(otool -l "${CMAKE_BUILD_TYPE}"/MacOS/rawtherapee | grep -A2 'LC_VERSION_MIN_MACOSX' | awk '$1 ~ /version/ { printf $2 }')"
|
MINIMUM_SYSTEM_VERSION="$(otool -l "${CMAKE_BUILD_TYPE}"/MacOS/rawtherapee | grep -A2 'LC_VERSION_MIN_MACOSX' | awk '$1 ~ /version/ { printf $2 }')"
|
||||||
if [[ -z "${MINIMUM_SYSTEM_VERSION}" ]]; then
|
if [[ -z "${MINIMUM_SYSTEM_VERSION}" ]]; then
|
||||||
MINIMUM_SYSTEM_VERSION="$(sw_vers -productVersion | cut -d. -f-2)"
|
MINIMUM_SYSTEM_VERSION="$(sw_vers -productVersion | cut -d. -f-2)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
arch=x86_64
|
arch=x86_64
|
||||||
@@ -137,16 +121,9 @@ rm -rf "${APP}" "${PROJECT_NAME}_*.dmg" "*zip"
|
|||||||
|
|
||||||
msg "Creating bundle container:"
|
msg "Creating bundle container:"
|
||||||
install -d "${RESOURCES}" \
|
install -d "${RESOURCES}" \
|
||||||
"${MACOS}" \
|
"${MACOS}" \
|
||||||
"${LIB}" \
|
"${LIB}" \
|
||||||
"${ETC}"
|
"${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 "\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 system: $(sysctl -n machdep.cpu.brand_string)" >> "${CMAKE_BUILD_TYPE}"/Resources/AboutThisBuild.txt
|
||||||
@@ -175,9 +152,6 @@ CheckLink "${EXECUTABLE}"
|
|||||||
# dylib install names
|
# dylib install names
|
||||||
ModifyInstallNames
|
ModifyInstallNames
|
||||||
|
|
||||||
# dylib install names
|
|
||||||
ModifyInstallNames
|
|
||||||
|
|
||||||
# Copy libjpeg-turbo ("62") into the app bundle
|
# Copy libjpeg-turbo ("62") into the app bundle
|
||||||
ditto ${LOCAL_PREFIX}/local/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib"
|
ditto ${LOCAL_PREFIX}/local/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib"
|
||||||
|
|
||||||
@@ -228,8 +202,8 @@ ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-
|
|||||||
msg "Copy 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" "48x48/devices")
|
||||||
for f in "${iconfolders[@]}"; do
|
for f in "${iconfolders[@]}"; do
|
||||||
mkdir -p ${RESOURCES}/share/icons/Adwaita/${f}
|
mkdir -p ${RESOURCES}/share/icons/Adwaita/${f}
|
||||||
ditto ${LOCAL_PREFIX}/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f}
|
ditto ${LOCAL_PREFIX}/local/share/icons/Adwaita/${f}/* "${RESOURCES}"/share/icons/Adwaita/${f}
|
||||||
done
|
done
|
||||||
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/icons/Adwaita/index.theme
|
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/icons/Adwaita/index.theme
|
||||||
"${LOCAL_PREFIX}/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita"
|
"${LOCAL_PREFIX}/local/bin/gtk-update-icon-cache" "${RESOURCES}/share/icons/Adwaita"
|
||||||
@@ -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/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}"/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|${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"
|
sed -i "" -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${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
|
|
||||||
|
|
||||||
# Mime directory
|
# Mime directory
|
||||||
msg "Copying shared files from ${GTK_PREFIX}:"
|
msg "Copying shared files from ${GTK_PREFIX}:"
|
||||||
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime
|
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime
|
||||||
|
|
||||||
|
# Install names
|
||||||
|
ModifyInstallNames
|
||||||
|
|
||||||
msg "Installing required application bundle files:"
|
msg "Installing required application bundle files:"
|
||||||
PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx"
|
PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx"
|
||||||
ditto "${PROJECT_SOURCE_DIR}/build/Resources" "${RESOURCES}"
|
ditto "${PROJECT_SOURCE_DIR}/build/Resources" "${RESOURCES}"
|
||||||
# Executable loader
|
ditto "${PROJECT_SOURCE_DIR}/rtdata/fonts" "${ETC}/fonts"
|
||||||
# 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"
|
|
||||||
# App bundle resources
|
# App bundle resources
|
||||||
ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}"
|
ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}"
|
||||||
ditto "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}"
|
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.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}|
|
sed -i "" -e "s|@version@|${PROJECT_FULL_VERSION}|
|
||||||
s|@shortVersion@|${PROJECT_VERSION}|
|
s|@shortVersion@|${PROJECT_VERSION}|
|
||||||
s|@arch@|${arch}|" \
|
s|@arch@|${arch}|" \
|
||||||
"${CONTENTS}/Info.plist"
|
"${CONTENTS}/Info.plist"
|
||||||
plutil -convert xml1 "${CONTENTS}/Info.plist"
|
plutil -convert binary1 "${CONTENTS}/Info.plist"
|
||||||
plutil -convert xml1 "${CONTENTS}/MacOS/bin/Info.plist"
|
|
||||||
update-mime-database -V "${CONTENTS}/Resources/share/mime"
|
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
|
# Append an LC_RPATH
|
||||||
msg "Registering @rpath into the executable:"
|
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
|
echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${EXECUTABLE}-cli'" | bash -v
|
||||||
|
|
||||||
ModifyInstallNames
|
ModifyInstallNames
|
||||||
@@ -288,121 +254,118 @@ ModifyInstallNames
|
|||||||
# fix @rpath in Frameworks
|
# fix @rpath in Frameworks
|
||||||
msg "Registering @rpath in Frameworks folder:"
|
msg "Registering @rpath in Frameworks folder:"
|
||||||
for frameworklibs in ${CONTENTS}/Frameworks/* ; do
|
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
|
echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${frameworklibs}'" | bash -v
|
||||||
done
|
done
|
||||||
|
|
||||||
# Sign the app
|
# Sign the app
|
||||||
msg "Codesigning:"
|
msg "Codesigning:"
|
||||||
CODESIGNID="$(cmake .. -LA -N | grep "CODESIGNID" | cut -d "=" -f2)"
|
CODESIGNID="$(cmake .. -LA -N | grep "CODESIGNID" | cut -d "=" -f2)"
|
||||||
if ! test -z "$CODESIGNID" ; then
|
if ! test -z "$CODESIGNID" ; then
|
||||||
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt.entitlements" "${CONTENTS}/Entitlements.plist"
|
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt.entitlements" "${CONTENTS}/rt.entitlements"
|
||||||
plutil -convert xml1 "${CONTENTS}/Entitlements.plist"
|
plutil -convert binary1 "${CONTENTS}/rt.entitlements"
|
||||||
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt-bin.entitlements" "${CONTENTS}/MacOS/bin/Entitlements.plist"
|
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${CONTENTS}/rt.entitlements"
|
||||||
plutil -convert xml1 "${CONTENTS}/MacOS/bin/Entitlements.plist"
|
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${EXECUTABLE}"
|
||||||
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"
|
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${EXECUTABLE}-cli"
|
||||||
for frameworklibs in ${CONTENTS}/Frameworks/* ; do
|
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
|
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}"
|
spctl -a -vvvv "${APP}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Notarize the app
|
# Notarize the app
|
||||||
NOTARY="$(cmake .. -LA -N | grep "NOTARY" | cut -d "=" -f2)"
|
NOTARY="$(cmake .. -LA -N | grep "NOTARY" | cut -d "=" -f2)"
|
||||||
if ! test -z "$NOTARY" ; then
|
if ! test -z "$NOTARY" ; then
|
||||||
msg "Notarizing the application:"
|
msg "Notarizing the application:"
|
||||||
ditto -c -k --sequesterRsrc --keepParent "${APP}" "${APP}.zip"
|
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
|
echo "Result= $uuid" # Display identifier string
|
||||||
sleep 15
|
sleep 15
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
|
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
|
||||||
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
|
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
|
||||||
if [ "$status1" = "success" ]; then
|
if [ "$status1" = "success" ]; then
|
||||||
xcrun stapler staple *app # staple the ticket
|
xcrun stapler staple *app # staple the ticket
|
||||||
xcrun stapler validate -v *app
|
xcrun stapler validate -v *app
|
||||||
echo "Notarization success"
|
echo "Notarization success"
|
||||||
break
|
break
|
||||||
elif [ "$status1" = "in" ]; then
|
elif [ "$status1" = "in" ]; then
|
||||||
echo "Notarization still in progress, sleeping for 15 seconds and trying again"
|
echo "Notarization still in progress, sleeping for 15 seconds and trying again"
|
||||||
sleep 15
|
sleep 15
|
||||||
else
|
else
|
||||||
echo "Notarization failed fullstatus below"
|
echo "Notarization failed fullstatus below"
|
||||||
echo "$fullstatus"
|
echo "$fullstatus"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function CreateDmg {
|
function CreateDmg {
|
||||||
local srcDir="$(mktemp -dt $$)"
|
local srcDir="$(mktemp -dt $$)"
|
||||||
|
|
||||||
msg "Preparing disk image sources at ${srcDir}:"
|
msg "Preparing disk image sources at ${srcDir}:"
|
||||||
cp -R "${APP}" "${srcDir}"
|
cp -R "${APP}" "${srcDir}"
|
||||||
ditto Resources/AboutThisBuild.txt "${srcDir}"
|
ditto "${CMAKE_BUILD_TYPE}"/Resources/AboutThisBuild.txt "${srcDir}"
|
||||||
ln -s /Applications "${srcDir}"
|
ln -s /Applications "${srcDir}"
|
||||||
|
|
||||||
# Web bookmarks
|
# Web bookmarks
|
||||||
function CreateWebloc {
|
function CreateWebloc {
|
||||||
defaults write "${srcDir}/$1" URL "$2"
|
defaults write "${srcDir}/$1" URL "$2"
|
||||||
mv "${srcDir}/$1".{plist,webloc}
|
mv "${srcDir}/$1".{plist,webloc}
|
||||||
}
|
}
|
||||||
CreateWebloc 'Website' 'http://www.rawtherapee.com/'
|
CreateWebloc 'Website' 'http://www.rawtherapee.com/'
|
||||||
CreateWebloc 'Manual' 'http://rawpedia.rawtherapee.com/'
|
CreateWebloc 'Manual' 'http://rawpedia.rawtherapee.com/'
|
||||||
|
|
||||||
# Disk image name
|
# Disk image name
|
||||||
dmg_name="${PROJECT_NAME// /_}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}"
|
dmg_name="${PROJECT_NAME// /_}_OSX_${MINIMUM_SYSTEM_VERSION}_${PROC_BIT_DEPTH}_${PROJECT_FULL_VERSION}"
|
||||||
lower_build_type="$(tr '[:upper:]' '[:lower:]' <<< "$CMAKE_BUILD_TYPE")"
|
lower_build_type="$(tr '[:upper:]' '[:lower:]' <<< "$CMAKE_BUILD_TYPE")"
|
||||||
if [[ ${lower_build_type} != release ]]; then
|
if [[ ${lower_build_type} != release ]]; then
|
||||||
dmg_name="${dmg_name}_${lower_build_type}"
|
dmg_name="${dmg_name}_${lower_build_type}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "Creating disk image:"
|
msg "Creating disk image:"
|
||||||
hdiutil create -format UDBZ -fs HFS+ -srcdir "${srcDir}" -volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" "${dmg_name}.dmg"
|
hdiutil create -format UDBZ -fs HFS+ -srcdir "${srcDir}" -volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" "${dmg_name}.dmg"
|
||||||
|
|
||||||
# Sign disk image
|
# Sign disk image
|
||||||
if ! test -z "$CODESIGNID" ; then
|
if ! test -z "$CODESIGNID" ; then
|
||||||
codesign --deep --force -v -s "${CODESIGNID}" --timestamp "${dmg_name}.dmg"
|
codesign --deep --force -v -s "${CODESIGNID}" --timestamp "${dmg_name}.dmg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Notarize the dmg
|
# Notarize the dmg
|
||||||
|
if ! test -z "$NOTARY" ; then
|
||||||
if ! test -z "$NOTARY" ; then
|
msg "Notarizing the dmg:"
|
||||||
msg "Notarizing the dmg:"
|
zip "${dmg_name}.dmg.zip" "${dmg_name}.dmg"
|
||||||
zip "${dmg_name}.dmg.zip" "${dmg_name}.dmg"
|
uuid=`xcrun altool --notarize-app --primary-bundle-id "com.rawtherapee" ${NOTARY} --file "${dmg_name}.dmg.zip" 2>&1 | grep 'RequestUUID' | awk '{ print $3 }'`
|
||||||
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
|
||||||
echo "dmg Result= $uuid" # Display identifier string
|
sleep 15
|
||||||
sleep 15
|
while :
|
||||||
while :
|
do
|
||||||
do
|
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
|
||||||
fullstatus=`xcrun altool --notarization-info "$uuid" ${NOTARY} 2>&1` # get the status
|
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
|
||||||
status1=`echo "$fullstatus" | grep 'Status\:' | awk '{ print $2 }'`
|
if [ "$status1" = "success" ]; then
|
||||||
if [ "$status1" = "success" ]; then
|
xcrun stapler staple "${dmg_name}.dmg" # staple the ticket
|
||||||
xcrun stapler staple "${dmg_name}.dmg" # staple the ticket
|
xcrun stapler validate -v "${dmg_name}.dmg"
|
||||||
xcrun stapler validate -v "${dmg_name}.dmg"
|
echo "dmg Notarization success"
|
||||||
echo "dmg Notarization success"
|
break
|
||||||
break
|
elif [ "$status1" = "in" ]; then
|
||||||
elif [ "$status1" = "in" ]; then
|
echo "dmg Notarization still in progress, sleeping for 15 seconds and trying again"
|
||||||
echo "dmg Notarization still in progress, sleeping for 15 seconds and trying again"
|
sleep 15
|
||||||
sleep 15
|
else
|
||||||
else
|
echo "dmg Notarization failed fullstatus below"
|
||||||
echo "dmg Notarization failed fullstatus below"
|
echo "$fullstatus"
|
||||||
echo "$fullstatus"
|
exit 1
|
||||||
exit 1
|
fi
|
||||||
fi
|
done
|
||||||
done
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Zip disk image for redistribution
|
# Zip disk image for redistribution
|
||||||
msg "Zipping disk image for redistribution:"
|
msg "Zipping disk image for redistribution:"
|
||||||
|
zip "${dmg_name}.zip" "${dmg_name}.dmg" "${CMAKE_BUILD_TYPE}/Resources/AboutThisBuild.txt"
|
||||||
zip "${dmg_name}.zip" "${dmg_name}.dmg" Resources/AboutThisBuild.txt
|
rm "${dmg_name}.dmg"
|
||||||
rm "${dmg_name}.dmg"
|
msg "Removing disk image caches:"
|
||||||
|
rm -rf "${srcDir}"
|
||||||
msg "Removing disk image caches:"
|
|
||||||
rm -rf "${srcDir}"
|
|
||||||
}
|
}
|
||||||
CreateDmg
|
CreateDmg
|
||||||
msg "Finishing build:"
|
msg "Finishing build:"
|
||||||
|
Reference in New Issue
Block a user