diff options
-rwxr-xr-x | CMakeLists.txt | 3 | ||||
-rwxr-xr-x | cmake/version.cmake | 68 | ||||
-rw-r--r-- | config.h.in (renamed from config.h.cmake) | 7 | ||||
-rw-r--r-- | navit/CMakeLists.txt | 9 | ||||
-rw-r--r-- | navit/android/CMakeLists.txt | 1 | ||||
-rw-r--r-- | navit/autoload/osso/osso.c | 4 | ||||
-rw-r--r-- | navit/file.c | 5 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_command.c | 4 | ||||
-rw-r--r-- | navit/gui/internal/gui_internal_menu.c | 3 | ||||
-rw-r--r-- | navit/start_real.c | 4 | ||||
-rw-r--r-- | navit/version.h.in | 2 |
11 files changed, 15 insertions, 95 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 847ef1548..950314e72 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -799,7 +799,8 @@ CHECK_FUNCTION_EXISTS (posix_memalign HAVE_POSIX_MEMALIGN) CHECK_FUNCTION_EXISTS (popen HAVE_POPEN) CHECK_FUNCTION_EXISTS (_atoi64 HAVE__ATOI64) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/config.h" ) # Compile with -Wall -Wextra. We need all the help we can get from the compiler :-). # Disabled warnings: diff --git a/cmake/version.cmake b/cmake/version.cmake deleted file mode 100755 index 0dd520a45..000000000 --- a/cmake/version.cmake +++ /dev/null @@ -1,68 +0,0 @@ -FIND_PROGRAM(GIT_EXECUTABLE NAMES git git.exe DOC "git command line client") -FIND_PROGRAM(DATE_EXECUTABLE NAMES date DOC "unix date command") - -get_filename_component(SOURCE_DIR ${SRC} PATH) - -if (GIT_EXECUTABLE) - EXECUTE_PROCESS( - COMMAND ${GIT_EXECUTABLE} log "--format=%ct" # output as unix timestamp - WORKING_DIRECTORY "${SOURCE_DIR}" - OUTPUT_VARIABLE GIT_OUTPUT_DATE - ERROR_VARIABLE GIT_ERROR - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - if(GIT_ERROR) - message(STATUS "Cannot determine current git commit - git error: '${GIT_ERROR}'") - set(GIT_OUTPUT_DATE "0000000000") - endif(GIT_ERROR) - EXECUTE_PROCESS( - COMMAND ${GIT_EXECUTABLE} log "--format='%h'" - WORKING_DIRECTORY "${SOURCE_DIR}" - OUTPUT_VARIABLE GIT_OUTPUT_HASH - ERROR_VARIABLE GIT_ERROR_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - if(GIT_ERROR_HASH) - message(STATUS "Cannot determine current git hash - git error: '${GIT_ERROR}'") - set(GIT_OUTPUT_HASH "xdevxgitxnotxfound") - endif(GIT_ERROR_HASH) -else() - message(STATUS "git not found, cannot record git commit") - set(GIT_OUTPUT_DATE "0000000000") # To match length of android versionCode - set(GIT_OUTPUT_HASH "xdevxgitxnotxfound") -endif(GIT_EXECUTABLE) - -string(REGEX MATCH "^[0-9]+" VERSION_NUM ${GIT_OUTPUT_DATE} ) - -set(VERSION ${GIT_OUTPUT_HASH}) - -EXECUTE_PROCESS( - COMMAND ${DATE_EXECUTABLE} "+%y%m%d%H%M" "-d \@${VERSION_NUM}" # output as unix timestamp - WORKING_DIRECTORY "${SOURCE_DIR}" - OUTPUT_VARIABLE DATE_CONVERT_OUTPUT - ERROR_VARIABLE DATE_CONVERT_ERROR - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE -) -if(NOT DATE_CONVERT_ERROR) - string(REGEX MATCH "[0-9]+" VERSION_CODE "${DATE_CONVERT_OUTPUT}") -else(NOT DATE_CONVERT_ERROR) - message(FATAL_ERROR "Date convert not working\nError message:\n${DATE_CONVERT_ERROR}") -endif(NOT DATE_CONVERT_ERROR) - -string(REGEX MATCH "[a-z0-9]+" VERSION ${GIT_OUTPUT_HASH} ) - -if (STRIP_M) - set(VERSION ${VERSION_CODE}) -endif() - -set(NAVIT_VARIANT "-") -set(GIT_VERSION VERSION) - -set(${NAME} ${VERSION}) - -message (STATUS "Git commit: ${VERSION}") -message (STATUS "Git date: ${VERSION_CODE}") -CONFIGURE_FILE(${SRC} ${DST} @ONLY) diff --git a/config.h.cmake b/config.h.in index c759e69c1..1bbbf782a 100644 --- a/config.h.cmake +++ b/config.h.in @@ -16,10 +16,17 @@ #cmakedefine USE_LIBGNUINTL 1 #cmakedefine HAVE_BYTESWAP_H 1 /* Versions */ +#cmakedefine GIT_VERSION "@GIT_VERSION@" +#ifndef GIT_VERSION +#define GIT_VERSION "xdevxgitxnotxfound" +#endif + +#define NAVIT_VARIANT "-" #cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" #cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" #cmakedefine PACKAGE "@PACKAGE@" #cmakedefine LOCALEDIR "@LOCALEDIR@" +#define NAVIT_VERSION PACKAGE_VERSION "+git:" GIT_VERSION NAVIT_VARIANT #cmakedefine HAVE_ZLIB 1 diff --git a/navit/CMakeLists.txt b/navit/CMakeLists.txt index ca19ce41d..9772d4cb8 100644 --- a/navit/CMakeLists.txt +++ b/navit/CMakeLists.txt @@ -109,14 +109,6 @@ if (DEFINED NAVIT_COMPILE_FLAGS) set_target_properties(${NAVIT_LIBNAME} PROPERTIES COMPILE_FLAGS "${NAVIT_COMPILE_FLAGS}") endif() -ADD_CUSTOM_TARGET( - git_version - ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/version.h.in - -D DST=${CMAKE_CURRENT_BINARY_DIR}/version.h - -D NAME="GIT_VERSION" - -P ${PROJECT_SOURCE_DIR}/cmake/version.cmake - ) - add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/navit.dtd" COMMENT "Copy navit.dtd to ${CMAKE_CURRENT_BINARY_DIR}/navit.dtd" @@ -216,7 +208,6 @@ else() add_custom_target( navit_config_xml ALL DEPENDS ${XMLCFG_OUTPUT_LIST}) endif() -ADD_DEPENDENCIES(${NAVIT_LIBNAME} git_version) if (USE_LIBGNUINTL AND NOT HAVE_GLIB) ADD_DEPENDENCIES(support_glib support_gettext_intl) endif() diff --git a/navit/android/CMakeLists.txt b/navit/android/CMakeLists.txt index 91a4b29e7..64bd47f8e 100644 --- a/navit/android/CMakeLists.txt +++ b/navit/android/CMakeLists.txt @@ -35,7 +35,6 @@ if (ANDROID AND NOT ${CMAKE_GENERATOR} STREQUAL Ninja) -D ANDROID_API_VERSION=${ANDROID_API_VERSION} -D ANDROID_PERMISSIONS:string="${ANDROID_PERMISSIONS_EXPANDED}" -D STRIP_M="1" - -P ${PROJECT_SOURCE_DIR}/cmake/version.cmake ) add_custom_command ( diff --git a/navit/autoload/osso/osso.c b/navit/autoload/osso/osso.c index 033c76a7a..b94657569 100644 --- a/navit/autoload/osso/osso.c +++ b/navit/autoload/osso/osso.c @@ -12,8 +12,6 @@ static osso_context_t *osso_context; static struct attr callback = { attr_callback }; -extern char *version; - struct cb_hw_state_trail { struct navit* nav; osso_hw_state_t *state; @@ -62,7 +60,7 @@ static void osso_cb_hw_state(osso_hw_state_t * state, gpointer data) { static void osso_navit(struct navit *nav, int add) { dbg(lvl_debug, "Installing osso context for org.navit_project.navit"); - osso_context = osso_initialize("org.navit_project.navit", version, TRUE, NULL); + osso_context = osso_initialize("org.navit_project.navit", NAVIT_VERSION, TRUE, NULL); if (osso_context == NULL) { dbg(lvl_error, "error initiating osso context"); } diff --git a/navit/file.c b/navit/file.c index 4d7f226f8..8d0365499 100644 --- a/navit/file.c +++ b/navit/file.c @@ -44,8 +44,6 @@ #include <netdb.h> #endif -extern char *version; - #ifdef CACHE_SIZE static GHashTable *file_name_hash; #endif @@ -98,7 +96,8 @@ static int file_socket_connect(char *host, char *service) { } static void file_http_request(struct file *file, char *method, char *host, char *path, char *header, int persistent) { - char *request=g_strdup_printf("%s %s HTTP/1.0\r\nUser-Agent: navit %s\r\nHost: %s\r\n%s%s%s\r\n",method,path,version, + char *request=g_strdup_printf("%s %s HTTP/1.0\r\nUser-Agent: navit %s\r\nHost: %s\r\n%s%s%s\r\n",method,path, + NAVIT_VERSION, host,persistent?"Connection: Keep-Alive\r\n":"",header?header:"",header?"\r\n":""); write(file->fd, request, strlen(request)); dbg(lvl_debug,"%s",request); diff --git a/navit/gui/internal/gui_internal_command.c b/navit/gui/internal/gui_internal_command.c index acf250408..011d78908 100644 --- a/navit/gui/internal/gui_internal_command.c +++ b/navit/gui/internal/gui_internal_command.c @@ -41,8 +41,6 @@ #include <arpa/inet.h> #endif -extern char *version; - /** * @brief Converts a WGS84 coordinate pair to its string representation. * @@ -198,7 +196,7 @@ static void gui_internal_cmd2_about(struct gui_priv *this, char *function, struc g_free(text); //Version - text=g_strdup_printf("%s",version); + text=g_strdup_printf("%s",NAVIT_VERSION); gui_internal_widget_append(wb, w=gui_internal_label_new(this, text)); w->flags=gravity_top_center|orientation_horizontal|flags_expand; g_free(text); diff --git a/navit/gui/internal/gui_internal_menu.c b/navit/gui/internal/gui_internal_menu.c index 6a0d6a52b..3caae2800 100644 --- a/navit/gui/internal/gui_internal_menu.c +++ b/navit/gui/internal/gui_internal_menu.c @@ -15,7 +15,6 @@ #include "gui_internal_search.h" #include "gui_internal_menu.h" -extern char *version; /** * @brief Utility function to check if a menu widget is adapted to the display size or needs resizing (if so, the widget dimensions will be set to match those of the display @@ -486,7 +485,7 @@ gui_internal_top_bar(struct gui_priv *this) { l=g_list_next(l); } if (this->flags & 32) { - char *version_text=g_strdup_printf("Navit %s",version); + char *version_text=g_strdup_printf("Navit %s",NAVIT_VERSION); wcn=gui_internal_label_new(this, version_text); g_free(version_text); wcn->flags=gravity_right_center|flags_expand; diff --git a/navit/start_real.c b/navit/start_real.c index b7a0db48c..ad990d874 100644 --- a/navit/start_real.c +++ b/navit/start_real.c @@ -27,7 +27,6 @@ #include <XGetopt.h> #endif #include "config_.h" -#include "version.h" #include "item.h" #include "coord.h" #include "main.h" @@ -52,7 +51,6 @@ #include <winbase.h> #endif -char *version=PACKAGE_VERSION"+git:"GIT_VERSION""NAVIT_VARIANT; int main_argc; char * const* main_argv; @@ -128,7 +126,7 @@ int main_real(int argc, char * const* argv) { exit(0); break; case 'v': - printf("%s %s\n", "navit", version); + printf("%s %s\n", "navit", NAVIT_VERSION); exit(0); break; case 'c': diff --git a/navit/version.h.in b/navit/version.h.in deleted file mode 100644 index 3c39d0e1f..000000000 --- a/navit/version.h.in +++ /dev/null @@ -1,2 +0,0 @@ -#cmakedefine GIT_VERSION "@GIT_VERSION@" -#cmakedefine NAVIT_VARIANT "@NAVIT_VARIANT@" |