version: Remove the build date and unify version string.

Users want to know what sources their software was built from, not the
date it was built at.  Also make the version string a single thing,
which makes it easier to handle the following two scenarios:

1. Development build.  The version is set to the git hash, which
should communicate this clearly enough.

2. Release build.  The version is whatever we choose to be, currently
something like "20210606.1.e2f9490", which already includes
the (super-project) git hash information.

* CMakeLists.txt (CLIENT_BUILD_DATE): Remove variable.
(PROJECT_VERSION): Set it to either the manually specified string or
to the Git hash.  Print a warning in case it is not found.
(git_revision): Remove target.
* src/dialogs.cpp (about_dialog): Adjust the displayed version
information.
* src/client_options.c (option_version_cb): Likewise.
* src/client.cpp (client_startup): Only print VERSION; remove
CLIENT_REVISION.
* cmake/GitRevision.cmake: Likewise.
* src/revision.h.in: Delete file.

Change-Id: If893b5781ddf7acf54dabdaab37f27f8b87a9ea1
parent 8c92c7a6
......@@ -13,30 +13,8 @@ ENDIF()
set (CMAKE_CXX_STANDARD 17)
# set project name and version
PROJECT(jami-client-gnome)
IF(EXISTS "${PROJECT_SOURCE_DIR}/version.txt")
FILE (STRINGS "version.txt" PROJECT_VERSION)
ELSE()
SET (PROJECT_VERSION "development")
ENDIF()
# set build date
IF( NOT ("$ENV{SOURCE_DATE_EPOCH}" STREQUAL ""))
EXECUTE_PROCESS(
COMMAND date -u -d "1970-01-01 UTC $ENV{SOURCE_DATE_EPOCH} seconds" "+%Y-%m-%d %H:%M:%S UTC"
OUTPUT_VARIABLE CLIENT_BUILD_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
ELSEIF( "${CLIENT_BUILD_DATE}" STREQUAL "")
EXECUTE_PROCESS(
COMMAND date -u "+%Y-%m-%d %H:%M:%S UTC"
OUTPUT_VARIABLE CLIENT_BUILD_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
ENDIF()
# add the binary tree to the search path for include files
# so that we will find config.h
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
......@@ -47,6 +25,23 @@ LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/GResources.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/GSettings.cmake)
# Set VERSION.
IF(EXISTS "${PROJECT_SOURCE_DIR}/version.txt")
FILE (STRINGS "version.txt" PROJECT_VERSION)
ELSE()
FIND_PACKAGE(Git)
IF(GIT_FOUND)
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
OUTPUT_VARIABLE PROJECT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()
ENDIF()
IF("${PROJECT_VERSION}" STREQUAL "")
SET(PROJECT_VERSION "unknown")
MESSAGE(WARNING "Failed to retrieve version information")
ENDIF()
# make sure we're using Qt5
SET(ENABLE_QT5 true)
......@@ -248,25 +243,6 @@ IF (CMAKE_COMPILER_IS_GNUCC)
ENDIF()
# get git version on every build
SET(GIT_REVISION_INPUT_FILE ${PROJECT_SOURCE_DIR}/src/revision.h.in)
SET(GIT_REVISION_OUTPUT_FILE ${PROJECT_BINARY_DIR}/revision.h)
ADD_CUSTOM_TARGET(
git_revision ALL
COMMAND ${CMAKE_COMMAND}
-DGIT_REVISION_INPUT_FILE=${GIT_REVISION_INPUT_FILE}
-DGIT_REVISION_OUTPUT_FILE=${GIT_REVISION_OUTPUT_FILE}
-DCLIENT_BUILD_DATE=${CLIENT_BUILD_DATE}
-P ${CMAKE_SOURCE_DIR}/cmake/GitRevision.cmake
COMMENT "generating ${GIT_REVISION_OUTPUT_FILE}"
)
ADD_CUSTOM_COMMAND(
OUTPUT ${GIT_REVISION_OUTPUT_FILE}
DEPENDS git_revision
)
# source files to compile
SET( SRC_FILES
src/main.cpp
......
# Copyright (C) 2015-2016 Savoir-faire Linux Inc.
# Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
FIND_PACKAGE(Git)
IF(GIT_FOUND)
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
OUTPUT_VARIABLE CLIENT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
ENDIF()
IF( "${CLIENT_REVISION}" STREQUAL "")
SET(CLIENT_REVISION "unknown")
ENDIF()
MESSAGE( STATUS "GIT_REVISION_INPUT_FILE: " ${GIT_REVISION_INPUT_FILE} )
MESSAGE( STATUS "GIT_REVISION_OUTPUT_FILE: " ${GIT_REVISION_OUTPUT_FILE} )
# generate revision.h file
CONFIGURE_FILE (
${GIT_REVISION_INPUT_FILE}
${GIT_REVISION_OUTPUT_FILE}
)
......@@ -49,7 +49,6 @@
#include "notifier.h"
#include "config.h"
#include "utils/files.h"
#include "revision.h"
#if HAVE_AYATANAAPPINDICATOR
#include <libayatana-appindicator/app-indicator.h>
......@@ -491,7 +490,6 @@ client_startup(GApplication *app)
ClientPrivate *priv = CLIENT_GET_PRIVATE(client);
g_message("Jami GNOME client version: %s", VERSION);
g_message("git ref: %s", CLIENT_REVISION);
/* make sure that the system corresponds to the autostart setting */
autostart_symlink(g_settings_get_boolean(priv->settings, "start-on-login"));
......
......@@ -21,7 +21,6 @@
#include "client_options.h"
#include "config.h"
#include "revision.h"
#include "client.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
......@@ -33,7 +32,7 @@ option_version_cb(G_GNUC_UNUSED const gchar *option_name,
G_GNUC_UNUSED gpointer data,
G_GNUC_UNUSED GError **error)
{
g_print("%s - %s\n", VERSION, CLIENT_REVISION);
g_print("%s\n", VERSION);
exit(EXIT_SUCCESS);
}
......
......@@ -17,12 +17,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h" // for VERSION
#include "dialogs.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
#include "revision.h"
#include "utils/drawing.h"
void
......@@ -58,10 +58,9 @@ about_dialog(GtkWidget *parent)
if (parent && GTK_IS_WIDGET(parent))
parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
gchar *version = g_strdup_printf(C_("Do not translate the release name nor the status (beta, final, ...)",
"\"%s\"\nbuilt on %.25s"),
"Maloya",
CLIENT_BUILD_DATE);
gchar *version = g_strdup_printf(
C_("Do not translate the release name nor the status (beta, final, ...)",
"\"%s\"\n(%s)"), "Maloya", VERSION);
const gchar *authors[] = {
"Adrien Béraud",
......
/* cmake will generate revision.h with a define containing the git revision (if found) */
#define CLIENT_REVISION "@CLIENT_REVISION@"
#define CLIENT_BUILD_DATE "@CLIENT_BUILD_DATE@"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment