Mostly macOS-related changes to CMake and build scripts, #3678

This commit is contained in:
Morgan Hardwood
2017-04-09 15:04:57 +02:00
parent 56e4114c3e
commit 36cd8b7787
4 changed files with 227 additions and 149 deletions

View File

@@ -114,11 +114,18 @@ option (AUTO_GDK_FLUSH "Use gdk_flush on all gdk_thread_leave other than the GUI
# set install directories # set install directories
if (WIN32 OR APPLE) if (WIN32 OR APPLE)
if(BUILD_BUNDLE)
message(STATUS "You have set BUILD_BUNDLE=ON but this is not necessary - the option if force to ON on Windows and macOS.")
endif()
set (BUILD_BUNDLE ON FORCE) set (BUILD_BUNDLE ON FORCE)
endif(WIN32 OR APPLE) endif(WIN32 OR APPLE)
if (NOT DEFINED BUNDLE_BASE_INSTALL_DIR) if (NOT DEFINED BUNDLE_BASE_INSTALL_DIR)
if (APPLE)
set (BUNDLE_BASE_INSTALL_DIR "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/MacOS")
else (APPLE)
set (BUNDLE_BASE_INSTALL_DIR "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}") set (BUNDLE_BASE_INSTALL_DIR "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
endif (APPLE)
endif (NOT DEFINED BUNDLE_BASE_INSTALL_DIR) endif (NOT DEFINED BUNDLE_BASE_INSTALL_DIR)
if (BUILD_BUNDLE) if (BUILD_BUNDLE)
@@ -132,7 +139,11 @@ endif (NOT DEFINED BINDIR)
if (NOT DEFINED DATADIR) if (NOT DEFINED DATADIR)
if (BUILD_BUNDLE) if (BUILD_BUNDLE)
if (APPLE)
set (DATADIR "../Resources")
else (APPLE)
set (DATADIR .) set (DATADIR .)
endif (APPLE)
else (BUILD_BUNDLE) else (BUILD_BUNDLE)
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share/rawtherapee") set (DATADIR "${CMAKE_INSTALL_PREFIX}/share/rawtherapee")
endif (BUILD_BUNDLE) endif (BUILD_BUNDLE)
@@ -140,7 +151,11 @@ endif (NOT DEFINED DATADIR)
if (NOT DEFINED LIBDIR) if (NOT DEFINED LIBDIR)
if (BUILD_BUNDLE) if (BUILD_BUNDLE)
if (APPLE)
set (LIBDIR "../Frameworks")
else (APPLE)
set (LIBDIR .) set (LIBDIR .)
endif (APPLE)
else (BUILD_BUNDLE) else (BUILD_BUNDLE)
# Respect CMAKE_INSTALL_LIBDIR if set # Respect CMAKE_INSTALL_LIBDIR if set
if (DEFINED CMAKE_INSTALL_LIBDIR) if (DEFINED CMAKE_INSTALL_LIBDIR)
@@ -157,7 +172,7 @@ endif (NOT DEFINED LIBDIR)
if (NOT DEFINED DOCDIR) if (NOT DEFINED DOCDIR)
if (BUILD_BUNDLE) if (BUILD_BUNDLE)
set (DOCDIR ./doc) set (DOCDIR "${DATADIR}/share/doc")
else (BUILD_BUNDLE) else (BUILD_BUNDLE)
set (DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee") set (DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee")
endif (BUILD_BUNDLE) endif (BUILD_BUNDLE)
@@ -165,7 +180,7 @@ endif (NOT DEFINED DOCDIR)
if (NOT DEFINED CREDITSDIR) if (NOT DEFINED CREDITSDIR)
if (BUILD_BUNDLE) if (BUILD_BUNDLE)
set (CREDITSDIR .) set (CREDITSDIR "${DATADIR}")
else (BUILD_BUNDLE) else (BUILD_BUNDLE)
set (CREDITSDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee") set (CREDITSDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee")
endif (BUILD_BUNDLE) endif (BUILD_BUNDLE)
@@ -173,7 +188,7 @@ endif (NOT DEFINED CREDITSDIR)
if (NOT DEFINED LICENCEDIR) if (NOT DEFINED LICENCEDIR)
if (BUILD_BUNDLE) if (BUILD_BUNDLE)
set (LICENCEDIR .) set (LICENCEDIR "${DATADIR}")
else (BUILD_BUNDLE) else (BUILD_BUNDLE)
set (LICENCEDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee") set (LICENCEDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee")
endif (BUILD_BUNDLE) endif (BUILD_BUNDLE)
@@ -181,7 +196,8 @@ endif (NOT DEFINED LICENCEDIR)
if (NOT DEFINED DESKTOPDIR) if (NOT DEFINED DESKTOPDIR)
if (UNIX) if (UNIX)
set (DESKTOPDIR "${CMAKE_INSTALL_PREFIX}/share/applications") set (DESKTOPDIR "${CMAKE_INSTALL_PREFIX}/share/applications") # Absolute
#set (DESKTOPDIR "${DATADIR}/share/applications") # Relative
endif (UNIX) endif (UNIX)
endif (NOT DEFINED DESKTOPDIR) endif (NOT DEFINED DESKTOPDIR)
@@ -197,12 +213,24 @@ if (NOT DEFINED APPDATADIR)
endif (UNIX) endif (UNIX)
endif (NOT DEFINED APPDATADIR) endif (NOT DEFINED APPDATADIR)
# non-bundle builds has to use absolute paths # Enforce absolute paths for non-bundle builds.
if (NOT BUILD_BUNDLE AND NOT (IS_ABSOLUTE "${BINDIR}" AND IS_ABSOLUTE "${DATADIR}" AND IS_ABSOLUTE "${LIBDIR}" AND IS_ABSOLUTE "${DOCDIR}" AND IS_ABSOLUTE "${CREDITSDIR}" AND IS_ABSOLUTE "${LICENCEDIR}")) if(NOT BUILD_BUNDLE)
message (FATAL_ERROR "The paths has to be absolute or use -DBUILD_BUNDLE=ON") if(NOT (IS_ABSOLUTE "${BINDIR}"))
message (FATAL_ERROR "The BINDIR path has to be absolute, or use -DBUILD_BUNDLE=ON")
elseif(NOT (IS_ABSOLUTE "${DATADIR}"))
message (FATAL_ERROR "The DATADIR path has to be absolute, or use -DBUILD_BUNDLE=ON")
elseif(NOT (IS_ABSOLUTE "${LIBDIR}"))
message (FATAL_ERROR "The LIBDIR path has to be absolute, or use -DBUILD_BUNDLE=ON")
elseif(NOT (IS_ABSOLUTE "${DOCDIR}"))
message (FATAL_ERROR "The DOCDIR path has to be absolute, or use -DBUILD_BUNDLE=ON")
elseif(NOT (IS_ABSOLUTE "${CREDITSDIR}"))
message (FATAL_ERROR "The CREDITSDIR path has to be absolute, or use -DBUILD_BUNDLE=ON")
elseif(NOT (IS_ABSOLUTE "${LICENCEDIR}"))
message (FATAL_ERROR "The LICENCEDIR path has to be absolute, or use -DBUILD_BUNDLE=ON")
endif()
endif () endif ()
# MyMutex # MyMutex
if (STRICT_MUTEX OR UPPER_CMAKE_BUILD_TYPE STREQUAL "DEBUG") if (STRICT_MUTEX OR UPPER_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
add_definitions (-DSTRICT_MUTEX=1) add_definitions (-DSTRICT_MUTEX=1)
else (STRICT_MUTEX OR UPPER_CMAKE_BUILD_TYPE STREQUAL "DEBUG") else (STRICT_MUTEX OR UPPER_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
@@ -338,7 +366,7 @@ elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(PROC_BIT_DEPTH 64 bits) set(PROC_BIT_DEPTH 64 bits)
endif (CMAKE_SIZEOF_VOID_P EQUAL 4) endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
# Get comiler name and version # Get compiler name and version
# only cmake > 2.8.7 knows CMAKE_*_COMPILER_VERSION # only cmake > 2.8.7 knows CMAKE_*_COMPILER_VERSION
if (CMAKE_VERSION VERSION_GREATER 2.8.7) if (CMAKE_VERSION VERSION_GREATER 2.8.7)
get_filename_component(COMPILER_INFO ${CMAKE_C_COMPILER} NAME_WE) get_filename_component(COMPILER_INFO ${CMAKE_C_COMPILER} NAME_WE)
@@ -393,13 +421,16 @@ install (FILES AUTHORS.txt DESTINATION "${CREDITSDIR}")
install (FILES LICENSE.txt DESTINATION "${LICENCEDIR}") install (FILES LICENSE.txt DESTINATION "${LICENCEDIR}")
install (FILES "${CMAKE_BINARY_DIR}/AboutThisBuild.txt" DESTINATION "${CREDITSDIR}") install (FILES "${CMAKE_BINARY_DIR}/AboutThisBuild.txt" DESTINATION "${CREDITSDIR}")
install (FILES RELEASE_NOTES.txt DESTINATION "${CREDITSDIR}" OPTIONAL) install (FILES RELEASE_NOTES.txt DESTINATION "${CREDITSDIR}" OPTIONAL)
if (UNIX OR WIN32)
install (FILES "${PROJECT_SOURCE_DIR}/doc/manpage/rawtherapee.1" DESTINATION "${DOCDIR}/man")
endif ()
if (WIN32) if (WIN32)
install (DIRECTORY "licenses" DESTINATION "${LICENCEDIR}") install (DIRECTORY "licenses" DESTINATION "${LICENCEDIR}")
endif (WIN32) endif ()
if (UNIX) if (UNIX)
install (FILES "${PROJECT_SOURCE_DIR}/doc/manpage/rawtherapee.1" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/man/man1")
install (FILES rawtherapee.appdata.xml DESTINATION "${APPDATADIR}") install (FILES rawtherapee.appdata.xml DESTINATION "${APPDATADIR}")
endif (UNIX) endif ()
add_subdirectory (rtexif) add_subdirectory (rtexif)
add_subdirectory (rtengine) add_subdirectory (rtengine)

View File

@@ -1,31 +1,47 @@
#!/bin/bash #!/usr/bin/env bash
cwd="$(cd "$(dirname "$0")"; pwd)" cd "$(dirname "$0")" || exit 1
cwd="$(pwd)"
app="${cwd%/Contents/*}" app="${cwd%/Contents/*}"
etc="${cwd}"/etc lib="${app}/Contents/Frameworks"
resources="${app}/Contents/Resources"
etc="${resources}"/etc
# for different os x versions ### Pending deletion:
# see https://github.com/Beep6581/RawTherapee/issues/1779 # See https://github.com/Beep6581/RawTherapee/issues/1779
cups_dir=/tmp/RT4 # cups_dir=/tmp/RT5
install -d ${cups_dir} # install -d "${cups_dir}"
cp -f /usr/lib/libcups.2.dylib ${cups_dir} # cp -f /usr/lib/libcups.2.dylib "${cups_dir}"
# export DYLD_LIBRARY_PATH="${lib}:${cups_dir}"
export DYLD_LIBRARY_PATH="${cwd}"/lib:${cups_dir} # export GTK_EXE_PREFIX="${resources}"
export GTK_EXE_PREFIX="${cwd}" # export GTK_DATA_PREFIX="${resources}"
export GTK_DATA_PREFIX="${cwd}" # export XDG_DATA_DIRS="${resources}/share"
export GTK_IM_MODULE_FILE="${etc}"/gtk-2.0/gtk.immodules # export GTK_IM_MODULE_FILE="${etc}/gtk-3.0/gtk.immodules"
export GDK_PIXBUF_MODULE_FILE="${etc}"/gtk-2.0/gdk-pixbuf.loaders
export XDG_DATA_DIRS="${cwd}"/share
export PANGO_RC_FILE="${etc}"/pango/pangorc
# environment variables for X11 backend export DYLD_LIBRARY_PATH="${lib}"
if test -d "${etc}"/fonts; then
export FONTCONFIG_PATH="${etc}"/fonts
fi
# strip out system argument export GTK_PATH="${lib}/gtk-3.0/3.0.0"
case $1 in -psn_*) shift;; esac export XDG_DATA_HOME="${resources}/share"
export GSETTINGS_SCHEMA_DIR="${resources}/share/glib-2.0/schemas"
export GDK_PIXBUF_MODULE_FILE="${etc}/gtk-3.0/gdk-pixbuf.loaders"
export GDK_PIXBUF_MODULEDIR="${lib}/gdk-pixbuf-2.0/2.10.0/loaders"
export RT_SETTINGS="${HOME}/Library/Application Support/RawTherapee/config"
export RT_CACHE="${HOME}/Library/Application Support/RawTherapee/cache"
### Pending deletion:
# Environment variables for X11 backend
#if [[ -d ${etc}/fonts ]]; then
# export FONTCONFIG_PATH="${etc}/fonts"
#fi
# Strip out system argument
case "$1" in
-psn_*) shift ;;
esac
ln -sf "${app}" /tmp ln -sf "${app}" /tmp
exec "${cwd}"/rawtherapee-bin "$@" exec "${cwd}/rawtherapee-bin" "$@"

View File

@@ -0,0 +1,30 @@
diff --git a/lib/iconv.c b/lib/iconv.c
index 31853a7..630a498 100644
--- a/lib/iconv.c
+++ b/lib/iconv.c
@@ -611,4 +611,25 @@ strong_alias (libiconv, iconv)
strong_alias (libiconv_close, iconv_close)
#endif
+#undef iconv_open
+#undef iconv
+#undef iconv_close
+
+LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* tocode, const char* fromcode)
+{
+ return libiconv_open(tocode, fromcode);
+}
+
+LIBICONV_DLL_EXPORTED size_t iconv (iconv_t icd,
+ ICONV_CONST char * * inbuf, size_t *inbytesleft,
+ char * * outbuf, size_t *outbytesleft)
+{
+ return libiconv(icd, inbuf, inbytesleft, outbuf, outbytesleft);
+}
+
+LIBICONV_DLL_EXPORTED int iconv_close (iconv_t icd)
+{
+ return libiconv_close(icd);
+}
+
#endif

View File

@@ -1,17 +1,26 @@
#!/bin/bash #!/usr/bin/env bash
# Required variables # Required variables, must be set in rtdata/CMakeLists.txt
# ------------------
# these are very important variables. Must be set into rtdata/CMakeLists.txt!
# - PROJECT_NAME # - PROJECT_NAME
# - PROJECT_SOURCE_DIR
# - PROJECT_VERSION (if without git) # - PROJECT_VERSION (if without git)
# - PROJECT_SOURCE_DIR
# - CMAKE_BUILD_TYPE # - CMAKE_BUILD_TYPE
# - PROC_BIT_DEPTH # - PROC_BIT_DEPTH
# - GTK_PREFIX # - GTK_PREFIX
function message { # Formatting
printf '\e[34m-- %s\e[m\n' "$*" fNormal="$(tput sgr0)"
fBold="$(tput bold)"
# Colors depend upon the user's terminal emulator color scheme - what is readable for you may be not readable for someone else.
fMagenta="$(tput setaf 5)"
fRed="$(tput setaf 1)"
function msg {
printf "\n${fBold}-- %s${fNormal}\n" "${@}"
}
function msgError {
printf "\n${fBold}Error:${fNormal}\n%s\n" "${@}"
} }
function GetDependencies { function GetDependencies {
@@ -25,14 +34,14 @@ function CheckLink {
done done
} }
# source check # Source check
if test ! -d "${CMAKE_BUILD_TYPE}"; then if [[ ! -d "${CMAKE_BUILD_TYPE}" ]]; then
printf "\e[31m${PWD}/${CMAKE_BUILD_TYPE} directory is not found. Please execute 'make install' first.\e[m\n" 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 test -x "$(which git)" -a -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),
@@ -62,25 +71,11 @@ if test -x "$(which git)" -a -d "${PROJECT_SOURCE_DIR}/.git"; then
fi fi
# if not specify CMAKE_OSX_DEPLOYMENT_TARGET when compiling, MINIMUM_SYSTEM_VERSION="$(otool -l "${CMAKE_BUILD_TYPE}"/MacOS/rawtherapee | grep -A2 'LC_VERSION_MIN_MACOSX' | awk '$1 ~ /version/ { printf $2 }')"
# 'MINIMUM_VERSION' will be used host OS X version. if [[ -z "${MINIMUM_SYSTEM_VERSION}" ]]; then
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
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.
# https://github.com/Homebrew/homebrew/issues/44764#issuecomment-146795820
PangoVer="$(brew list --versions pango)"
PangoVer="${PangoVer//./}"
# Only check the first 4 digits, so that "1.36.99" (13699) doesn't test greater than "1.38.0" (1380)
PangoVer="${PangoVer:0:4}"
if [[ "$PangoVer" -ge "1380" ]]; then
ExistPangoQuerymodules="false"
else
ExistPangoQuerymodules="true"
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;;
@@ -97,68 +92,70 @@ GTK_PREFIX: ${GTK_PREFIX}
PWD: ${PWD} PWD: ${PWD}
__EOS__ __EOS__
APP="${PROJECT_NAME}".app APP="${PROJECT_NAME}.app"
CONTENTS="${APP}"/Contents CONTENTS="${APP}/Contents"
RESOURCES="${CONTENTS}"/Resources RESOURCES="${CONTENTS}/Resources"
MACOS="${CONTENTS}"/MacOS MACOS="${CONTENTS}/MacOS"
LIB="${MACOS}"/lib LIB="${CONTENTS}/Frameworks"
ETC="${MACOS}"/etc ETC="${RESOURCES}/etc"
EXECUTABLE="${MACOS}"/rawtherapee EXECUTABLE="${MACOS}/rawtherapee"
message "Removing old files" msg "Removing old files:"
rm -rf "${APP}" "${PROJECT_NAME}_*.dmg" rm -rf "${APP}" "${PROJECT_NAME}_*.dmg"
message "Creating bundle container" msg "Creating bundle container:"
install -d "${RESOURCES}" \ install -d "${RESOURCES}" \
"${MACOS}" \ "${MACOS}" \
"${LIB}" \ "${LIB}" \
"${ETC}" "${ETC}"
message "Copying release files" msg "Copying release files:"
ditto "${CMAKE_BUILD_TYPE}" "${MACOS}" ditto "${CMAKE_BUILD_TYPE}/MacOS" "${MACOS}"
ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}"
message "Copying dependencies from ${GTK_PREFIX}" msg "Copying dependencies from ${GTK_PREFIX}:"
CheckLink "${EXECUTABLE}" CheckLink "${EXECUTABLE}"
message "Copying library modules from ${GTK_PREFIX}" msg "Copying library modules from ${GTK_PREFIX}:"
ditto --arch "${arch}" {"${GTK_PREFIX}"/lib,"${LIB}"}/gdk-pixbuf-2.0 ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0
ditto --arch "${arch}" {"${GTK_PREFIX}"/lib,"${LIB}"}/gtk-2.0 ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gtk-3.0
ditto --arch "${arch}" {"${GTK_PREFIX}"/lib,"${LIB}"}/pango
message "Removing static libraries and cache files" msg "Removing static libraries and cache files:"
find -E "${LIB}" -type f -regex '.*\.(a|la|cache)$' | while read; do rm "${REPLY}"; done find -E "${LIB}" -type f -regex '.*\.(a|la|cache)$' | while read; do rm "${REPLY}"; done
message "Copying configuration files from ${GTK_PREFIX}" msg "Copying configuration files from ${GTK_PREFIX}:"
install -d "${ETC}"/{gtk-2.0,pango} install -d "${ETC}/gtk-3.0"
cp "${GTK_PREFIX}"/etc/gtk-2.0/im-multipress.conf "${ETC}"/gtk-2.0 cp "${GTK_PREFIX}/etc/gtk-3.0/im-multipress.conf" "${ETC}/gtk-3.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-3.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-3.0" "${LIB}"/gtk-3.0/*/immodules/*.so > "${ETC}/gtk-3.0/gtk.immodules"
sed -i "" -e "s|${PWD}|/tmp|" "${ETC}"/gtk-2.0/gdk-pixbuf.loaders \ sed -i "" -e "s|${PWD}|/tmp|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules"
"${ETC}"/gtk-2.0/gtk.immodules
if [[ "$ExistPangoQuerymodules" = "true" ]]; then
"${GTK_PREFIX}"/bin/pango-querymodules "${LIB}"/pango/*/modules/*.so > "${ETC}"/pango/pango.modules
sed -i "" -e "s|${PWD}|/tmp|" "${ETC}"/pango/pango.modules
printf "[Pango]\nModuleFiles = /tmp/${ETC}/pango/pango.modules" > "${ETC}"/pango/pangorc
fi
message "Copying shared files from ${GTK_PREFIX}" ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/glib-2.0/schemas
cp -R "${GTK_PREFIX}"/share/mime "${MACOS}"/share "${GTK_PREFIX}/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas"
# gtk themes
ditto {"${GTK_PREFIX}","${MACOS}"}/share/themes/Mac/gtk-2.0-key/gtkrc msg "Copying shared files from ${GTK_PREFIX}:"
ditto {"${GTK_PREFIX}","${MACOS}"}/share/themes/Clearlooks/gtk-2.0/gtkrc ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/mime
install -d "${MACOS}"/share/themes/Raleigh/gtk-2.0 # GTK3 themes
(cd "${MACOS}"/share/themes/Raleigh/gtk-2.0 && ln -s ../../Clearlooks/gtk-2.0/gtkrc) ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/themes/Mac/gtk-3.0/gtk-keys.css
ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/themes/Default/gtk-3.0/gtk-keys.css
# Adwaita icons
iconfolders=("16x16/actions" "16x16/devices" "16x16/mimetypes" "16x16/places" "16x16/status" "48x48/devices")
for f in "${iconfolders[@]}"; do
ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/"$f"
done
ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme
"${GTK_PREFIX}/bin/gtk-update-icon-cache-3.0" "${RESOURCES}/share/icons/Adwaita"
### Pending deletion:
# 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.)" # msg "Installing fontconfig files (Using 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}" msg "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
@@ -166,58 +163,62 @@ find -E "${MACOS}" -type f -regex '.*/(rawtherapee|.*\.(dylib|so))' | while read
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" msg "Registering @loader_path into the executable:"
echo " install_name_tool -add_rpath @loader_path/lib '${EXECUTABLE}'" | bash -v echo " install_name_tool -add_rpath @loader_path/lib '${EXECUTABLE}'" | bash -v
msg "Installing required application bundle files:"
PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx"
# Executable loader
message "Installing required application bundle files" # Note: executable is renamed to 'rawtherapee-bin'.
PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}"/tools/osx mv "${MACOS}/rawtherapee" "${MACOS}/rawtherapee-bin"
# executable loader install -m 0755 "${PROJECT_SOURCE_DATA_DIR}/executable_loader.in" "${MACOS}/rawtherapee"
# note: executable is renamed to 'rawtherapee-bin'. # App bundle resources
mv "${MACOS}"/rawtherapee{,-bin} cp "${PROJECT_SOURCE_DATA_DIR}/"{rawtherapee,profile}.icns "${RESOURCES}"
install -m 0755 "${PROJECT_SOURCE_DATA_DIR}"/executable_loader.in "${MACOS}"/rawtherapee cp "${PROJECT_SOURCE_DATA_DIR}/PkgInfo" "${CONTENTS}"
# app bundle resources install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/Info.plist.in" "${CONTENTS}/Info.plist"
cp "${PROJECT_SOURCE_DATA_DIR}"/{rawtherapee,profile}.icns "${RESOURCES}"
cp "${PROJECT_SOURCE_DATA_DIR}"/PkgInfo "${CONTENTS}"
install -m 0644 "${PROJECT_SOURCE_DATA_DIR}"/Info.plist.in "${CONTENTS}"/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 binary1 "${CONTENTS}/Info.plist"
function CreateDmg { function CreateDmg {
local srcdir="$(mktemp -dt $$)" local srcDir="$(mktemp -dt $$)"
message "Preparing disk image sources at ${srcdir}" msg "Preparing disk image sources at ${srcDir}:"
mv "${APP}" "${srcdir}" cp -R "${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 'Website' 'http://www.rawtherapee.com/'
CreateWebloc 'Online 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}"
if ! echo "${CMAKE_BUILD_TYPE}" | grep -sqi "release"; then lower_build_type="$(tr '[:upper:]' '[:lower:]' <<< "$CMAKE_BUILD_TYPE")"
dmg_name="${dmg_name}_$(echo ${CMAKE_BUILD_TYPE} | tr '[:upper:]' '[:lower:]')" if [[ ${lower_build_type} != release ]]; then
dmg_name="${dmg_name}_${lower_build_type}"
fi fi
message "Creating disk image" msg "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" # Zip disk image for redistribution
rm -rf "${srcdir}" zip "${dmg_name}.zip" "${dmg_name}.dmg" AboutThisBuild.txt
rm "${dmg_name}.dmg"
msg "Removing disk image caches:"
rm -rf "${srcDir}"
} }
CreateDmg CreateDmg