macOS: preserve binary resources / codesign frmwks
Copies libraries using `ditto` Codesigns each in Contents/Framework
This commit is contained in:
parent
5a5856fa1d
commit
8970da1c2c
@ -76,10 +76,7 @@ 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
|
||||||
|
|
||||||
case ${PROC_BIT_DEPTH} in
|
arch=x86_64
|
||||||
64) arch=x86_64;;
|
|
||||||
32) arch=i386;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
cat <<__EOS__
|
cat <<__EOS__
|
||||||
PROJECT_NAME: ${PROJECT_NAME}
|
PROJECT_NAME: ${PROJECT_NAME}
|
||||||
@ -131,8 +128,8 @@ msg "Copying configuration files from ${GTK_PREFIX}:"
|
|||||||
install -d "${ETC}/gtk-3.0"
|
install -d "${ETC}/gtk-3.0"
|
||||||
|
|
||||||
# Make Frameworks folder flat
|
# Make Frameworks folder flat
|
||||||
mv "${LIB}"/gdk-pixbuf-2.0/2*/loaders/*.so "${LIB}"
|
ditto "${LIB}"/gdk-pixbuf-2.0/2*/loaders/*.so "${LIB}"
|
||||||
mv "${LIB}"/gtk-3.0/3*/immodules/*.so "${LIB}"
|
ditto "${LIB}"/gtk-3.0/3*/immodules/*.so "${LIB}"
|
||||||
# the print*.so lead to errors when running gtk-query-immodules-3.0, just seeing what the app does without, since they are not in immodules
|
# the print*.so lead to errors when running gtk-query-immodules-3.0, just seeing what the app does without, since they are not in immodules
|
||||||
# and including them leads to errors and a completely empty gtk.immodules file
|
# and including them leads to errors and a completely empty gtk.immodules file
|
||||||
# mv "${LIB}"/gtk-3.0/3*/printbackends/*.so "${LIB}"
|
# mv "${LIB}"/gtk-3.0/3*/printbackends/*.so "${LIB}"
|
||||||
@ -144,11 +141,11 @@ rm -r "${LIB}"/gdk-pixbuf-2.0
|
|||||||
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"
|
||||||
|
|
||||||
mkdir -p ${RESOURCES}/share/glib-2.0
|
mkdir -p ${RESOURCES}/share/glib-2.0
|
||||||
cp -pRL {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/glib-2.0/schemas
|
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/glib-2.0/schemas
|
||||||
"${LOCAL_PREFIX}/local/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas"
|
"${LOCAL_PREFIX}/local/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas"
|
||||||
|
|
||||||
msg "Copying shared files from ${GTK_PREFIX}:"
|
msg "Copying shared files from ${GTK_PREFIX}:"
|
||||||
cp -pRL {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime
|
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime
|
||||||
|
|
||||||
# GTK3 themes
|
# GTK3 themes
|
||||||
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css
|
ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css
|
||||||
@ -157,33 +154,33 @@ ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-
|
|||||||
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}
|
||||||
cp ${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"
|
||||||
|
|
||||||
# Copy libjpeg-turbo into the app bundle
|
# Copy libjpeg-turbo ("62") into the app bundle
|
||||||
cp ${LOCAL_PREFIX}/local/lib/libjpeg.*.dylib "${CONTENTS}/Frameworks"
|
ditto ${LOCAL_PREFIX}/local/lib/libjpeg.62.dylib "${CONTENTS}/Frameworks/libjpeg.62.dylib"
|
||||||
|
|
||||||
# Copy libexpat into the app bundle (which is keg-only)
|
# Copy libexpat into the app bundle (which is keg-only)
|
||||||
|
|
||||||
if [[ -d /usr/local/Cellar/expat ]]; then cp /usr/local/Cellar/expat/*/lib/libexpat.1.dylib "${CONTENTS}/Frameworks"; else cp "${EXPATLIB}" "${CONTENTS}/Frameworks"; fi
|
if [[ -d /usr/local/Cellar/expat ]]; then ditto /usr/local/Cellar/expat/*/lib/libexpat.1.dylib "${CONTENTS}/Frameworks"; else ditto "${EXPATLIB}" "${CONTENTS}/Frameworks"; fi
|
||||||
|
|
||||||
# Copy libz into the app bundle
|
# Copy libz into the app bundle
|
||||||
cp /usr/lib/libz.1.dylib "${CONTENTS}/Frameworks"
|
ditto ${LOCAL_PREFIX}/local/lib/libz.1.dylib "${CONTENTS}/Frameworks"
|
||||||
|
|
||||||
# Copy libtiff into the app bundle
|
# Copy libtiff 5 into the app bundle
|
||||||
cp ${LOCAL_PREFIX}/local/lib/libtiff.5.dylib "${CONTENTS}/Frameworks"
|
ditto ${LOCAL_PREFIX}/local/lib/libtiff.5.dylib "${CONTENTS}/Frameworks/libtiff.5.dylib"
|
||||||
|
|
||||||
# Copy the Lensfun database into the app bundle
|
# Copy the Lensfun database into the app bundle
|
||||||
mkdir -p "${RESOURCES}/share/lensfun"
|
mkdir -p "${RESOURCES}/share/lensfun"
|
||||||
cp ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun"
|
ditto ${LOCAL_PREFIX}/local/share/lensfun/version_2/* "${RESOURCES}/share/lensfun"
|
||||||
|
|
||||||
# Copy liblensfun to Frameworks
|
# Copy liblensfun to Frameworks
|
||||||
cp ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks"
|
ditto ${LOCAL_PREFIX}/local/lib/liblensfun.2.dylib "${CONTENTS}/Frameworks"
|
||||||
|
|
||||||
# Copy libomp to Frameworks
|
# Copy libomp to Frameworks
|
||||||
cp ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks"
|
ditto ${LOCAL_PREFIX}/local/lib/libomp.dylib "${CONTENTS}/Frameworks"
|
||||||
|
|
||||||
# Install names
|
# Install names
|
||||||
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
|
||||||
@ -198,9 +195,7 @@ find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib
|
|||||||
} | bash -v
|
} | bash -v
|
||||||
done
|
done
|
||||||
|
|
||||||
msg "Registering @loader_path into the executable:"
|
|
||||||
echo " install_name_tool -add_rpath @executable_path/../../Frameworks '${EXECUTABLE}'" | bash -v
|
|
||||||
echo " install_name_tool -add_rpath @loader_path/../Frameworks '${EXECUTABLE}-cli'" | bash -v
|
|
||||||
|
|
||||||
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"
|
||||||
@ -208,34 +203,46 @@ ditto "${PROJECT_SOURCE_DIR}/build/Resources" "${RESOURCES}"
|
|||||||
# Executable loader
|
# Executable loader
|
||||||
# Note: executable is renamed to 'rawtherapee-bin'.
|
# Note: executable is renamed to 'rawtherapee-bin'.
|
||||||
mkdir "${MACOS}/bin"
|
mkdir "${MACOS}/bin"
|
||||||
mv "${MACOS}/rawtherapee" "${MACOS}/bin/rawtherapee-bin"
|
ditto "${MACOS}/rawtherapee" "${MACOS}/bin/rawtherapee-bin"
|
||||||
|
rm "${MACOS}/rawtherappe"
|
||||||
install -m 0755 "${PROJECT_SOURCE_DATA_DIR}/executable_loader.in" "${MACOS}/rawtherapee"
|
install -m 0755 "${PROJECT_SOURCE_DATA_DIR}/executable_loader.in" "${MACOS}/rawtherapee"
|
||||||
# App bundle resources
|
# App bundle resources
|
||||||
cp "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}"
|
ditto "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}"
|
||||||
cp "${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"
|
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 binary1 "${CONTENTS}/Info.plist"
|
plutil -convert xml1 "${CONTENTS}/Info.plist"
|
||||||
plutil -convert binary1 "${CONTENTS}/MacOS/bin/Info.plist"
|
plutil -convert xml1 "${CONTENTS}/MacOS/bin/Info.plist"
|
||||||
|
update-mime-database -V "${CONTENTS}/Resources/share/mime"
|
||||||
|
|
||||||
|
msg "Registering @rpath into the executable:"
|
||||||
|
echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${MACOS}/bin/rawtherapee-bin'" | bash -v
|
||||||
|
echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Frameworks '${EXECUTABLE}-cli'" | bash -v
|
||||||
|
|
||||||
# Sign the app
|
# Sign the app
|
||||||
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}/Entitlements.plist"
|
||||||
plutil -convert binary1 "${CONTENTS}/Entitlements.plist"
|
plutil -convert xml1 "${CONTENTS}/Entitlements.plist"
|
||||||
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt-bin.entitlements" "${CONTENTS}/MacOS/bin/Entitlements.plist"
|
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt-bin.entitlements" "${CONTENTS}/MacOS/bin/Entitlements.plist"
|
||||||
plutil -convert binary1 "${CONTENTS}/MacOS/bin/Entitlements.plist"
|
plutil -convert xml1 "${CONTENTS}/MacOS/bin/Entitlements.plist"
|
||||||
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee-bin" --timestamp -o runtime --entitlements "${APP}/Contents/MacOS/bin/Entitlements.plist" "${APP}/Contents/MacOS/bin/rawtherapee-bin"
|
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 --deep --preserve-metadata=identifier,entitlements,runtime --strict -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee" --timestamp -o runtime --entitlements "${APP}/Contents/Entitlements.plist" "${APP}"
|
for frameworklibs in ${CONTENTS}/Frameworks/* ; do
|
||||||
spctl -a -vvvv "${APP}"
|
codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee-bin" -o runtime --timestamp "${frameworklibs}"
|
||||||
|
done
|
||||||
|
codesign --deep --preserve-metadata=identifier,entitlements,runtime --timestamp --strict -v -s "${CODESIGNID}" -i "com.rawtherapee.rawtherapee" -o runtime --entitlements "${CONTENTS}/Entitlements.plist" "${APP}"
|
||||||
|
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:"
|
||||||
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
|
||||||
@ -264,8 +271,8 @@ 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}"
|
ditto -R "${APP}" "${srcDir}"
|
||||||
cp AboutThisBuild.txt "${srcDir}"
|
ditto AboutThisBuild.txt "${srcDir}"
|
||||||
ln -s /Applications "${srcDir}"
|
ln -s /Applications "${srcDir}"
|
||||||
|
|
||||||
# Web bookmarks
|
# Web bookmarks
|
||||||
@ -292,7 +299,9 @@ function CreateDmg {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Notarize the dmg
|
# Notarize the dmg
|
||||||
if ! test -z "$NOTARY" ; then
|
|
||||||
|
if ! test -z "$NOTARY" ; then
|
||||||
|
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
|
||||||
@ -318,7 +327,9 @@ function CreateDmg {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Zip disk image for redistribution
|
# Zip disk image for redistribution
|
||||||
|
msg "Zipping disk image for redistribution:"
|
||||||
|
|
||||||
zip "${dmg_name}.zip" "${dmg_name}.dmg" AboutThisBuild.txt
|
zip "${dmg_name}.zip" "${dmg_name}.dmg" AboutThisBuild.txt
|
||||||
rm "${dmg_name}.dmg"
|
rm "${dmg_name}.dmg"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user