From d21f051f437e6437bd784a3eb0e4f4b9edcc9e08 Mon Sep 17 00:00:00 2001 From: Richard Barber Date: Thu, 20 Feb 2020 01:56:00 -0800 Subject: [PATCH] mac:sync build directories locations --- CMakeLists.txt | 36 ++++++++++++++++++++++++++++++------ tools/osx/macosx_bundle.sh | 20 ++++++++++++-------- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cef1fc97..a9f96a4d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,7 +200,11 @@ endif() if(NOT DEFINED DOCDIR) if(BUILD_BUNDLE) - set(DOCDIR "${DATADIR}/share/doc") + if(APPLE) + set(DOCDIR "${DATADIR}/doc") + else() + set(DOCDIR "${DATADIR}/share/doc") + endif() else() set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee") endif() @@ -208,7 +212,11 @@ endif() if(NOT DEFINED CREDITSDIR) if(BUILD_BUNDLE) - set(CREDITSDIR "${DATADIR}") + if(APPLE) + set(CREDITSDIR "${DATADIR}") + else() + set(CREDITSDIR "${DATADIR}") + endif() else() set(CREDITSDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee") endif() @@ -216,7 +224,11 @@ endif() if(NOT DEFINED LICENCEDIR) if(BUILD_BUNDLE) - set(LICENCEDIR "${DATADIR}") + if(APPLE) + set(LICENCEDIR "${CREDITSDIR}") + else() + set(LICENCEDIR "${DATADIR}") + endif() else() set(LICENCEDIR "${CMAKE_INSTALL_PREFIX}/share/doc/rawtherapee") endif() @@ -225,7 +237,11 @@ endif() if(NOT DEFINED DESKTOPDIR) if(UNIX) if(BUILD_BUNDLE) - set(DESKTOPDIR "${DATADIR}/share/applications") + if(APPLE) + set(DESKTOPDIR "${DATADIR}/applications") + else() + set(DESKTOPDIR "${DATADIR}/share/applications") + endif() else() set(DESKTOPDIR "${CMAKE_INSTALL_PREFIX}/share/applications") endif() @@ -235,7 +251,11 @@ endif() if(NOT DEFINED ICONSDIR) if(UNIX) if(BUILD_BUNDLE) - set(ICONSDIR "${DATADIR}/share/icons") + if(APPLE) + set(ICONSDIR "${DATADIR}/icons") + else() + set(ICONSDIR "${DATADIR}/share/icons") + endif() else() set(ICONSDIR "${CMAKE_INSTALL_PREFIX}/share/icons") endif() @@ -245,7 +265,11 @@ endif() if(NOT DEFINED APPDATADIR) if(UNIX) if(BUILD_BUNDLE) - set(APPDATADIR "${DATADIR}/share/metainfo") + if(APPLE) + set(APPDATADIR "${DATADIR}/share/metainfo") + else() + set(APPDATADIR "${DATADIR}/share/metainfo") + endif() else() set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo") endif() diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 44908cb4d..1d184899f 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -12,7 +12,7 @@ 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)" +fMagenta="$(tput setaf 3)" fRed="$(tput setaf 1)" function msg { @@ -125,11 +125,16 @@ msg "Removing old files:" rm -rf "${APP}" *.dmg *.zip msg "Creating bundle container:" -install -d "${APP}" "${RESOURCES}" "${MACOS}" "${LIB}" "${ETC}" +cd "${CMAKE_INSTALL_PREEFIX}" +install -d "${APP}" +install -d "${RESOURCES}" +install -d "${MACOS}" +install -d "${LIB}" +install -d "${ETC}" 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" +echo "Bundle OS: $(sw_vers -productName) $(sw_vers -productVersion) $(sw_vers -buildVersion) $(uname -mrs)" >> "${CMAKE_BUILD_TYPE}/Resources/AboutThisBuild.txt" echo "Bundle date: $(date -Ru) ZULU" >> "${CMAKE_BUILD_TYPE}/Resources/AboutThisBuild.txt" echo "Bundle epoch: $(date +%s)" >> "${CMAKE_BUILD_TYPE}/Resources/AboutThisBuild.txt" echo "Bundle UUID: $(uuidgen|tr 'A-Z' 'a-z')" >> "${CMAKE_BUILD_TYPE}/Resources/AboutThisBuild.txt" @@ -250,15 +255,15 @@ ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/glib-2.0/schemas # Append an LC_RPATH msg "Registering @rpath into the main executable." -install_name_tool -add_rpath /Applications/"${LIB}" ${EXECUTABLE} +install_name_tool -add_rpath /Applications/"${LIB}" "${EXECUTABLE}" ModifyInstallNames # fix @rpath in Frameworks msg "Registering @rpath in Frameworks folder." for frameworklibs in "${LIB}"/*{dylib,so} ; do -install_name_tool -delete_rpath ${LOCAL_PREFIX}/local/lib ${frameworklibs} -install_name_tool -add_rpath /Applications/"${LIB}" ${frameworklibs} +install_name_tool -delete_rpath ${LOCAL_PREFIX}/local/lib "${frameworklibs}" +install_name_tool -add_rpath /Applications/"${LIB}" "${frameworklibs}" done install_name_tool -delete_rpath RawTherapee.app/Contents/Frameworks "${EXECUTABLE}"-cli install_name_tool -add_rpath @executable_path "${EXECUTABLE}"-cli @@ -370,5 +375,4 @@ CreateDmg msg "Finishing build:" echo "Script complete." # -# TODO filter out the benign errors -# Build a fancy dmg +# TODO filter out the benign errors; Build a fancy dmg