Complete revision to how RawTherapee's version is handled in CMake and in other files, #3628

This commit is contained in:
Morgan Hardwood 2017-01-25 00:18:52 +01:00
parent 9fbbb052ee
commit e5c00f0a9d
20 changed files with 217 additions and 193 deletions

View File

@ -22,31 +22,68 @@ if (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
message(STATUS "git command found: ${GIT_CMD}")
endif ()
# 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.
execute_process(COMMAND ${GIT_CMD} describe --tags --always OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
# Get branch name.
# Will return empty if you checked out a commit or tag. Empty string handled later.
execute_process(COMMAND ${GIT_CMD} symbolic-ref --short -q HEAD OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
execute_process(COMMAND ${GIT_CMD} describe --tags --always OUTPUT_VARIABLE GIT_VERSION_WHOLE OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
string(REGEX REPLACE "-g.*" "" GIT_VERSION ${GIT_VERSION_WHOLE})
string(REPLACE "-" "." GIT_VERSION ${GIT_VERSION})
execute_process(COMMAND ${GIT_CMD} rev-parse --verify HEAD OUTPUT_VARIABLE GIT_CHANGESET OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
string(REGEX REPLACE ".*-(.*)-g.*" "\\1" GIT_TAGDISTANCE ${GIT_VERSION_WHOLE})
# Get commit hash.
execute_process(COMMAND ${GIT_CMD} rev-parse --short --verify HEAD OUTPUT_VARIABLE GIT_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
# Get commit date, YYYY-MM-DD.
execute_process(COMMAND ${GIT_CMD} show -s --format=%cd --date=format:%Y-%m-%d OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
# Get number of commits since tagging. This is what "GIT_DESCRIBE" uses.
# Works when checking out branch, tag or commit.
# Get a list of all tags in repo:
execute_process(COMMAND ${GIT_CMD} tag --merged HEAD OUTPUT_VARIABLE GIT_TAG WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
# Replace newlines with semicolons so that it can be split:
string(REPLACE "\n" ";" GIT_TAG_LIST "${GIT_TAG}")
execute_process(COMMAND ${GIT_CMD} rev-list --count HEAD --not ${GIT_TAG_LIST} OUTPUT_VARIABLE GIT_COMMITS_SINCE_TAG OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
# Get number of commits since branching.
# Works when checking out branch, tag or commit.
execute_process(COMMAND ${GIT_CMD} rev-list --count HEAD --not --tags OUTPUT_VARIABLE GIT_COMMITS_SINCE_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
# If user checked-out something which is not a branch, use the description as branch name.
if (GIT_BRANCH STREQUAL "")
set (GIT_BRANCH "${GIT_DESCRIBE}")
endif()
# 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 (GIT_COMMITS_SINCE_TAG STREQUAL "")
set (GIT_NUMERIC_VERSION_BS "0.0.0")
else ()
string(REGEX REPLACE "-.*" "" GIT_NUMERIC_VERSION_BS ${GIT_DESCRIBE})
set(GIT_NUMERIC_VERSION_BS "${GIT_NUMERIC_VERSION_BS}.${GIT_COMMITS_SINCE_TAG}")
endif ()
message(STATUS "Git checkout information:")
message(STATUS " Commit description: ${GIT_DESCRIBE}")
message(STATUS " Branch: ${GIT_BRANCH}")
message(STATUS " Commit: ${GIT_COMMIT}")
message(STATUS " Commit date: ${GIT_COMMIT_DATE}")
message(STATUS " Commits since tag: ${GIT_COMMITS_SINCE_TAG}")
message(STATUS " Commits since branch: ${GIT_COMMITS_SINCE_BRANCH}")
message(STATUS " Version (unreliable): ${GIT_NUMERIC_VERSION_BS}")
if (NOT DEFINED CACHE_NAME_SUFFIX)
string(REGEX REPLACE "-.*" "" CACHE_NAME_SUFFIX ${GIT_VERSION_WHOLE})
set(CACHE_NAME_SUFFIX "${GIT_DESCRIBE}")
message(STATUS "CACHE_NAME_SUFFIX was not defined, it is now \"${CACHE_NAME_SUFFIX}\"")
elseif (CACHE_NAME_SUFFIX STREQUAL "latesttag")
string(REGEX REPLACE "-.*" "" CACHE_NAME_SUFFIX ${GIT_VERSION_WHOLE})
message(STATUS "CACHE_NAME_SUFFIX was \"latesttag\", it is now \"${CACHE_NAME_SUFFIX}\"")
else ()
message(STATUS "CACHE_NAME_SUFFIX is \"${CACHE_NAME_SUFFIX}\"")
endif ()
else (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
include("${PROJECT_SOURCE_DIR}/ReleaseInfo.cmake")
endif (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
if (VERSION_SUFFIX STREQUAL "")
set (GIT_VERSION_SUFFIX "${GIT_VERSION}")
else ()
set (GIT_VERSION_SUFFIX "${GIT_VERSION} ${VERSION_SUFFIX}")
endif ()
# build version.h from template
configure_file ("${PROJECT_SOURCE_DIR}/rtgui/version.h.in" "${CMAKE_BINARY_DIR}/rtgui/version.h")
# build AboutThisBuild.txt from template

View File

@ -1,6 +1,7 @@
Version: ${GIT_DESCRIBE}
Branch: ${GIT_BRANCH}
Version: ${GIT_VERSION_SUFFIX}
Changeset: ${GIT_CHANGESET}
Commit: ${GIT_COMMIT}
Commit date: ${GIT_COMMIT_DATE}
Compiler: ${COMPILER_INFO}
Processor: ${PROC_LABEL}
System: ${SYSTEM}
@ -11,4 +12,3 @@ Build flags: ${CXX_FLAGS}
Link flags: ${LFLAGS}
OpenMP support: ${OPTION_OMP}
MMAP support: ${WITH_MYFILE_MMAP}

View File

@ -359,7 +359,6 @@ set(ABOUT_COMMAND_WITH_ARGS ${CMAKE_COMMAND}
-DPROC_LABEL:STRING="${PROC_LABEL}"
-DPROC_BIT_DEPTH:STRING="${PROC_BIT_DEPTH}"
-DBUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DVERSION_SUFFIX:STRING=${VERSION_SUFFIX}
-DGTKMM_VERSION:STRING=${GTKMM_VERSION}
-DOPTION_OMP:STRING=${OPTION_OMP}
-DWITH_MYFILE_MMAP:STRING=${WITH_MYFILE_MMAP})

View File

@ -19,43 +19,23 @@ else (WIN32)
endif (WIN32)
if (WIN32)
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(BUILD_BIT_DEPTH 32)
# 32 bits builds has to be installable on 64 bits system, to support WinXP/64.
set(ARCHITECTURE_ALLOWED "x86 x64 ia64")
# installing in 32 bits mode even on 64 bits OS and architecture
set(INSTALL_MODE "")
# set part of the output archive name
set(SYSTEM_NAME "WinXP")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BUILD_BIT_DEPTH 64)
# Restricting the 64 bits builds to 64 bits systems only
set(ARCHITECTURE_ALLOWED "x64 ia64")
# installing in 64 bits mode for all 64 bits processors, even for itanium architecture
set(INSTALL_MODE "x64 ia64")
# set part of the output archive name
set(SYSTEM_NAME "WinVista")
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
# If we find ReleaseInfo.cmake we use the info from there and don't need Git to be installed
find_file(REL_INFO_FILE ReleaseInfo.cmake PATHS "${PROJECT_SOURCE_DIR}" NO_DEFAULT_PATH)
if (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
# we look for the git command in this paths by order of preference
find_file(GIT_CMD git.exe HINTS ENV Path PATH_SUFFIXES ../)
# Fail if Git is not installed
if (GIT_CMD STREQUAL GIT_CMD-NOTFOUND)
message(FATAL_ERROR "git command not found!")
else ()
message(STATUS "git command found: ${GIT_CMD}")
endif ()
execute_process(COMMAND ${GIT_CMD} describe --tags --always OUTPUT_VARIABLE GIT_VERSION_WHOLE OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
string(REGEX REPLACE "-.*" "" GIT_VERSION ${GIT_VERSION_WHOLE})
string(REGEX REPLACE ".*-(.*)-g.*" "\\1" GIT_TAGDISTANCE ${GIT_VERSION_WHOLE})
else (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
include("${PROJECT_SOURCE_DIR}/ReleaseInfo.cmake")
endif (REL_INFO_FILE STREQUAL REL_INFO_FILE-NOTFOUND)
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(BUILD_BIT_DEPTH 32)
# 32 bits builds has to be installable on 64 bits system, to support WinXP/64.
set(ARCHITECTURE_ALLOWED "x86 x64 ia64")
# installing in 32 bits mode even on 64 bits OS and architecture
set(INSTALL_MODE "")
# set part of the output archive name
set(SYSTEM_NAME "WinXP")
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BUILD_BIT_DEPTH 64)
# Restricting the 64 bits builds to 64 bits systems only
set(ARCHITECTURE_ALLOWED "x64 ia64")
# installing in 64 bits mode for all 64 bits processors, even for itanium architecture
set(INSTALL_MODE "x64 ia64")
# set part of the output archive name
set(SYSTEM_NAME "WinVista")
endif (CMAKE_SIZEOF_VOID_P EQUAL 4)
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/../tools/win/InnoSetup/WindowsInnoSetup.iss.in" "${CMAKE_CURRENT_BINARY_DIR}/WindowsInnoSetup.iss")
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/WindowsInnoSetup.iss" DESTINATION ${BINDIR})

View File

@ -1351,7 +1351,7 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed)
}
TIFFSetField (out, TIFFTAG_SOFTWARE, "RawTherapee " VERSION);
TIFFSetField (out, TIFFTAG_SOFTWARE, "RawTherapee " RTVERSION);
TIFFSetField (out, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField (out, TIFFTAG_IMAGELENGTH, height);
TIFFSetField (out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);

View File

@ -26,7 +26,7 @@
#include "../rtgui/paramsedited.h"
#include "../rtgui/options.h"
#include <locale.h>
#define APPVERSION VERSION
#define APPVERSION RTVERSION
using namespace std;
extern Options options;

View File

@ -278,7 +278,7 @@ bool TagDirectory::CPBDump (const Glib::ustring &commFName, const Glib::ustring
try {
kf->set_string ("RT General", "CachePath", options.cacheBaseDir);
kf->set_string ("RT General", "AppVersion", VERSION);
kf->set_string ("RT General", "AppVersion", RTVERSION);
kf->set_integer("RT General", "ProcParamsVersion", PPVERSION);
kf->set_string ("RT General", "ImageFileName", imageFName);
kf->set_string ("RT General", "OutputProfileFileName", profileFName);
@ -2797,7 +2797,7 @@ std::vector<Tag*> ExifManager::getDefaultTIFFTags (TagDirectory* forthis)
defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "XResolution"), 300, RATIONAL));
defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "YResolution"), 300, RATIONAL));
defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "ResolutionUnit"), 2, SHORT));
defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "Software"), "RawTherapee " VERSION));
defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "Software"), "RawTherapee " RTVERSION));
defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "Orientation"), 1, SHORT));
defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "SamplesPerPixel"), 3, SHORT));
defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "BitsPerSample"), 8, SHORT));

View File

@ -203,7 +203,7 @@ int CacheImageData::save (const Glib::ustring& fname)
} catch (Glib::Error&) {}
keyFile.set_string ("General", "MD5", md5);
keyFile.set_string ("General", "Version", VERSION); // Application's version
keyFile.set_string ("General", "Version", RTVERSION);
keyFile.set_boolean ("General", "Supported", supported);
keyFile.set_integer ("General", "Format", format);
keyFile.set_boolean ("General", "RecentlySaved", recentlySaved);

View File

@ -214,7 +214,7 @@ int main(int argc, char **argv)
SetConsoleCtrlHandler( NULL, true );
// Set title of console
char consoletitle[128];
sprintf(consoletitle, "RawTherapee %s Console", VERSION);
sprintf(consoletitle, "RawTherapee %s Console", RTVERSION);
SetConsoleTitle(consoletitle);
// increase size of screen buffer
COORD c;
@ -240,7 +240,7 @@ int main(int argc, char **argv)
consoleOpened = true;
// printing RT's version in every case, particularly useful for the 'verbose' mode, but also for the batch processing
std::cout << "RawTherapee, version " << VERSION << std::endl;
std::cout << "RawTherapee, version " << RTVERSION << std::endl;
std::cout << "WARNING: closing this window will close RawTherapee!" << std::endl << std::endl;
}
}
@ -263,7 +263,7 @@ int main(int argc, char **argv)
if (argc > 1 || options.rtSettings.verbose) {
// printing RT's version in all case, particularly useful for the 'verbose' mode, but also for the batch processing
std::cout << "RawTherapee, version " << VERSION << std::endl;
std::cout << "RawTherapee, version " << RTVERSION << std::endl;
#ifdef WIN32
std::cout << "WARNING: closing this window will close RawTherapee!" << std::endl << std::endl;
#endif

View File

@ -46,8 +46,7 @@ Glib::ustring Options::rtdir;
Glib::ustring Options::cacheBaseDir;
Options options;
Glib::ustring versionString = VERSION;
Glib::ustring versionSuffixString = VERSION_SUFFIX;
Glib::ustring versionString = RTVERSION;
Glib::ustring paramFileExtension = ".pp3";
Options::Options ()
@ -1864,7 +1863,7 @@ int Options::saveToFile (Glib::ustring fname)
keyFile.set_string ("General", "Theme", theme);
keyFile.set_boolean ("General", "SlimUI", slimUI);
keyFile.set_boolean ("General", "UseSystemTheme", useSystemTheme);
keyFile.set_string ("General", "Version", VERSION);
keyFile.set_string ("General", "Version", RTVERSION);
keyFile.set_string ("General", "DarkFramesPath", rtSettings.darkFramesPath);
keyFile.set_string ("General", "FlatFieldsPath", rtSettings.flatFieldsPath);
keyFile.set_boolean ("General", "Verbose", rtSettings.verbose);

View File

@ -343,7 +343,6 @@ extern Glib::ustring argv0;
extern Glib::ustring argv1;
extern bool simpleEditor;
extern Glib::ustring versionString;
extern Glib::ustring versionSuffixString;
extern Glib::ustring paramFileExtension;
#endif

View File

@ -119,10 +119,6 @@ RTWindow::RTWindow ()
#endif
versionStr = "RawTherapee " + versionString;
if (!versionSuffixString.empty()) {
versionStr += " " + versionSuffixString;
}
set_title_decorated("");
property_allow_shrink() = true;
set_default_size(options.windowWidth, options.windowHeight);
@ -309,30 +305,6 @@ RTWindow::~RTWindow()
}
}
void RTWindow::findVerNumbers(int* numbers, Glib::ustring versionStr)
{
numbers[0] = numbers[1] = numbers[2] = numbers[3] = 0;
int n = 0;
for (unsigned int i = 0; i < versionStr.length(); i++) {
char chr = (char)versionStr.at(i);
if (chr >= '0' && chr <= '9') {
numbers[n] *= 10;
numbers[n] += (int)(chr - '0');
} else {
n++;
if (n > 4) {
printf("Error: malformed version string; \"%s\" must follow this format: xx.xx.xx.xx. Admitting it's a developer version...\n", versionStr.c_str());
// Reseting the already found numbers
numbers[0] = numbers[1] = numbers[2] = numbers[3] = 100;
return;
}
}
}
}
void RTWindow::on_realize ()
{
Gtk::Window::on_realize ();
@ -349,38 +321,20 @@ void RTWindow::on_realize ()
// Check if first run of this version, then display the Release Notes text
if (options.version != versionString) {
int prevVerNbr[4];
int currVerNbr[4];
findVerNumbers(prevVerNbr, options.version);
findVerNumbers(currVerNbr, versionString);
// Now we can update the version parameter with the right value
// Update the version parameter with the right value
options.version = versionString;
bool showReleaseNotes = false;
splash = new Splash (*this);
splash->set_transient_for (*this);
splash->signal_delete_event().connect( sigc::mem_fun(*this, &RTWindow::splashClosed) );
// Check if the current version is newer
if (currVerNbr[0] > prevVerNbr[0]) {
showReleaseNotes = true;
} else if (currVerNbr[1] > prevVerNbr[1]) {
showReleaseNotes = true;
} else if (currVerNbr[2] > prevVerNbr[2]) {
showReleaseNotes = true;
}
if (showReleaseNotes) {
// this is a first run!
splash = new Splash (*this);
splash->set_transient_for (*this);
splash->signal_delete_event().connect( sigc::mem_fun(*this, &RTWindow::splashClosed) );
if (splash->hasReleaseNotes()) {
splash->showReleaseNotes();
splash->show ();
} else {
delete splash;
splash = nullptr;
}
if (splash->hasReleaseNotes()) {
splash->showReleaseNotes();
splash->show ();
} else {
delete splash;
splash = nullptr;
}
}
}

View File

@ -27,7 +27,6 @@ extern Glib::ustring argv0;
extern Glib::ustring creditsPath;
extern Glib::ustring licensePath;
extern Glib::ustring versionString;
extern Glib::ustring versionSuffixString;
SplashImage::SplashImage ()
{
@ -70,10 +69,6 @@ bool SplashImage::on_expose_event (GdkEventExpose* event)
int w, h;
Glib::ustring versionStr(versionString);
if (!versionSuffixString.empty()) {
versionStr += " " + versionSuffixString;
}
version = create_pango_layout (versionStr);
version->set_markup("<span foreground=\"white\">" + versionStr + "</span>");
version->get_pixel_size (w, h);

View File

@ -4,9 +4,7 @@
#ifndef _VERSION_
#define _VERSION_
#define VERSION "${GIT_VERSION}"
#define VERSION_SUFFIX "${VERSION_SUFFIX}"
#define TAGDISTANCE ${GIT_TAGDISTANCE}
#define RTVERSION "${GIT_DESCRIBE}"
#define CACHEFOLDERNAME "RawTherapee${CACHE_NAME_SUFFIX}"
#endif

View File

@ -83,7 +83,7 @@ while getopts "bc:fnp:s:t:uvh?-" opt; do
" -s <string>" \
"Suffix of destination build directory, so that if you have applied a patch, say \"dustremoval-1.patch\", and want to have RawTherapee compiled to a folder whose name ends with \"_dustremoval1\", you would set \"-s dustremoval1\" (the underscore is automated)." "" \
" -t \"<string>\"" \
"Suffix displayed next to the RawTherapee version in the window titlebar. It is recommended that you include the changeset of the newest public commit (the one you would see if you cloned the repository anew) so it is clear which commit you applied the patches to. E.g.:" "-t \": ee72ddbcfd4e + dustremoval-1.patch + mustafa ibrahim\"" "" \
"Suffix displayed next to the RawTherapee version in the window titlebar. It is recommended that you include the commit of the newest public commit (the one you would see if you cloned the repository anew) so it is clear which commit you applied the patches to. E.g.:" "-t \": ee72ddbcfd4e + dustremoval-1.patch + mustafa ibrahim\"" "" \
" -u" \
"Check for an update of buildRT on GitHub." "" \
" -v" \
@ -193,7 +193,7 @@ if [[ ! -d "${repo}" ]]; then
currentBranch="$(git branch | grep "*" | sed -e 's/.* \+//')"
rev="$(git rev-list --all --count)"
node="$(git rev-parse --short HEAD)"
printf "\nRepository state:\n Branch: ${currentBranch}\n RawTherapee-${verLatesttag}.${verLatesttagdistance}\n Changeset: ${rev}:${node}\n Latest tag: ${verLatesttag}\n\n"
printf "\nRepository state:\n Branch: ${currentBranch}\n RawTherapee-${verLatesttag}.${verLatesttagdistance}\n Commit: ${rev}:${node}\n Latest tag: ${verLatesttag}\n\n"
alert "Repository cloned succesfully. What would you like to do next?"
printf "%b" "Repository cloned succesfully.\n" "Press 'q' to quit or any other key to continue... "
read -r -n 1
@ -239,7 +239,7 @@ verLatesttagdistance="$(git describe --tags | sed -e 's/.*-\([0-9]\+\)-.*/\1/')"
currentBranch="$(git branch | grep "*" | sed -e 's/.* \+//')"
rev="$(git rev-list --all --count)"
node="$(git rev-parse --short HEAD)"
printf "\nRepository state:\n Branch: ${currentBranch}\n RawTherapee-${verLatesttag}.${verLatesttagdistance}\n Changeset: ${rev}:${node}\n Latest tag: ${verLatesttag}\n\n"
printf "\nRepository state:\n Branch: ${currentBranch}\n RawTherapee-${verLatesttag}.${verLatesttagdistance}\n Commit: ${rev}:${node}\n Latest tag: ${verLatesttag}\n\n"
#--- Print the menu
branches=()

View File

@ -37,8 +37,8 @@ for rtDir in "${rtDirs[@]}"; do
c=1
pp3name=${pp3%.*}
pp3name=${pp3name#*/}
v+=("$(grep "Changeset:.*" "${rtDir}/AboutThisBuild.txt" | sed "s/Changeset: //")")
printf "%s\n" "Developing images using RawTherapee changeset ${v[$i]} - ${rtDir}"
v+=("$(grep "Commit:.*" "${rtDir}/AboutThisBuild.txt" | sed "s/Commit: //")")
printf "%s\n" "Developing images using RawTherapee commit ${v[$i]} - ${rtDir}"
for img in "${imgs[@]}"; do
printf "%s" "${c}/${#imgs[@]} - "
"${rtDir}rawtherapee" -o "${outDir}${img%.*}_${v[i]}_${pp3%.*}.tif" -p "${pp3}" -t -Y -c "$img" | grep Processing

View File

@ -1,12 +1,76 @@
#!/usr/bin/env bash
gitBranch="`git symbolic-ref --short -q HEAD`"
gitVersion="`git describe --tags --always`"
gitLatesttag="`echo $gitVersion | sed 's/-.*//'`"
gitLatesttagdistance="`echo $gitVersion | sed 's/.*-\(.*\)-g.*/\1/'`"
gitChangeset="`git rev-parse --verify HEAD`"
# This script is called from tools/generateSourceTarball
# It is used to generate a ReleaseInfo.cmake file with commit information which
# enables compilation without needing to have git installed.
echo "set(GIT_BRANCH $gitBranch)
set(GIT_VERSION $gitLatesttag.$gitLatesttagdistance)
set(GIT_CHANGESET $gitChangeset)
set(GIT_TAGDISTANCE $gitLatesttagdistance)" > ReleaseInfo.cmake
rm -f ReleaseInfo.cmake
# 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)"
# Get branch name.
# Will return empty if you checked out a commit or tag. Empty string handled later.
gitBranch="$(git symbolic-ref --short -q HEAD)"
# Get commit hash.
gitCommit="$(git rev-parse --short --verify HEAD)"
# Get commit date, YYYY-MM-DD.
gitCommitDate="$(git show -s --format=%cd --date=format:%Y-%m-%d)"
# 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))"
# Get number of commits since branching.
# Works when checking out branch, tag or commit.
gitCommitsSinceBranch="$(git rev-list --count HEAD --not --tags)"
if [[ -z $gitDescribe ]]; then
printf '%s\n' "Failed finding commit description, aborting."
exit 1
fi
if [[ -z $gitBranch ]]; then
printf '%s\n' "No branch found. Using commit description as branch name."
gitBranch="$gitDescribe"
fi
if [[ -z $gitCommit ]]; then
printf '%s\n' "Failed finding commit hash, aborting."
exit 1
fi
if [[ -z $gitCommitDate ]]; then
printf '%s\n' "Failed finding commit date, aborting."
exit 1
fi
# 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
cat <<EOF > ReleaseInfo.cmake
set(GIT_DESCRIBE $gitDescribe)
set(GIT_BRANCH $gitBranch)
set(GIT_COMMIT $gitCommit)
set(GIT_COMMIT_DATE $gitCommitDate)
set(GIT_COMMITS_SINCE_TAG $gitCommitsSinceTag)
set(GIT_COMMITS_SINCE_BRANCH $gitCommitsSinceBranch)
set(GIT_VERSION_NUMERIC_BS $gitVersionNumericBS)
EOF
printf '%s\n' "Git information extracted:" \
" Description: ${gitDescribe}" \
" Branch: ${gitBranch}" \
" Commit: ${gitCommit}" \
" Commit date: ${gitCommitDate}" \
" Commits since tag: ${gitCommitsSinceTag}" \
" Commits since branch: ${gitCommitsSinceBranch}" \
" Unreliable verison: ${gitVersionNumericBS}" \
""

View File

@ -1,17 +1,24 @@
#!/usr/bin/env bash
# Run from the root of the cloned repository.
# This script is used to generate a source code tarball which includes commit
# metadata so that RawTherapee can be compiled without needing to install git.
# It is meant to be used every time a release is made after creating an
# annotated tag in git.
# It is your job to checkout the tag before running this script.
if [[ ! "$1" ]]; then
printf "%s\n" "Usage: $0 <git tag>" "Example: $0 4.2"
exit
./tools/generateReleaseInfo
ret=$?
if [[ $ret -ne 0 ]]; then
printf '%s\n' "Something went wrong while running tools/generateReleaseInfo" "Aborting."
exit 1
fi
desc="$(grep GIT_DESCRIBE ReleaseInfo.cmake)" # Gets whole string: set(GIT_DESCRIBE 5.0-gtk2-1-g96bf9129)
desc="${desc#*GIT_DESCRIBE }" # Removes front: 5.0-gtk2-1-g96bf9129)
desc="${desc%)}" # Removes back: 5.0-gtk2-1-g96bf9129
git checkout "$1" || exit 0
tools/generateReleaseInfo
mkdir rawtherapee-"$1"
mv ReleaseInfo.cmake rawtherapee-"$1"
#hg archive -X ".hg*" -X "rtgui/config.h" -X "rtgui/version.h" -X "rtdata/rawtherapee.desktop" rawtherapee-"$1".tar
git archive --format=tar "$1" > rawtherapee-"$1".tar
tar --append --file=rawtherapee-"$1".tar rawtherapee-"$1"/ReleaseInfo.cmake
xz -z -9e rawtherapee-"$1".tar
rm -r rawtherapee-"$1"
git checkout
mkdir "rawtherapee-${desc}" || exit 1
mv ReleaseInfo.cmake "rawtherapee-${desc}" || exit 1
git archive --format=tar --prefix="rawtherapee-${desc}/" -o "rawtherapee-${desc}.tar" HEAD || exit 1
tar --append --file="rawtherapee-${desc}.tar" "rawtherapee-${desc}/ReleaseInfo.cmake" || exit 1
xz -z -9e "rawtherapee-${desc}.tar" || exit 1
rm -r "rawtherapee-${desc}"

View File

@ -1,30 +1,26 @@
; Script initially generated by the Inno Setup Script Wizard
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; This script has to be used by "INNO Setup" (http://www.jrsoftware.org/) to create a setup executable.
; When the "make install" process ends, you can double click on this file to load it into
; INNO Setup, then execute it to create the archive. It expect to find all the dependency libs
; in the root destination folder (the one of the 'make install' process), and the usual 'lib' directory.
; Please note that all *.dll files will be added, so be carefull on which dll are present in the directory
; before compiling the INNO Setup script.
; Script initially generated by the Inno Setup Script Wizard.
; Documentation: http://www.jrsoftware.org/ishelp/
;
; It also search for and bundles all "rawtherapee*.exe" files, which mean that you can bundle a Release and
; a Debug build at the same time (for conveniency), but official downloads must only contain the Release
; version.
; This script is used by "Inno Setup" (http://www.jrsoftware.org/) to create a
; setup executable. When the "make install" process ends, double-click on this
; file to load it into Inno Setup, then execute it to create the installer. It
; expects to find all the dependency libs in the root destination folder (the
; one from the 'make install' process), and the usual 'lib' directory.
; Note that all *.dll files will be added, so be careful which DLLs are present
; in the folder before running this script.
;
; In all cases, you have to bundle at least one file named "rawtherapee.exe", which INNO Setup will require
; as a default executable to run.
; This script searches for and bundles all "rawtherapee*.exe" files, allowing
; you to bundle a "release" as well as a "debug" version at the same time.
; At least one "rawtherapee.exe" file is required.
;
; This script is configured to check that the operating system's bit depth is the same than the executable file.
; Please note that the ia64 architecture is not supported (is it really necessary?)
; This script is configured to check that the operating system's bit depth is
; the same as that of the executable file.
;
; The IA-64 architecture is not supported.
#define MyAppName "RawTherapee"
#define MyAppVersion "${GIT_VERSION}"
#define MyAppFullVersion "${GIT_VERSION}.${GIT_TAGDISTANCE}"
#define MyAppVersion "${GIT_DESCRIBE}"
#define MyAppVersionNumeric "${GIT_NUMERIC_VERSION_BS}"
#define MyAppPublisher "rawtherapee.com"
#define MyAppURL "http://www.rawtherapee.com/"
#define MyAppExeName "rawtherapee.exe"
@ -42,18 +38,17 @@
AppId={{128459AB-59A7-430A-8BD0-3D8803D50400}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion={#MyAppFullVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
VersionInfoVersion={#MyAppVersionNumeric}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}-{#MyAppFullVersion}
DefaultGroupName={#MyAppName} {#MyAppFullVersion}
DefaultDirName={pf}\{#MyAppName}\{#MyAppVersion}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile={#MyBuildBasePath}\LICENSE.txt
OutputDir={#MyBuildBasePath}\..\
OutputBaseFilename={#MyAppName}_{#MySystemName}_{#MyBitDepth}_{#MyAppFullVersion}
OutputBaseFilename={#MyAppName}_{#MyAppVersion}_{#MySystemName}_{#MyBitDepth}
SetupIconFile={#MySourceBasePath}\rtdata\icons\RT.ico
WizardImageFile={#MySourceBasePath}\tools\win\InnoSetup\installerStrip.bmp
WizardImageBackColor=$2A2A2A
@ -97,7 +92,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "{#MyBuildBasePath}\rawtherapee.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyBuildBasePath}\rawtherapee*.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyBuildBasePath}\camconst.json"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyBuildBasePath}\dcpprofiles\*"; DestDir: "{app}\dcpprofiles\"; Flags: ignoreversion recursesubdirs createallsubdirs
;Source: "{#MyBuildBasePath}\etc\*"; DestDir: "{app}\etc\"; Flags: ignoreversion recursesubdirs createallsubdirs
@ -122,11 +117,11 @@ Source: "{#MyBuildBasePath}\fonts\DroidSansMonoSlashed.ttf"; DestDir: "{fonts}";
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName} {#MyAppFullVersion}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}{#MyAppFullVersion}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName} {#MyAppFullVersion}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
Name: "{commondesktop}\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

View File

@ -22,9 +22,6 @@ set(CACHE_NAME_SUFFIX "" CACHE STRING "RawTherapee's cache folder suffix (leave
# This line will let you chose the target number, and the associated processor
set(PROC_TARGET_NUMBER 0 CACHE STRING "Target Processor")
# To add a version suffix (text) after the standard version number, e.g. for patched builds
set(VERSION_SUFFIX "" CACHE STRING "For patched builds, use this string to add a version suffix (text); KEEP EMPTY FOR RELEASE BULDS")
# If you want to force the target processor name when PROC_TARGET_NUMBER = 0 or 2,
# uncomment the next line and replace labelWithoutQuotes by its value
#set (PROC_LABEL labelWithoutQuotes CACHE STRING "Target Processor label")