Commit Graph

5 Commits (01aa2222576c88308d74bbc7f0c459d4acada681)

Author SHA1 Message Date
Ran Benita 0066e387bc tools: make independent from src/
Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-07-25 15:59:23 +03:00
Peter Hutterer ed57fb8b86 tools: add a xkbcli tool as entry point for the various tools we have
This is the base tool, no subtools are currently connected so you only get help
and version for now. The goal here is to have a git-like infrastructure where
/usr/bin/xkbcli is the main tool, anything else will hide in libexec.

The infrastructure for this is copied from libinput. Tools themselves will
will be installed in $prefix/libexec/xkbcommon and the xkbcli tool forks
off whatever argv[1] is after modifying the PATH to include the libexec dir.

libinput has additional code for checking whether we're running this from the
builddir but it's a bit iffy and it's usefulness is limited - if you're in the
builddir anyway you can just run ./builddir/xkbcli-<toolname> directly.
So for this code here, running ./builddir/xkbcli <toolname> will execute the
one in the prefix/libexecdir.

Since we want that tool available everywhere even where some of the subtools
aren't present, we need to ifdef the getopt handling.

man page generation is handled via ronn which is a ruby program but allows
markdown for the sources. It's hidden behind a meson option to disable where
downloading ronn isn't an option. The setup is generic enough that we can add
other man-pages by just appending to the array.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-25 11:05:14 +03:00
Ran Benita 878cc7a574 tools: don't depend on src/utils.h
The idea is to make the tools/demos as standalone as possible so that
they may serve as examples as well.

Signed-off-by: Ran Benita <ran@unusedvar.com>
2020-06-28 09:50:47 +03:00
Peter Hutterer c09bf36306 test: untangle interactive-evdev from the test headers
Move (sometimes duplicate) the required bits into new shared files
tools-common.(c|h) that are compiled into the internal tools library. Rename the
test_foo() functions to tools_foo() and in one case just copy the code of the
keymap compile function to the tool.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25 10:32:08 +10:00
Peter Hutterer 2eb5d2c81d test: simplify error handling in interactive-evdev
Passing -errno around and having separate labels depending on failure types is
superfluous here. All the unref calls can handle NULL and nothing cares about
errno once we're out of the immediate scope. So let's simplify this and deal
with 0 and 1 only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-25 10:32:08 +10:00