mirror of
https://github.com/yshui/picom.git
synced 2025-02-10 15:45:57 -05:00
misc: print better versions
Print both version number and git commit hash, not just one of either. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
ecc3dc3bf5
commit
6a678cb4a1
5 changed files with 51 additions and 23 deletions
|
@ -2,18 +2,32 @@ mans = ['picom.1', 'picom-inspect.1', 'picom-trans.1']
|
|||
if get_option('with_docs')
|
||||
a2x = find_program('asciidoctor')
|
||||
foreach m : mans
|
||||
custom_target(m, output: [m], input: [m+'.adoc'],
|
||||
command: [a2x, '-a',
|
||||
'picom-version='+version,
|
||||
'--backend', 'manpage', '@INPUT@', '-D',
|
||||
meson.current_build_dir()],
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('mandir'), 'man1'))
|
||||
custom_target(m+'.html', output: [m+'.html'], input: [m+'.adoc'],
|
||||
command: [a2x, '-a',
|
||||
'picom-version='+version,
|
||||
'--backend', 'html', '@INPUT@', '-D',
|
||||
meson.current_build_dir()],
|
||||
install_dir: get_option('datadir') / 'doc' / 'picom')
|
||||
custom_target(
|
||||
m,
|
||||
output: [m],
|
||||
input: [m + '.adoc'],
|
||||
command: [
|
||||
a2x,
|
||||
'-a', 'picom-version=v' + meson.project_version(),
|
||||
'--backend', 'manpage',
|
||||
'@INPUT@',
|
||||
'-D', meson.current_build_dir(),
|
||||
],
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('mandir'), 'man1'),
|
||||
)
|
||||
custom_target(
|
||||
m + '.html',
|
||||
output: [m + '.html'],
|
||||
input: [m + '.adoc'],
|
||||
command: [
|
||||
a2x,
|
||||
'-a', 'picom-version=v' + meson.project_version(),
|
||||
'--backend', 'html',
|
||||
'@INPUT@',
|
||||
'-D', meson.current_build_dir(),
|
||||
],
|
||||
install_dir: get_option('datadir') / 'doc' / 'picom',
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
|
26
meson.build
26
meson.build
|
@ -3,19 +3,33 @@ project('picom', 'c', version: '11',
|
|||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
# use project version by default
|
||||
version = 'v'+meson.project_version()
|
||||
|
||||
# use git describe if that's available
|
||||
git = find_program('git', required: false)
|
||||
if git.found()
|
||||
gitv = run_command('git', 'rev-parse', '--short=5', 'HEAD', check: false)
|
||||
gitv = run_command('git', 'rev-parse', '--short=7', 'HEAD', check: false)
|
||||
if gitv.returncode() == 0
|
||||
version = 'vgit-'+gitv.stdout().strip()
|
||||
commit_hash_short = gitv.stdout().strip()
|
||||
endif
|
||||
git_upstream = run_command('git', 'rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}', check: false)
|
||||
if git_upstream.returncode() == 0
|
||||
remote = git_upstream.stdout().strip().split('/')[0]
|
||||
else
|
||||
remote = 'origin'
|
||||
endif
|
||||
git_repository = run_command('git', 'remote', 'get-url', remote, check: false)
|
||||
if git_repository.returncode() == 0
|
||||
repository = git_repository.stdout().strip()
|
||||
endif
|
||||
endif
|
||||
|
||||
add_global_arguments('-DPICOM_VERSION="'+version+'"', language: 'c')
|
||||
add_global_arguments('-DPICOM_VERSION="v'+meson.project_version()+'"', language: 'c')
|
||||
if is_variable('repository')
|
||||
add_global_arguments('-DPICOM_FULL_VERSION="v'+meson.project_version()+' ('+repository+' revision '+commit_hash_short+')"', language: 'c')
|
||||
elif is_variable('commit_hash_short')
|
||||
add_global_arguments('-DPICOM_FULL_VERSION="v'+meson.project_version()+' (revision '+commit_hash_short+')"', language: 'c')
|
||||
else
|
||||
add_global_arguments('-DPICOM_FULL_VERSION="v'+meson.project_version()+'"', language: 'c')
|
||||
endif
|
||||
|
||||
if get_option('buildtype') == 'release'
|
||||
add_global_arguments('-DNDEBUG', language: 'c')
|
||||
|
|
|
@ -919,7 +919,7 @@ cdbus_process_opts_get(session_t *ps, DBusMessage *msg, DBusMessage *reply, DBus
|
|||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
}
|
||||
|
||||
append(version, string, PICOM_VERSION);
|
||||
append(version, string, PICOM_FULL_VERSION);
|
||||
append(pid, int32, getpid());
|
||||
append(display, string, DisplayString(ps->c.dpy));
|
||||
append(config_file, string, "Unknown");
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "picom.h"
|
||||
|
||||
void print_diagnostics(session_t *ps, const char *config_file, bool compositor_running) {
|
||||
printf("**Version:** " PICOM_VERSION "\n");
|
||||
printf("**Version:** " PICOM_FULL_VERSION "\n");
|
||||
// printf("**CFLAGS:** %s\n", "??");
|
||||
printf("\n### Extensions:\n\n");
|
||||
printf("* Shape: %s\n", ps->shape_exists ? "Yes" : "No");
|
||||
|
|
|
@ -624,7 +624,7 @@ void print_help(const char *help, size_t indent, size_t curr_indent, size_t line
|
|||
*/
|
||||
static void usage(const char *argv0, int ret) {
|
||||
FILE *f = (ret ? stderr : stdout);
|
||||
fprintf(f, "picom (%s)\n", PICOM_VERSION);
|
||||
fprintf(f, "picom " PICOM_FULL_VERSION "\n");
|
||||
fprintf(f, "Standalone X11 compositor\n");
|
||||
fprintf(f, "Please report bugs to https://github.com/yshui/picom\n\n");
|
||||
|
||||
|
@ -775,7 +775,7 @@ bool get_early_config(int argc, char *const *argv, char **config_file, bool *all
|
|||
} else if (o == 314) {
|
||||
*all_xerrors = true;
|
||||
} else if (o == 318) {
|
||||
printf("%s\n", PICOM_VERSION);
|
||||
printf(PICOM_FULL_VERSION "\n");
|
||||
return true;
|
||||
} else if (o == 307) {
|
||||
// --plugin
|
||||
|
|
Loading…
Add table
Reference in a new issue