tools: link the tools against libxkbcommon.so only

The tools previously linked against a static version (by simply recompiling
everythiong). This isn't necessary, we can link them against libxkbcommon.so.

Only exception: The xbkcli-compile-keymap tool needs a private API for the
--kccgst flag. Avoid this by disabling this flag in the installed tool and
building the same tool, statically linked but not-installed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
master
Peter Hutterer 2020-07-24 13:31:03 +10:00 committed by Ran Benita
parent a472e030ea
commit ce5eb1ac6d
3 changed files with 19 additions and 5 deletions

View File

@ -241,6 +241,9 @@ install_headers(
'xkbcommon/xkbcommon-names.h', 'xkbcommon/xkbcommon-names.h',
subdir: 'xkbcommon', subdir: 'xkbcommon',
) )
libxkbcommon_dep = declare_dependency(
link_with: libxkbcommon,
)
pkgconfig.generate( pkgconfig.generate(
libxkbcommon, libxkbcommon,
name: 'xkbcommon', name: 'xkbcommon',
@ -532,8 +535,8 @@ if build_tools
'tools-internal', 'tools-internal',
'tools/tools-common.h', 'tools/tools-common.h',
'tools/tools-common.c', 'tools/tools-common.c',
libxkbcommon_sources,
include_directories: include_directories('src'), include_directories: include_directories('src'),
dependencies: libxkbcommon_dep,
) )
tools_dep = declare_dependency( tools_dep = declare_dependency(
include_directories: [include_directories('src'), include_directories('tools')], include_directories: [include_directories('src'), include_directories('tools')],
@ -550,6 +553,13 @@ if build_tools
install: true, install: true,
install_dir: dir_libexec) install_dir: dir_libexec)
install_man('tools/xkbcli-compile-keymap.1') install_man('tools/xkbcli-compile-keymap.1')
# The same tool again, but with access to some private APIS
executable('compile-keymap',
'tools/compile-keymap.c',
libxkbcommon_sources,
dependencies: [tools_dep],
c_args: ['-DENABLE_PRIVATE_APIS'],
install: false)
configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true) configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true)
executable('xkbcli-how-to-type', executable('xkbcli-how-to-type',
'tools/how-to-type.c', 'tools/how-to-type.c',

View File

@ -56,8 +56,10 @@ usage(char **argv)
"Options:\n" "Options:\n"
" --verbose\n" " --verbose\n"
" Enable verbose debugging output\n" " Enable verbose debugging output\n"
#if ENABLE_PRIVATE_APIS
" --kccgst\n" " --kccgst\n"
" Print a keymap which only includes the KcCGST component names instead of the full keymap\n" " Print a keymap which only includes the KcCGST component names instead of the full keymap\n"
#endif
" --rmlvo\n" " --rmlvo\n"
" Print the full RMLVO with the defaults filled in for missing elements\n" " Print the full RMLVO with the defaults filled in for missing elements\n"
" --from-xkb\n" " --from-xkb\n"
@ -111,7 +113,9 @@ parse_options(int argc, char **argv, struct xkb_rule_names *names)
static struct option opts[] = { static struct option opts[] = {
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
{"verbose", no_argument, 0, OPT_VERBOSE}, {"verbose", no_argument, 0, OPT_VERBOSE},
#if ENABLE_PRIVATE_APIS
{"kccgst", no_argument, 0, OPT_KCCGST}, {"kccgst", no_argument, 0, OPT_KCCGST},
#endif
{"rmlvo", no_argument, 0, OPT_RMLVO}, {"rmlvo", no_argument, 0, OPT_RMLVO},
{"from-xkb", no_argument, 0, OPT_FROM_XKB}, {"from-xkb", no_argument, 0, OPT_FROM_XKB},
{"include", required_argument, 0, OPT_INCLUDE}, {"include", required_argument, 0, OPT_INCLUDE},
@ -191,6 +195,7 @@ print_rmlvo(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo)
static bool static bool
print_kccgst(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo) print_kccgst(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo)
{ {
#if ENABLE_PRIVATE_APIS
struct xkb_component_names kccgst; struct xkb_component_names kccgst;
if (!xkb_components_from_rules(ctx, rmlvo, &kccgst)) if (!xkb_components_from_rules(ctx, rmlvo, &kccgst))
@ -209,6 +214,9 @@ print_kccgst(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo)
free(kccgst.symbols); free(kccgst.symbols);
return true; return true;
#else
return false;
#endif
} }
static bool static bool

View File

@ -20,10 +20,6 @@ Print help and exit
Enable verbose debugging output Enable verbose debugging output
. .
.TP .TP
\fB\-\-kccgst\fR
Print a keymap which only includes the KcCGST component names instead of the full keymap
.
.TP
\fB\-\-rmlvo\fR \fB\-\-rmlvo\fR
Print the full RMLVO with the defaults filled in for missing elements Print the full RMLVO with the defaults filled in for missing elements
. .