From ee831d045cb1ac8a55ecf87d676b972c9186e343 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Wed, 30 Aug 2023 00:00:28 +0300 Subject: [PATCH] Make jack_get_version_string() return libjackserver.so.0 mtime --- common/JackAPI.cpp | 20 +++++++++++++++++++- wscript | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index 07ee4c1b..a788b599 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "JackPortType.h" #include #include "version.h" +#include // stat() using namespace Jack; @@ -1901,10 +1902,27 @@ LIB_EXPORT void jack_get_version(int *major_ptr, *proto_ptr = 0; } +#define JACK_VERSION_STR JACK_VERSION " built from " GIT_VERSION " built on " +#define JACK_VERSION_FULL_STR JACK_VERSION_STR "0123456789" "0123456789" "012345" + LIB_EXPORT const char* jack_get_version_string() { + struct stat st; + static char version_str[] = JACK_VERSION_FULL_STR; + static char * timestamp_str = NULL; + + if (timestamp_str == NULL) + { + timestamp_str = version_str + sizeof(JACK_VERSION_STR) - 1; + + st.st_mtime = 0; + stat(LIBDIR "/libjackserver.so.0", &st); + ctime_r(&st.st_mtime, timestamp_str); + timestamp_str[24] = 0; + } + JackGlobals::CheckContext("jack_get_version_string"); - return JACK_VERSION " built from " GIT_VERSION; + return version_str; } LIB_EXPORT void jack_free(void* ptr) diff --git a/wscript b/wscript index 28fb154c..c86a5cf1 100644 --- a/wscript +++ b/wscript @@ -373,6 +373,7 @@ def configure(conf): conf.env['AUTOSTART_METHOD'] = Options.options.autostart conf.define('JACK_VERSION', VERSION) + conf.define('LIBDIR', conf.env['LIBDIR']) if conf.env['AUTOSTART_METHOD'] == 'dbus': conf.define('USE_LIBDBUS_AUTOLAUNCH', 1)