diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0424753704e1bf4d8a7674f8edab6ae4d8702647..275408cb1c0ad0a9ef5985e799008a26b0413339 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,15 +1,4 @@ -build-and-test-buffyboard: - image: alpine:3.19 - tags: - - saas-linux-small-amd64 - script: - - apk -q add git bash build-base meson linux-headers inih-dev libinput-dev eudev-dev - - git submodule init - - git submodule update - - cd buffyboard - - ./test/test-all.sh - -build-and-test-unl0kr-with-drm: +build-and-test-with-drm: image: alpine:3.19 tags: - saas-linux-small-amd64 @@ -17,10 +6,9 @@ build-and-test-unl0kr-with-drm: - apk -q add git bash build-base meson linux-headers inih-dev libinput-dev libxkbcommon-dev libdrm-dev scdoc - git submodule init - git submodule update - - cd unl0kr - ./test/test-with-drm.sh -build-and-test-unl0kr-without-drm: +build-and-test-without-drm: image: alpine:3.19 tags: - saas-linux-small-amd64 @@ -28,7 +16,6 @@ build-and-test-unl0kr-without-drm: - apk -q add git bash build-base meson linux-headers inih-dev libinput-dev libxkbcommon-dev scdoc - git submodule init - git submodule update - - cd unl0kr - ./test/test-without-drm.sh build-iskey: diff --git a/README.md b/README.md index 92cad1710f661f5142b818616392c28d6d12631f..b8719604495e5cb4f3c6d27b6a6489c4e3dcadb0 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,31 @@ BuffyBox is a suite of graphical applications for the terminal. You can join our development chat at [#buffybox:matrix.org]. +## Building & running + +Some of unl0kr's dependencies are included as git submodules in this repository. You can clone the repository and initialise the submodules with + +``` +$ git clone https://gitlab.com/postmarketOS/buffybox.git +$ cd buffybox +$ git submodule init +$ git submodule update +``` + +When pulling changes from the remote later, either use `git pull --recurse-submodules` or manually run `git submodule update` as needed after pulling. + +Once you have the sources, you can build the app and run it in a VT. Unless your user account has special privileges, `sudo` will be needed to access input device files. + +``` +$ meson setup _build +$ meson compile -C _build +$ sudo chvt 2 +$ sudo ./_build/unl0kr/unl0kr # For Unl0kr +$ sudo ./_build/buffyboard/buffyboard # For Buffyboard +``` + +With meson <0\.55 use `ninja` instead of `meson compile`\. + ## Making a release To make it easier for distributions to package BuffyBox, we include source tarballs including the LVGL submodule in GitLab releases. See [unl0kr#42] for more background on this. diff --git a/buffyboard/README.md b/buffyboard/README.md index 9683077d02f7aa179a8a096d92c445f8bf7cfdf3..decb3d70b3e1cbfddd1ec1d1d804a414edeaeb03 100644 --- a/buffyboard/README.md +++ b/buffyboard/README.md @@ -77,30 +77,6 @@ For an example configuration file, see [buffyboard.conf]. - evdev kernel module - uinput kernel module -## Building & running - -Some of buffyboard's dependencies are included as git submodules in this repository. You can clone the repository and initialise the submodules with - -``` -$ git clone https://gitlab.com/cherrypicker/buffyboard.git -$ cd buffyboard -$ git submodule init -$ git submodule update -``` - -When pulling changes from the remote later, either use `git pull --recurse-submodules` or manually run `git submodule update` as needed after pulling. - -Once you have the sources, you can build the app and run it in a VT. Unless your user account has special privileges, `sudo` will be needed to access input device files. - -``` -$ meson _build -$ meson compile -C _build -$ sudo chvt 2 -$ sudo ./_build/buffyboard -``` - -With meson <0.55 use `ninja` instead of `meson compile`. - ## Keyboard layouts Buffyboard uses [squeekboard layouts] converted to C via [squeek2lvgl]. To regenerate the layouts, ensure that you have pipenv installed (e.g. via `pip install --user pipenv`) and then run @@ -114,10 +90,10 @@ $ ./regenerate-layouts.sh To generate screenshots in a variety of common sizes, install [fbcat], build buffyboard and then run ``` -$ sudo ./regenerate-screenshots _build/buffyboard +$ sudo ./regenerate-screenshots ../_build/unl0kr/buffyboard ``` -where `_build/buffyboard` is the location of the buffyboard binary. +where `../_build/unl0kr/buffyboard` is the location of the buffyboard binary. # Acknowledgements diff --git a/buffyboard/doc/buffyboard.1.scd b/buffyboard/doc/buffyboard.1.scd new file mode 100644 index 0000000000000000000000000000000000000000..6699a3728251ea0b48579654322116c28d3e06e1 --- /dev/null +++ b/buffyboard/doc/buffyboard.1.scd @@ -0,0 +1,63 @@ +buffyboard(1) "buffyboard" + +# NAME + +BUFFYBOARD - Touch-enabled framebuffer keyboard (not only) for vampire slayers. + +# SYNOPSIS + +buffyboard [OPTION] + +# DESCRIPTION + +Buffyboard is a touch-enabled on-screen keyboard running on the Linux +framebuffer. It's primarily intended for vampire hunting but you can +also use it as a general purpose keyboard. + +Buffyboard uses LVGL for input processing and rendering. Key events are +forwarded directly to the kernel via a uinput device. Since the latter +emulates a hardware keyboard, the terminal keymap must match with +buffyboard's layout or else on-screen keys might not produce the correct +result. + +# OPTIONS + +## Optional + +*-C, --config-override* + Path to a config override file. Can be supplied multiple times. Config + files are merged in the following order: + - /etc/buffyboard.conf + - /etc/buffyboard.conf.d/\* (alphabetically) + - Override files (in supplied order) +*-g, --geometry=NxM[@X,Y]* + Force a display size of N horizontal times M vertical pixels, offset + horizontally by X pixels and vertically by Y pixels. +*-d --dpi=N* + Override the display's DPI value. +*-r, --rotate=[0-3]* + Rotate the UI to the given orientation. The + values match the ones provided by the kernel in + /sys/class/graphics/fbcon/rotate. + * 0 - normal orientation (0 degree) + * 1 - clockwise orientation (90 degrees) + * 2 - upside down orientation (180 degrees) + * 3 - counterclockwise orientation (270 degrees) +*-h, --help* + Print this message and exit. +*-v, --verbose* + Enable more detailed logging output on STDERR. +*-V, --version* + Print the unl0kr version and exit. + +# EXAMPLES + +*Execute Buffyboard using the default config* + buffyboard + +# SEE ALSO + *buffyboard.conf*(5) + +# AUTHORS + +*Undef* <debian@undef.tools> diff --git a/buffyboard/doc/buffyboard.conf.5.scd b/buffyboard/doc/buffyboard.conf.5.scd new file mode 100644 index 0000000000000000000000000000000000000000..d82ff46de8f6c30fbf4778b627fe329eb00dbc34 --- /dev/null +++ b/buffyboard/doc/buffyboard.conf.5.scd @@ -0,0 +1,53 @@ +buffyboard(5) "buffyboard" + +# NAME + +BUFFYBOARD - configuration file + +# DESCRIPTION + +BUFFYBOARD expects a configuration file with options in the following format, with +one option/value pair per line: + +``` +[section] +<option>=<value> +``` + +The default configuration file is at /etc/buffyboard.conf, BUFFYBOARD will use this +configuration file if present along with overrides placed in +/etc/buffyboard.conf.d/ and those specified with the -C option. All config files +will be merged in the following order: + - /etc/buffyboard.conf + - /etc/buffyboard.conf.d/ (alphabetically) + - Override files (in supplied order) + +# OPTIONS + +## Theme +*default* = <adwaita-light|adwaita-dark|breezy-light|breezy-dark|nord-light|nord-dark|pmos-light|pmos-dark> + Selects the default theme on boot. Can be changed at runtime to the + alternative theme. Default: breezy-dark. + +## Input +*pointer* = <true|false> + Enable or disable the use of a hardware mouse or other pointing device. + Default: true. + +*touchscreen* = <true|false> + Enable or disable the use of the touchscreen. + Default: true. + +## Quirks +*fbdev_force_refresh* = <true|false> + If true and using the framebuffer backend, this triggers a display refresh + after every draw operation. This has a negative performance impact. + Default: false. + +# SEE ALSO + *buffyboard*(1) + +# AUTHORS + +*Undef* <debian@undef.tools> +*Johannes Marbach* <n0-0ne@mailbox.org> diff --git a/buffyboard/meson.build b/buffyboard/meson.build index 25fef157692ff7ed9ebbc2f02bbffbf9c25b1ed3..da65769286ad84d647fc2d45d2725717c5e156c5 100644 --- a/buffyboard/meson.build +++ b/buffyboard/meson.build @@ -2,16 +2,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later -project( - 'buffyboard', - 'c', - version: '3.2.0', - default_options: 'warning_level=1', - meson_version: '>=0.53.0' -) - -add_project_arguments('-DBB_VERSION="@0@"'.format(meson.project_version()), language: ['c']) - buffyboard_sources = [ 'command_line.c', 'config.c', @@ -35,6 +25,11 @@ squeek2lvgl_sources = [ '../squeek2lvgl/sq2lv.c', ] +man_files = [ + 'doc/buffyboard.1', + 'doc/buffyboard.conf.5', +] + lvgl_sources = run_command('../find-lvgl-sources.sh', '../lvgl', check: true).stdout().strip().split('\n') executable( @@ -49,3 +44,23 @@ executable( ], install: true ) + +scdoc = dependency('scdoc') +scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native : true) +sh = find_program('sh', native : true) +foreach file : man_files + filename = file + '.scd' + section = file.split('.')[-1] + topic = file.split('.' + section)[-2].split('/')[-1] + output = '@0@.@1@'.format(topic, section) + + custom_target( + output, + input : filename, + output : output, + capture : true, + command : [sh, '-c', scdoc_prog.path() + ' < @INPUT@'], + install : true, + install_dir : get_option('mandir') / 'man' + section + ) +endforeach diff --git a/buffyboard/test/build.sh b/buffyboard/test/build.sh deleted file mode 100755 index 114a08552f164d8842b96a015019ed5fe524f4ca..0000000000000000000000000000000000000000 --- a/buffyboard/test/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -rm -rf _build -meson _build -meson compile -C _build diff --git a/buffyboard/test/helpers.sh b/buffyboard/test/helpers.sh deleted file mode 100644 index f6f21bf6cfc00e9097d1f5360a96bc7be25acbb4..0000000000000000000000000000000000000000 --- a/buffyboard/test/helpers.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE[0]}")/../../test/helpers.sh" - -function run_buffyboard_async() { - local log=$1 - local conf=$2 - - ./_build/buffyboard -v -C "$conf" > "$log" 2>&1 & - pid=$! - sleep 3 - - kill -9 $pid - wait $pid > /dev/null 2>&1 -} - -function run_buffyboard_sync() { - local log=$1 - shift - local conf=$2 - shift - local args=$@ - - ./_build/buffyboard -v -C "$conf" $@ > "$log" 2>&1 -} diff --git a/buffyboard/test/test-all.sh b/buffyboard/test/test-all.sh deleted file mode 100755 index d474e6b28912ad7763aee48d6f64cde93b98e2e5..0000000000000000000000000000000000000000 --- a/buffyboard/test/test-all.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -root=$(dirname "${BASH_SOURCE[0]}") - -source "$root/helpers.sh" - -run_script "$root/build.sh" -run_script "$root/test-version-matches-meson-and-changelog.sh" diff --git a/meson.build b/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..4c0f3a702ebae0413ba32e4bb6bdf4d5060b9f1c --- /dev/null +++ b/meson.build @@ -0,0 +1,13 @@ +project( + 'buffybox', + 'c', + version: '3.2.0', + default_options: 'warning_level=3', + meson_version: '>=0.53.0' +) + +add_project_arguments('-DBB_VERSION="@0@"'.format(meson.project_version()), language: ['c']) +add_project_arguments('-DUL_VERSION="@0@"'.format(meson.project_version()), language: ['c']) + +subdir('unl0kr') +subdir('buffyboard') diff --git a/unl0kr/meson_options.txt b/meson_options.txt similarity index 100% rename from unl0kr/meson_options.txt rename to meson_options.txt diff --git a/squeek2lvgl/sq2lv.h b/squeek2lvgl/sq2lv.h index e85b87bb96cab643c7090672dac59e122784c21a..00991878243279291a0e26f2bb23ee5ebb21a487 100644 --- a/squeek2lvgl/sq2lv.h +++ b/squeek2lvgl/sq2lv.h @@ -7,7 +7,7 @@ #ifndef SQ2LV_H #define SQ2LV_H -#include "../sq2lv_layouts.h" +#include "sq2lv_layouts.h" /* Key attributes */ #define SQ2LV_CTRL_NON_CHAR (LV_BUTTONMATRIX_CTRL_CLICK_TRIG | LV_BUTTONMATRIX_CTRL_CHECKED) diff --git a/unl0kr/test/build-with-drm.sh b/test/build-with-drm.sh similarity index 100% rename from unl0kr/test/build-with-drm.sh rename to test/build-with-drm.sh diff --git a/unl0kr/test/build-without-drm.sh b/test/build-without-drm.sh similarity index 100% rename from unl0kr/test/build-without-drm.sh rename to test/build-without-drm.sh diff --git a/test/helpers.sh b/test/helpers.sh index 135757c5a6017a2ba12543db4b3ad0277d7a6bf0..027fca9f81d9ea0ca1240dfe0f16a84ec2b4f627 100644 --- a/test/helpers.sh +++ b/test/helpers.sh @@ -1,5 +1,49 @@ #!/bin/bash +function run_unl0kr_async() { + local log=$1 + local conf=$2 + + ./_build/unl0kr/unl0kr -v -C "$conf" > "$log" 2>&1 & + pid=$! + sleep 3 + + kill -9 $pid + wait $pid > /dev/null 2>&1 +} + +function run_unl0kr_sync() { + local log=$1 + shift + local conf=$2 + shift + local args=$@ + + ./_build/unl0kr/unl0kr -v -C "$conf" $@ > "$log" 2>&1 +} + +function run_buffyboard_async() { + local log=$1 + local conf=$2 + + ./_build/buffyboard/buffyboard -v -C "$conf" > "$log" 2>&1 & + pid=$! + sleep 3 + + kill -9 $pid + wait $pid > /dev/null 2>&1 +} + +function run_buffyboard_sync() { + local log=$1 + shift + local conf=$2 + shift + local args=$@ + + ./_build/buffyboard/buffyboard -v -C "$conf" $@ > "$log" 2>&1 +} + function info() { echo -e "[Info] $1" } @@ -23,5 +67,5 @@ function read_version_from_meson() { } function read_version_from_changelog() { - grep "^## [[:digit:]]" "$root/../../CHANGELOG.md" | head -n1 | grep -o "[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+" + grep "^## [[:digit:]]" "$root/../CHANGELOG.md" | head -n1 | grep -o "[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+" } diff --git a/unl0kr/test/test-all.sh b/test/test-all.sh similarity index 100% rename from unl0kr/test/test-all.sh rename to test/test-all.sh diff --git a/unl0kr/test/test-uses-drm-backend-if-selected-via-config-and-available.sh b/test/test-uses-drm-backend-if-selected-via-config-and-available.sh similarity index 100% rename from unl0kr/test/test-uses-drm-backend-if-selected-via-config-and-available.sh rename to test/test-uses-drm-backend-if-selected-via-config-and-available.sh diff --git a/unl0kr/test/test-uses-fb-backend-by-default.sh b/test/test-uses-fb-backend-by-default.sh similarity index 100% rename from unl0kr/test/test-uses-fb-backend-by-default.sh rename to test/test-uses-fb-backend-by-default.sh diff --git a/unl0kr/test/test-uses-fb-backend-if-drm-selected-via-config-but-unavailable.sh b/test/test-uses-fb-backend-if-drm-selected-via-config-but-unavailable.sh similarity index 100% rename from unl0kr/test/test-uses-fb-backend-if-drm-selected-via-config-but-unavailable.sh rename to test/test-uses-fb-backend-if-drm-selected-via-config-but-unavailable.sh diff --git a/unl0kr/test/test-uses-fb-backend-if-selected-via-config.sh b/test/test-uses-fb-backend-if-selected-via-config.sh similarity index 100% rename from unl0kr/test/test-uses-fb-backend-if-selected-via-config.sh rename to test/test-uses-fb-backend-if-selected-via-config.sh diff --git a/buffyboard/test/test-version-matches-meson-and-changelog.sh b/test/test-version-matches-meson-and-changelog.sh similarity index 78% rename from buffyboard/test/test-version-matches-meson-and-changelog.sh rename to test/test-version-matches-meson-and-changelog.sh index e645d691f8be205936d4068cf23b08fb56867a37..76048f1abff3035acdc2e9ad3da4a5835ce59ccc 100755 --- a/buffyboard/test/test-version-matches-meson-and-changelog.sh +++ b/test/test-version-matches-meson-and-changelog.sh @@ -24,6 +24,16 @@ if [[ "$meson_version" != "$changelog_version" ]]; then exit 1 fi +info "Running unl0kr" +run_unl0kr_sync "$log" "$conf" -V + +info "Verifying output" +if ! grep "unl0kr $meson_version" "$log"; then + error "Expected version $meson_version" + cat "$log" + exit 1 +fi + info "Running buffyboard" run_buffyboard_sync "$log" "$conf" -V diff --git a/unl0kr/test/test-with-drm.sh b/test/test-with-drm.sh similarity index 100% rename from unl0kr/test/test-with-drm.sh rename to test/test-with-drm.sh diff --git a/unl0kr/test/test-without-drm.sh b/test/test-without-drm.sh similarity index 100% rename from unl0kr/test/test-without-drm.sh rename to test/test-without-drm.sh diff --git a/unl0kr/README.md b/unl0kr/README.md index 2855562da2b72dd44c3a0321ef33045a42e16dd3..aa8d628d29d0cac9a8a2af8d026cb0c2f0aaa745 100644 --- a/unl0kr/README.md +++ b/unl0kr/README.md @@ -80,30 +80,6 @@ For an example configuration file, see [unl0kr.conf]. - evdev kernel module - [scdoc] (for generating the man page) -## Building & running - -Some of unl0kr's dependencies are included as git submodules in this repository. You can clone the repository and initialise the submodules with - -``` -$ git clone https://gitlab.com/postmarketOS/buffybox.git -$ cd buffybox -$ git submodule init -$ git submodule update -``` - -When pulling changes from the remote later, either use `git pull --recurse-submodules` or manually run `git submodule update` as needed after pulling. - -Once you have the sources, you can build the app and run it in a VT. Unless your user account has special privileges, `sudo` will be needed to access input device files. - -``` -$ meson _build -$ meson compile -C _build -$ sudo chvt 2 -$ sudo ./_build/unl0kr -``` - -With meson <0\.55 use `ninja` instead of `meson compile`\. - ## Valgrind > Using C without Valgrind is like skydiving without a parachute. @@ -111,7 +87,7 @@ With meson <0\.55 use `ninja` instead of `meson compile`\. To be able to use Valgrind, add `default_options: ['optimization=g']` in the `project` section of `meson.build` and rebuild. Afterwards you can run the application with Valgrind's leaks check enabled via ``` -sudo valgrind --leak-check=yes ./_build/unl0kr +sudo valgrind --leak-check=yes ../_build/unl0kr/unl0kr ``` ## Backends @@ -142,10 +118,10 @@ $ ./regenerate-layouts.sh To generate screenshots in a variety of common sizes, install [fbcat], build unl0kr and then run ``` -$ sudo ./regenerate-screenshots _build/unl0kr +$ sudo ./regenerate-screenshots ../_build/unl0kr/unl0kr ``` -where `_build/unl0kr` is the location of the unl0kr binary. +where `../_build/unl0kr/unl0kr` is the location of the unl0kr binary. ## Screen recording diff --git a/unl0kr/doc/unl0kr.conf.5.scd b/unl0kr/doc/unl0kr.conf.5.scd index a4f758545e6b6387cfcd40bef076fb8ecaa79be4..a9c181d6cab333d11566abcf6bb29851063992c8 100644 --- a/unl0kr/doc/unl0kr.conf.5.scd +++ b/unl0kr/doc/unl0kr.conf.5.scd @@ -58,7 +58,7 @@ will be merged in the following order: The character that will be used to obscure the password. Default: bullet. ## Theme -*default* = <breezy-light|breezy-dark|pmos-light|pmos-dark> +*default* = <adwaita-light|adwaita-dark|breezy-light|breezy-dark|nord-light|nord-dark|pmos-light|pmos-dark> Selects the default theme on boot. Can be changed at runtime to the alternative theme. Default: breezy-dark. diff --git a/unl0kr/meson.build b/unl0kr/meson.build index f7b3989d20f4f056fa2028d78cd567dd3edbb7f7..ffc2727539d5acefaeae23c02f6a2894de77bf2e 100644 --- a/unl0kr/meson.build +++ b/unl0kr/meson.build @@ -2,16 +2,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later -project( - 'unl0kr', - 'c', - version: '3.2.0', - default_options: 'warning_level=3', - meson_version: '>=0.53.0' -) - -add_project_arguments('-DUL_VERSION="@0@"'.format(meson.project_version()), language: ['c']) - unl0kr_sources = [ 'backends.c', 'command_line.c', diff --git a/unl0kr/test/helpers.sh b/unl0kr/test/helpers.sh deleted file mode 100644 index c1f8636b3fe5976e2c56c9fe899d4da5d5ff4bd7..0000000000000000000000000000000000000000 --- a/unl0kr/test/helpers.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -source "$(dirname "${BASH_SOURCE[0]}")/../../test/helpers.sh" - -function run_unl0kr_async() { - local log=$1 - local conf=$2 - - ./_build/unl0kr -v -C "$conf" > "$log" 2>&1 & - pid=$! - sleep 3 - - kill -9 $pid - wait $pid > /dev/null 2>&1 -} - -function run_unl0kr_sync() { - local log=$1 - shift - local conf=$2 - shift - local args=$@ - - ./_build/unl0kr -v -C "$conf" $@ > "$log" 2>&1 -} \ No newline at end of file diff --git a/unl0kr/test/test-version-matches-meson-and-changelog.sh b/unl0kr/test/test-version-matches-meson-and-changelog.sh deleted file mode 100755 index 887ee8374f15f06a8344d2ca83ab4804b53cc40c..0000000000000000000000000000000000000000 --- a/unl0kr/test/test-version-matches-meson-and-changelog.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -log=tmp.log - -root=$(dirname "${BASH_SOURCE[0]}") - -source "$root/helpers.sh" - -function clean_up() { - rm -f "$log" -} - -trap clean_up EXIT - -info "Querying version from build.meson" -meson_version=$(read_version_from_meson) - -info "Querying version from CHANGELOG.md" -changelog_version=$(read_version_from_changelog) - -info "Verifying versions" -if [[ "$meson_version" != "$changelog_version" ]]; then - error "Version $meson_version from meson.build doesn't match version $changelog_version from CHANGELOG.md" - exit 1 -fi - -info "Running unl0kr" -run_unl0kr_sync "$log" "$conf" -V - -info "Verifying output" -if ! grep "unl0kr $meson_version" "$log"; then - error "Expected version $meson_version" - cat "$log" - exit 1 -fi - -ok