Re-formatted tools/osx/macosx_bundle.sh
This commit is contained in:
@@ -11,24 +11,24 @@
|
|||||||
# - GTK_PREFIX
|
# - GTK_PREFIX
|
||||||
|
|
||||||
function message {
|
function message {
|
||||||
printf '\e[34m-- %s\e[m\n' "$*"
|
printf '\e[34m-- %s\e[m\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; do
|
GetDependencies "$1" | while read; 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
|
||||||
}
|
}
|
||||||
|
|
||||||
# source check
|
# source check
|
||||||
if test ! -d "${CMAKE_BUILD_TYPE}"; then
|
if test ! -d "${CMAKE_BUILD_TYPE}"; then
|
||||||
printf "\e[31m${PWD}/${CMAKE_BUILD_TYPE} directory is not found. Please execute 'make install' first.\e[m\n"
|
printf "\e[31m${PWD}/${CMAKE_BUILD_TYPE} directory is not found. Please execute 'make install' first.\e[m\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update project version
|
# update project version
|
||||||
@@ -45,7 +45,7 @@ fi
|
|||||||
# 'MINIMUM_VERSION' will be used host OS X version.
|
# 'MINIMUM_VERSION' will be used host OS X version.
|
||||||
MINIMUM_SYSTEM_VERSION="$(otool -l "${CMAKE_BUILD_TYPE}"/rawtherapee | grep -A2 'LC_VERSION_MIN_MACOSX' | awk '$1 ~ /version/ { printf $2 }')"
|
MINIMUM_SYSTEM_VERSION="$(otool -l "${CMAKE_BUILD_TYPE}"/rawtherapee | grep -A2 'LC_VERSION_MIN_MACOSX' | awk '$1 ~ /version/ { printf $2 }')"
|
||||||
if test ! -n "${MINIMUM_SYSTEM_VERSION}"; then
|
if test ! -n "${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
|
||||||
|
|
||||||
# check for pango-querymodules. Pango 1.38.0 and above do not include it.
|
# check for pango-querymodules. Pango 1.38.0 and above do not include it.
|
||||||
@@ -61,8 +61,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case ${PROC_BIT_DEPTH} in
|
case ${PROC_BIT_DEPTH} in
|
||||||
64) arch=x86_64;;
|
64) arch=x86_64;;
|
||||||
32) arch=i386;;
|
32) arch=i386;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cat <<__EOS__
|
cat <<__EOS__
|
||||||
@@ -89,9 +89,9 @@ rm -rf "${APP}" ${PROJECT_NAME}_*.dmg
|
|||||||
|
|
||||||
message "Creating bundle container"
|
message "Creating bundle container"
|
||||||
install -d "${RESOURCES}" \
|
install -d "${RESOURCES}" \
|
||||||
"${MACOS}" \
|
"${MACOS}" \
|
||||||
"${LIB}" \
|
"${LIB}" \
|
||||||
"${ETC}"
|
"${ETC}"
|
||||||
|
|
||||||
message "Copying release files"
|
message "Copying release files"
|
||||||
ditto "${CMAKE_BUILD_TYPE}" "${MACOS}"
|
ditto "${CMAKE_BUILD_TYPE}" "${MACOS}"
|
||||||
@@ -113,7 +113,7 @@ cp "${GTK_PREFIX}"/etc/gtk-2.0/im-multipress.conf "${ETC}"/gtk-2.0
|
|||||||
"${GTK_PREFIX}"/bin/gdk-pixbuf-query-loaders "${LIB}"/gdk-pixbuf-2.0/*/loaders/*.so > "${ETC}"/gtk-2.0/gdk-pixbuf.loaders
|
"${GTK_PREFIX}"/bin/gdk-pixbuf-query-loaders "${LIB}"/gdk-pixbuf-2.0/*/loaders/*.so > "${ETC}"/gtk-2.0/gdk-pixbuf.loaders
|
||||||
"${GTK_PREFIX}"/bin/gtk-query-immodules-2.0 "${LIB}"/gtk-2.0/*/immodules/*.so > "${ETC}"/gtk-2.0/gtk.immodules
|
"${GTK_PREFIX}"/bin/gtk-query-immodules-2.0 "${LIB}"/gtk-2.0/*/immodules/*.so > "${ETC}"/gtk-2.0/gtk.immodules
|
||||||
sed -i "" -e "s|${PWD}|/tmp|" "${ETC}"/gtk-2.0/gdk-pixbuf.loaders \
|
sed -i "" -e "s|${PWD}|/tmp|" "${ETC}"/gtk-2.0/gdk-pixbuf.loaders \
|
||||||
"${ETC}"/gtk-2.0/gtk.immodules
|
"${ETC}"/gtk-2.0/gtk.immodules
|
||||||
if [[ "$ExistPangoQuerymodules" = "true" ]]; then
|
if [[ "$ExistPangoQuerymodules" = "true" ]]; then
|
||||||
"${GTK_PREFIX}"/bin/pango-querymodules "${LIB}"/pango/*/modules/*.so > "${ETC}"/pango/pango.modules
|
"${GTK_PREFIX}"/bin/pango-querymodules "${LIB}"/pango/*/modules/*.so > "${ETC}"/pango/pango.modules
|
||||||
sed -i "" -e "s|${PWD}|/tmp|" "${ETC}"/pango/pango.modules
|
sed -i "" -e "s|${PWD}|/tmp|" "${ETC}"/pango/pango.modules
|
||||||
@@ -129,23 +129,23 @@ install -d "${MACOS}"/share/themes/Raleigh/gtk-2.0
|
|||||||
(cd "${MACOS}"/share/themes/Raleigh/gtk-2.0 && ln -s ../../Clearlooks/gtk-2.0/gtkrc)
|
(cd "${MACOS}"/share/themes/Raleigh/gtk-2.0 && ln -s ../../Clearlooks/gtk-2.0/gtkrc)
|
||||||
# fontconfig files (X11 backend only)
|
# fontconfig files (X11 backend only)
|
||||||
if otool -L "${EXECUTABLE}" | grep -sq 'libgtk-x11-2.0'; then
|
if otool -L "${EXECUTABLE}" | grep -sq 'libgtk-x11-2.0'; then
|
||||||
message "Installing fontconfig files (Your library is X11 backend. 'FONTCONFIG_PATH' will be set by executable loader.)"
|
message "Installing fontconfig files (Your library is X11 backend. 'FONTCONFIG_PATH' will be set by executable loader.)"
|
||||||
cp -RL "${GTK_PREFIX}"/etc/fonts "${ETC}"
|
cp -RL "${GTK_PREFIX}"/etc/fonts "${ETC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# install names
|
# install names
|
||||||
find -E "${MACOS}" -type f -regex '.*/(rawtherapee|.*\.(dylib|so))' | while read x; do
|
find -E "${MACOS}" -type f -regex '.*/(rawtherapee|.*\.(dylib|so))' | while read x; do
|
||||||
message "Modifying install names: ${x}"
|
message "Modifying install names: ${x}"
|
||||||
{
|
{
|
||||||
# id
|
# id
|
||||||
case ${x} in *.dylib) echo " install_name_tool -id '@rpath/$(basename "${x}")' '${x}'";; esac
|
case ${x} in *.dylib) echo " install_name_tool -id '@rpath/$(basename "${x}")' '${x}'";; esac
|
||||||
# names
|
# names
|
||||||
GetDependencies "${x}" | while read y; do
|
GetDependencies "${x}" | while read y; 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
|
||||||
|
|
||||||
message "Registering @loader_path into the executable"
|
message "Registering @loader_path into the executable"
|
||||||
@@ -164,39 +164,39 @@ cp "${PROJECT_SOURCE_DATA_DIR}"/{rawtherapee,profile}.icns "${RESOURCES}"
|
|||||||
cp "${PROJECT_SOURCE_DATA_DIR}"/PkgInfo "${CONTENTS}"
|
cp "${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
|
||||||
sed -i "" -e "s|@version@|${PROJECT_VERSION}|
|
sed -i "" -e "s|@version@|${PROJECT_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 binary1 "${CONTENTS}"/Info.plist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function CreateDmg {
|
function CreateDmg {
|
||||||
local srcdir="$(mktemp -dt $$)"
|
local srcdir="$(mktemp -dt $$)"
|
||||||
|
|
||||||
message "Preparing disk image sources at ${srcdir}"
|
message "Preparing disk image sources at ${srcdir}"
|
||||||
mv "${APP}" "${srcdir}"
|
mv "${APP}" "${srcdir}"
|
||||||
cp AboutThisBuild.txt "${srcdir}"
|
cp 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 'RawTherapee Blog' 'http://www.rawtherapee.com'
|
CreateWebloc 'RawTherapee Blog' 'http://www.rawtherapee.com'
|
||||||
CreateWebloc 'Online Manual' 'http://rawpedia.rawtherapee.com/'
|
CreateWebloc 'Online 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}"
|
||||||
if ! echo "${CMAKE_BUILD_TYPE}" | grep -sqi "release"; then
|
if ! echo "${CMAKE_BUILD_TYPE}" | grep -sqi "release"; then
|
||||||
dmg_name="${dmg_name}_$(echo ${CMAKE_BUILD_TYPE} | tr '[:upper:]' '[:lower:]')"
|
dmg_name="${dmg_name}_$(echo ${CMAKE_BUILD_TYPE} | tr '[:upper:]' '[:lower:]')"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
message "Creating disk image"
|
message "Creating disk image"
|
||||||
hdiutil create -format UDBZ -srcdir "${srcdir}" -volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" "${dmg_name}".dmg
|
hdiutil create -format UDBZ -srcdir "${srcdir}" -volname "${PROJECT_NAME}_${PROJECT_FULL_VERSION}" "${dmg_name}".dmg
|
||||||
|
|
||||||
message "Removing disk image caches"
|
message "Removing disk image caches"
|
||||||
rm -rf "${srcdir}"
|
rm -rf "${srcdir}"
|
||||||
}
|
}
|
||||||
CreateDmg
|
CreateDmg
|
||||||
|
Reference in New Issue
Block a user