Restore display of source sha-1 in jackdbus log

This commit changes build info to display info about jackdbus itself,
along with libjackserver.so provided build info

Fixes https://github.com/LADI/jackdbus/issues/1
This commit is contained in:
Nedko Arnaudov 2023-04-18 21:43:20 +03:00
parent c685e29dc7
commit 005535b799
3 changed files with 48 additions and 11 deletions

View File

@ -35,6 +35,7 @@
#include <unistd.h> #include <unistd.h>
#include "config.h" #include "config.h"
#include "version.h"
#include "jackdbus.h" #include "jackdbus.h"
#include "controller.h" #include "controller.h"
@ -899,7 +900,9 @@ main (int argc, char **argv)
setup_sigsegv(); setup_sigsegv();
jack_info("------------------"); jack_info("------------------");
jack_info("Controller activated. Version %s (%s) built on %s", jack_get_version_string(), JACK_VERSION, timestamp_str); jack_info("jackdbus version %s built from %s on %s", JACK_VERSION, GIT_VERSION, timestamp_str);
jack_info("JACK server version %s", jack_get_version_string());
jack_info("jackdbus controller activated.");
if (!dbus_threads_init_default()) if (!dbus_threads_init_default())
{ {

View File

@ -33,8 +33,6 @@ def options(opt):
def configure(conf): def configure(conf):
conf.define('JACK_VERSION', conf.env['JACK_VERSION'])
if not conf.check_cfg(package='dbus-1 >= 1.0.0', args='--cflags --libs', mandatory=False): if not conf.check_cfg(package='dbus-1 >= 1.0.0', args='--cflags --libs', mandatory=False):
print( print(
Logs.colors.RED + 'ERROR !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL Logs.colors.RED + 'ERROR !! jackdbus will not be built because libdbus-dev is missing' + Logs.colors.NORMAL

52
wscript
View File

@ -25,12 +25,11 @@ import shutil
import sys import sys
from waflib import Logs, Options, TaskGen from waflib import Logs, Options, TaskGen
from waflib import Context
from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
# see also common/JackConstants.h VERSION = "2.22.1"
VERSION = '2.22' APPNAME = 'jackdbus'
APPNAME = 'jack'
JACK_API_VERSION = '0.1.0'
# these variables are mandatory ('/' are converted automatically) # these variables are mandatory ('/' are converted automatically)
top = '.' top = '.'
@ -155,14 +154,11 @@ def configure(conf):
conf.load('autooptions') conf.load('autooptions')
conf.recurse('dbus')
conf.env['LIB_PTHREAD'] = ['pthread'] conf.env['LIB_PTHREAD'] = ['pthread']
conf.env['LIB_DL'] = ['dl'] conf.env['LIB_DL'] = ['dl']
conf.env['LIB_RT'] = ['rt'] conf.env['LIB_RT'] = ['rt']
conf.env['LIB_M'] = ['m'] conf.env['LIB_M'] = ['m']
conf.env['LIB_STDC++'] = ['stdc++'] conf.env['LIB_STDC++'] = ['stdc++']
conf.env['JACK_API_VERSION'] = JACK_API_VERSION
conf.env['JACK_VERSION'] = VERSION conf.env['JACK_VERSION'] = VERSION
conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin' conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin'
@ -194,10 +190,21 @@ def configure(conf):
conf.env.append_unique('CFLAGS', '-g') conf.env.append_unique('CFLAGS', '-g')
conf.env.append_unique('LINKFLAGS', '-g') conf.env.append_unique('LINKFLAGS', '-g')
conf.define('JACK_VERSION', conf.env['JACK_VERSION'])
conf.write_config_header('config.h', remove=False) conf.write_config_header('config.h', remove=False)
conf.recurse('dbus')
print() print()
print('LADI JACK ' + VERSION) version_msg = APPNAME + "-" + VERSION
if os.access('version.h', os.R_OK):
data = open('version.h').read()
m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
if m != None:
version_msg += " exported from " + m.group(1)
elif os.access('.git', os.R_OK):
version_msg += " git revision will be checked and eventually updated during build"
print(version_msg)
conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN') conf.msg('Install prefix', conf.env['PREFIX'], color='CYAN')
conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN') conf.msg('Library directory', conf.all_envs['']['LIBDIR'], color='CYAN')
@ -234,8 +241,37 @@ def configure(conf):
print(Logs.colors.NORMAL, end=' ') print(Logs.colors.NORMAL, end=' ')
print() print()
def git_ver(self):
bld = self.generator.bld
header = self.outputs[0].abspath()
if os.access('./version.h', os.R_OK):
header = os.path.join(os.getcwd(), out, "version.h")
shutil.copy('./version.h', header)
data = open(header).read()
m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
if m != None:
self.ver = m.group(1)
Logs.pprint('BLUE', "tarball from git revision " + self.ver)
else:
self.ver = "tarball"
return
if bld.srcnode.find_node('.git'):
self.ver = bld.cmd_and_log("LANG= git rev-parse HEAD", quiet=Context.BOTH).splitlines()[0]
if bld.cmd_and_log("LANG= git diff-index --name-only HEAD", quiet=Context.BOTH).splitlines():
self.ver += "-dirty"
Logs.pprint('BLUE', "git revision " + self.ver)
else:
self.ver = "unknown"
fi = open(header, 'w')
fi.write('#define GIT_VERSION "%s"\n' % self.ver)
fi.close()
def build(bld): def build(bld):
bld(rule=git_ver, target='version.h', update_outputs=True, always=True, ext_out=['.h'])
# process subfolders from here # process subfolders from here
if bld.env['IS_LINUX'] or bld.env['IS_FREEBSD']: if bld.env['IS_LINUX'] or bld.env['IS_FREEBSD']: