From 9206a60e8840ce9c7e3877f2fd07b03fbb5e0904 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 22 Jun 2008 16:59:56 +0200 Subject: [PATCH] cmake: consolidate version strings --- awesome-version-internal.h.in | 2 +- awesomeConfig.cmake | 2 +- common/version.c | 11 ++++++++++- common/version.h | 1 + config.h.in | 2 -- lua.c | 3 ++- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/awesome-version-internal.h.in b/awesome-version-internal.h.in index 4157088f..85d23b7c 100644 --- a/awesome-version-internal.h.in +++ b/awesome-version-internal.h.in @@ -1,7 +1,7 @@ #ifndef _AWE_VERSION_INTERNAL_H_ #define _AWE_VERSION_INTERNAL_H_ -#define AWESOME_VERSION_INTERNAL "@AWESOME_VERSION_INTERNAL@" +#define AWESOME_VERSION "@AWESOME_VERSION@" #define AWESOME_COMPILE_MACHINE "@AWESOME_COMPILE_MACHINE@" #define AWESOME_COMPILE_BY "@AWESOME_COMPILE_BY@" #define AWESOME_COMPILE_HOSTNAME "@AWESOME_COMPILE_HOSTNAME@" diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index ebe34104..858fe35d 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -161,7 +161,7 @@ ENDIF() IF(DEFINED PREFIX) SET(CMAKE_INSTALL_PREFIX ${PREFIX}) ENDIF() -SET(AWESOME_VERSION_INTERNAL devel ) +SET(AWESOME_VERSION ${VERSION} ) SET(AWESOME_COMPILE_MACHINE ${CMAKE_SYSTEM_PROCESSOR} ) SET(AWESOME_COMPILE_HOSTNAME $ENV{HOSTNAME} ) SET(AWESOME_COMPILE_BY $ENV{USER} ) diff --git a/common/version.c b/common/version.c index 50cb72cc..38f3f527 100644 --- a/common/version.c +++ b/common/version.c @@ -32,7 +32,7 @@ void eprint_version(const char *const executable) { - printf("%s (awesome) " AWESOME_VERSION_INTERNAL + printf("%s (awesome) " AWESOME_VERSION " (" AWESOME_RELEASE ")\n" "built", executable); @@ -50,4 +50,13 @@ eprint_version(const char *const executable) exit(EXIT_SUCCESS); } +/** Get version string. + * \return A string describing the current version. + */ +const char* +version_string(void) +{ + return AWESOME_VERSION; +} + // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/common/version.h b/common/version.h index d6c1ad5d..4445a671 100644 --- a/common/version.h +++ b/common/version.h @@ -23,5 +23,6 @@ #define AWESOME_COMMON_VERSION_H void eprint_version(const char *const executable) __attribute__ ((noreturn)); +const char *version_string(void); #endif diff --git a/config.h.in b/config.h.in index 64b99320..41e50aff 100644 --- a/config.h.in +++ b/config.h.in @@ -1,10 +1,8 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ -#define AWESOME_RELEASE "@AWESOME_RELEASE@" #define AWESOME_LUA_LIB_PATH "@AWESOME_LUA_LIB_PATH@" #define AWESOME_CONF_PATH "@AWESOME_CONF_PATH@" -#define VERSION "@VERSION@" #cmakedefine WITH_DBUS #cmakedefine WITH_IMLIB2 diff --git a/lua.c b/lua.c index 9cdb6e57..47786622 100644 --- a/lua.c +++ b/lua.c @@ -45,6 +45,7 @@ #include "screen.h" #include "layouts/tile.h" #include "common/socket.h" +#include "common/version.h" extern awesome_t globalconf; @@ -540,7 +541,7 @@ luaA_init(void) luaA_openlib(L, "keybinding", awesome_keybinding_methods, awesome_keybinding_meta); lua_pushliteral(L, "AWESOME_VERSION"); - lua_pushliteral(L, VERSION); + lua_pushstring(L, version_string()); lua_settable(L, LUA_GLOBALSINDEX); luaA_dostring(L, "package.path = package.path .. \";" AWESOME_LUA_LIB_PATH "/?.lua\"");