Commit graph

36 commits

Author SHA1 Message Date
Marc Durdin
f394245636 maint(common): consolidate builder scripts
Clarifies the confusing builder.inc.sh / build-utils.sh distinction by
giving the scripts more appropriate names. Most build scripts should use
builder-full.inc.sh; some helper scripts can use builder-basic.inc.sh.
Documented in resources/build/README.md.

Renames:
* resources/build/builder.inc.sh to resources/build/builder-full.inc.sh
* resources/build/build-utils.sh to resources/build/builder-basic.inc.sh

Other changes:
* Moves Android-specific functions out of builder-basic.inc.sh and into
  android/build.sh.
* Renames functions in builder-basic.inc.sh

More functions may be moved from builder-basic.inc.sh into utils.inc.sh
or other scripts in the future.

Fixes: #14065
Build-bot: build all
Test-bot: skip
2025-08-02 08:11:24 +10:00
Marc Durdin
808b6557d6 maint(common): use cpp_std=c++17 in meson project default_options
We attempted to set the C++ version in standard.meson.build, but this
does not work well as the option name varies by platform, and it also
triggers a warning in meson. This fix moves the setting into each
meson.build project() default_options. As there are only a handful
of these, the maintenance burden is not high.

Fixes: #14432
Relates-to: #14355
Build-bot: build
Test-bot: skip
2025-08-01 10:23:57 +10:00
Eberhard Beilharz
6c56eb82fa
Merge pull request #14408 from keymanapp/docs/linux/testsvcreadme 2025-07-28 09:26:43 +02:00
Eberhard Beilharz
c08ac71b30
docs(linux): update readme for test service
Build-bot: skip
Test-bot: skip
2025-07-25 19:51:47 +02:00
Eberhard Beilharz
bfc3aa3456
refactor(linux): move dbus defines to common include
This got missed in #14372.

Fixes: #13281
Follow-up-of: #14372
Test-bot: skip
2025-07-25 19:39:50 +02:00
Eberhard Beilharz
d0d774f72c
refactor(linux): move defines to common header files
Fixes: #13281
Test-bot: skip
2025-07-17 19:41:26 +02:00
Eberhard Beilharz
4ea6296237
Merge pull request #13980 from keymanapp/fix/linux/13971_installpath
This makes the path in `com.keyman.SystemService1.service` configurable when using basu (e.g. Gentoo Linux).

Fixes: #13971
2025-05-20 14:59:07 +02:00
Eberhard Beilharz
ee93d0d27a
maint(linux): add --no-werror option to not report warnings as errors
By default we add the `--werror` option to meson builds. This might cause
problems when compiling with a different compiler, so this option adds
the `--no-werror` option to our build scripts. This enables integrators
to compile with other compiler versions.

Fixes: #13970
Test-bot: skip
2025-05-20 09:01:22 +02:00
Eberhard Beilharz
8e4e92067d
fix(linux): configurable path in .service file when using basu
This makes the path in `com.keyman.SystemService1.service`
configurable when using basu (e.g. Gentoo Linux).
2025-05-19 09:46:41 +02:00
Marc Durdin
5cee89d0cc fix(linux): use correct header guard define in OrderedOutputDevice.h
Test-bot: skip
Fixes: #13911
2025-05-16 16:16:54 +02:00
Eberhard Beilharz
1f8b352529
Merge pull request #13904 from keymanapp/maint/linux/debpkg
This fixes Lintian warnings and other comments from the Debian review of the package. It also removes unnecessary files from the source package.

Note: this PR uses `Expat` instead of `MIT` in the `debian/license` file since that is the term that Debian uses and that the Debian tools output. It doesn't really matter since the term serves only as a key in the `license` file that links the files to the full text of the license further down in the `license` file.

Fixes: #13905
2025-05-15 16:25:38 +02:00
Eberhard Beilharz
fc79e38cc4
maint(linux): fix lintian warnings
This addresses comments from Debian review of the package.
2025-05-13 20:07:32 +02:00
Eberhard Beilharz
db4593127f
maint(linux): remove generated file that got accidentally committed
Test-bot: skip
2025-05-13 19:05:47 +02:00
Eberhard Beilharz
4d81589f48
maint(common): use unique names for Keyman version variables
Previously the builder scripts defined a readonly `VERSION` environment
variable for the Keyman version. That caused problems when another
(external) script tried to define a `VERSION` variable. We encountered
this problem when trying to move the TC build steps of a configuration
into a single script (#13399) when we tried to source `~/.nvm/nvm.sh`.

This change uses a Keyman specific prefix for the version variables and
renames `VERSION` → `KEYMAN_VERSION` etc. Unfortunately these variables
are used in a lot of places, so this turned out to be a bit of a yak
shave.

Test-bot: skip
2025-05-07 18:46:51 +02:00
Marc Durdin
9d2db4faf3 maint(common): consolidate standard.meson.build configuration
Use a shared function standard_meson_build to prep the
resources/meson.build folder for consistency. A future cleanup would be
to use meson-utils.inc.sh for all meson build scripts.
2025-04-30 09:16:43 +07:00
Marc Durdin
f8917d2454 maint(common): cleanup meson versioning
* Adds `VERSION_WITH_TAG` variable to standard.meson.build
* Consistently uses `file('VERSION.md')` to retrieve version number

Note that VERSION_WITH_TAG is not yet used but should be used for
version tagged files later.
2025-04-30 08:23:05 +07:00
Eberhard Beilharz
4f97b3f38e
chore(linux): add a stub unit test to allow successful coverage reporting
Previously keyman-system-service didn't have any unit tests. With the
gcov/lcov versions available for Ubuntu 24.04 Noble this suddenly caused
a failure when trying to generate the test coverage report, although it
worked fine with older versions.

This change adds a do-nothing unit test stub for keyman-system-service.
This allows to generate the coverage reporting with Ubuntu 24.04 Noble.
2025-04-23 18:52:10 +02:00
Eberhard Beilharz
ca96a8c38d
chore(linux): address code review comments 2025-02-19 10:59:44 +01:00
Eberhard Beilharz
e4c7332e1c
refactor(linux): use OrderedOutputDeviceMock when running tests
When running tests we use the `OrderedOutputDeviceMock` class which sends a
dbus message for a sentinel key press instead of creating/using a real
"virtual" keyboard.
2025-02-14 16:42:08 +01:00
Eberhard Beilharz
ec2373acd5
fix(linux): start system service when switching keyboards
This change fixes #13171 where we failed to output after the first keypress
because the keyman system service had to be started. This change introduces
a new method `Ping` that we call to force keyman-system-service to be
started.

Fixes: #13171
2025-02-10 16:30:20 +01:00
Eberhard Beilharz
f23dd7563f
refactor(linux): Implement ordered output sentinel in keyman-system-service
This change allows to press F24 as ordered output sentinel from
keyman-system-service.

This is part of implementing serialized output with keyman-system-service
instead of requiring a patched ibus.

The problem both approaches try to solve is that with non-compliant apps
it is not possible to directly delete characters from the context. Instead
we have to emit a backspace key before we can commit the new
characters. However, the backspace key press goes through a different
code path in ibus and so it can happen that the commit gets processed
before the backspace which then deletes from the characters we just
added instead of from the old content.

The previous implementation solved this by forwarding a F24 ordered output
sentinel key to ibus and relying on the patched ibus to send that back to
us. When we received the F24 key we committed the characters that we
queued when we forwarded the F24 key (implemented in #7079).

The new approach implemented in this change instead sends the F24 ordered
output sentinel key through keyman-system-service and so follows the
regular key processing without requiring a patched ibus to send the key
back to us. The rest of the algorithm stays mostly the same: when we receive
the F24 key we commit the characters previously queued. The difference to
the previous implementation is that we now also queue the backspace keys
that we generate.

Part-of: #10799
2025-02-05 11:42:04 +01:00
Eberhard Beilharz
80ae8e6289
chore(linux): improve compatibility with Gentoo Linux 🍒
Gentoo doesn't use systemd. `libelogind` or `basu` implement some aspects
of systemd, so we use that on Gentoo (or rather when `libsystemd` is not
available but `libelogind` or `basu` is).

Patch from https://forums.gentoo.org/viewtopic.php?p=8850566.
See also https://community.software.sil.org/t/keyman-for-gentoo-linux/9615.

Cherry-pick-of: #12889
2025-01-29 09:18:22 +01:00
Eberhard Beilharz
bcc09b78c8
chore(linux): use shared meson config
Fixes: #8406
2024-06-24 19:08:12 +02:00
Marc Durdin
900f248558 chore(common): cleanup meson deprecations and warnings
Most warnings have been cleaned up:

* min meson version is now 1.0
* additional parameters such as check, recursive added
* uses now global_source_root() instead of source_root()
* catting files on Windows wasn't actually working -- used in unit
  tests. This is because meson passes paths with forward slashes to
  cmd.exe `type` command, which doesn't understand them. This is bad,
  because we were running effectively null tests for the affected tests.
  Fortunately, the same tests were configured correctly on macOS and
  Linux, and were all passing, so no serious damage.

There is one significant warning left:

`WARNING: Project targets '>=1.0' but uses feature deprecated since
'0.64.0': copy arg in configure_file. Use fs.copyfile instead`

Refer to mesonbuild/meson#12792. I have opened a PR against that to
undeprecate `copy` kwarg in a future version of meson.

Fixes: #8399
2024-05-24 08:46:52 +07:00
Marc Durdin
cd8121ef65 chore(common): builder scripts now use /resources/build/builder.inc.sh
Note: there is a bit of potential confusion about the difference between
/resources/builder.inc.sh (the full implementation for builder scripts),
and /resources/build/builder.inc.sh (the source script that builder
scripts should always use).

This allows us to make assumptions that will always be true for builder
scripts that may not be true for other scripts, such as setting base
folder.
2024-05-02 15:54:31 +07:00
Marc Durdin
0f390d47cc chore(common): maintenance on build scripts - cd
Fixes #11324.

* Always `cd "$THIS_SCRIPT_PATH"`
* Remove unnecessary `cd` from all build.sh
* Remove unnecessary `set -eu` from all build.sh (and `# set -x`)
* Replace old build-utils.sh incantation in a few build.sh scripts
2024-05-02 15:54:29 +07:00
Eberhard Beilharz
2a19a2fb12
chore(linux): Fix coverage report creation for keyman-system-service
Since keyman-system-service is a dependency of ibus-keyman it gets
build when ibus-keyman gets build. However, in that case the `--coverage`
flag doesn't get passed through in which case the `coverage-html`
target is missing from ninja. This change fixes this problem by checking
if ninja has the `coverage-html` target. If not we remove the output
directory which causes the configure action to run again with the
`--coverage` option.
2023-10-18 10:32:41 +02:00
Eberhard Beilharz
08a259c6e2
chore(linux): Fix build scripts
Creating the coverage option to ninja previously didn't work reliably.
This change re-orders the parameters passed to `meson setup` and seems
to work better. Additionally this change refactors the scripts and makes
use of `builder_run_action`.
2023-10-17 20:01:05 +02:00
Eberhard Beilharz
0ed8d35bb2
chore(linux): Add code coverage index page
This change adds an index page that can show the reports for the
child projects.

Also fix a path problem in the `keyman-system-service/build.sh` script.
2023-10-13 22:51:00 +02:00
Eberhard Beilharz
fe81d8cc07
chore(linux): Add code coverage report for keyman-system-service 2023-10-12 10:21:18 +02:00
Eberhard Beilharz
3d8cf1830b
chore(linux): Add dependency to build.sh
For integration tests ibus-keyman requires keyman-system-service to
be built, so we add this as a dependency.
2023-09-21 16:11:43 +02:00
Eberhard Beilharz
93f05d6456
docs(core): Document how to build Core on Linux
Closes #8913.
2023-07-24 19:54:17 +02:00
Eberhard Beilharz
d20cc6978c
chore(linux): Add support for --no-integration flag to build files
This allows to use the `linux/build.sh` file to specify the
`--no-integration` flag which makes it easier to specify jobs on CI
because it then doesn't need to know all subprojects.
2023-07-06 12:39:21 +02:00
Eberhard Beilharz
5f5054b93c
chore(linux): Fix lintian warnings
- add rudimentary man page for keyman-system-service
- remove hashbang for bash completion files
- reword description for keyman-system-service

This fixes these lintian warnings:
keyman-system-service: description-is-pkg-name Keyman system service
keyman: bash-completion-with-hashbang /usr/bin/env bash
        [usr/share/bash-completion/completions/km-config:1]
keyman-system-service: no-manual-page
        [usr/libexec/keyman-system-service]
2023-06-05 17:18:55 +02:00
Eberhard Beilharz
ab25157364
feat(linux): Refactor to benefit from C++ RAII
Also apply changes from code review comments.
2023-05-22 19:51:45 +02:00
Eberhard Beilharz
603c1d6ea0
feat(linux): Add system service to toggle capslock LED
This implements the server side.
2023-05-15 09:13:58 +02:00