From f1e253b176139ed83db4348a018e665adb1206b5 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Sun, 29 Jan 2017 20:53:03 +0100 Subject: [PATCH] Git version fix for macOS files. --- tools/osx/Info.plist.in | 6 +++--- tools/osx/macosx_bundle.sh | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/tools/osx/Info.plist.in b/tools/osx/Info.plist.in index 5b08d63a1..e78db0cc4 100644 --- a/tools/osx/Info.plist.in +++ b/tools/osx/Info.plist.in @@ -111,7 +111,7 @@ CFBundleExecutable rawtherapee CFBundleGetInfoString - @version@, Copyright © 2004-2010 Gábor Horváth, 2010-2016 RT dev team + @version@, Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team CFBundleIconFile rawtherapee.icns CFBundleIdentifier @@ -127,7 +127,7 @@ CFBundleSignature ???? CFBundleVersion - @version@ + @shortVersion@ LSExecutableArchitectures @arch@ @@ -135,7 +135,7 @@ NSHighResolutionCapable NSHumanReadableCopyright - Copyright © 2004-2013 Gábor Horváth + Copyright © 2004-2010 Gábor Horváth, 2010-2017 RawTherapee Development Team UTExportedTypeDeclarations diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 2803396ba..89e0c23b0 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -33,12 +33,33 @@ fi # update project version if test -x "$(which git)" -a -d "${PROJECT_SOURCE_DIR}/.git"; then - # This is what the version ought to look like to be accurate in the git universe: - PROJECT_FULL_VERSION="$(git describe --tags --always | sed 's/-g.*//')_$(git symbolic-ref --short -q HEAD)" - # outputs: 4.2-677-g904467b_master - # but Apple requirements https://goo.gl/eWDQv6 state we should use this: - PROJECT_VERSION="$(git describe --tags --always | sed -e 's/-g.*//' -e 's/-/./')" - # outputs: 4.2.677 + ### This section is copied from tools/generateReleaseInfo + # Get version description. + # 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. + gitDescribe="$(git describe --tags --always)" + + # Apple requires a numeric version of the form n.n.n + # https://goo.gl/eWDQv6 + + # Get number of commits since tagging. This is what gitDescribe uses. + # Works when checking out branch, tag or commit. + gitCommitsSinceTag="$(git rev-list --count HEAD --not $(git tag --merged HEAD))" + + # 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. + # Strip everything after hyphen, e.g. "5.0-gtk2" -> "5.0", "5.1-rc1" -> "5.1" (ergo BS). + if [[ -z $gitCommitsSinceTag ]]; then + gitVersionNumericBS="0.0.0" + else + gitVersionNumericBS="${gitDescribe%%-*}" # Remove everything after first hyphen. + gitVersionNumericBS="${gitVersionNumericBS}.${gitCommitsSinceTag}" # Remove everything until after first hyphen: 5.0 + fi + ### Copy end. + + PROJECT_FULL_VERSION="$gitDescribe" + PROJECT_VERSION="$gitVersionNumericBS" + fi # if not specify CMAKE_OSX_DEPLOYMENT_TARGET when compiling, @@ -85,7 +106,7 @@ ETC="${MACOS}"/etc EXECUTABLE="${MACOS}"/rawtherapee message "Removing old files" -rm -rf "${APP}" ${PROJECT_NAME}_*.dmg +rm -rf "${APP}" "${PROJECT_NAME}_*.dmg" message "Creating bundle container" install -d "${RESOURCES}" \ @@ -163,7 +184,7 @@ install -m 0755 "${PROJECT_SOURCE_DATA_DIR}"/executable_loader.in "${MACOS}"/raw 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_VERSION}| +sed -i "" -e "s|@version@|${PROJECT_FULL_VERSION}| s|@shortVersion@|${PROJECT_VERSION}| s|@arch@|${arch}|" \ "${CONTENTS}"/Info.plist