Skip to content

chore(linux): Build with meson instead of autotools 🏗️#8111

Merged
ermshiperete merged 6 commits intomasterfrom
chore/linux/5981_ibus-keyman_meson
Feb 6, 2023
Merged

chore(linux): Build with meson instead of autotools 🏗️#8111
ermshiperete merged 6 commits intomasterfrom
chore/linux/5981_ibus-keyman_meson

Conversation

@ermshiperete
Copy link
Copy Markdown
Contributor

This change introduces meson for building ibus-keyman instead of autotools.

Closes #5981.

@keymanapp-test-bot skip

@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Jan 27, 2023

User Test Results

Test specification and instructions

User tests are not required

@ermshiperete ermshiperete marked this pull request as draft January 27, 2023 21:19
@ermshiperete ermshiperete force-pushed the chore/linux/5981_ibus-keyman_meson branch 2 times, most recently from ea0ac29 to 84c26fb Compare January 30, 2023 15:07
This change introduces meson for building ibus-keyman instead of
autotools.

Closes #5981.
@ermshiperete ermshiperete force-pushed the chore/linux/5981_ibus-keyman_meson branch from 84c26fb to eb076c0 Compare January 30, 2023 15:36
@ermshiperete ermshiperete marked this pull request as ready for review January 30, 2023 16:07
@mcdurdin
Copy link
Copy Markdown
Member

The changes to core are going to be a little bit fun to merge with epic-ldml!

Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, but I think we need to look at how we are using meson throughout the entire repo and avoid referencing files from other projects (i.e. core from linux in this case).

'km_kbp_processevent_api.cpp',
'jsonpp.cpp',
'mock/mock_processor.cpp',
kmxfiles = files(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kmxfiles = files(
kmx_files = files(

and so on?

Comment on lines +20 to +22
# define some variables. We wouldn't need this if we'd have a meson.build file
# in the Keyman root directory...
coredir = '@0@/../../core'.format(meson.current_source_dir())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with putting a meson.build in the root is it impacts all paths, doesn't it?

That said, I'm not all that excited about linux builds listing all the files in core separately -- it undoes a lot of the good of using meson in the first place. I'd prefer to see us building core as a static library and importing it that way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Refactored to create a static library and get rid of the direct references of core file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Core, we need to generate both static library and DLL on Windows -- static library used by Keyman Engine, DLL used by Developer.

Comment on lines +1 to +15
utilfiles = files(
'keymanutil.c',
'keymanutil.h',
'kmpdetails.c',
'kmpdetails.h',
)

engine_sources = files(
'main.c',
'engine.c',
'engine.h',
'keycodes.h',
'keyman-service.c',
'keyman-service.h',
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
utilfiles = files(
'keymanutil.c',
'keymanutil.h',
'kmpdetails.c',
'kmpdetails.h',
)
engine_sources = files(
'main.c',
'engine.c',
'engine.h',
'keycodes.h',
'keyman-service.c',
'keyman-service.h',
)
util_files = files(
'keymanutil.c',
'keymanutil.h',
'kmpdetails.c',
'kmpdetails.h',
)
engine_files = files(
'main.c',
'engine.c',
'engine.h',
'keycodes.h',
'keyman-service.c',
'keyman-service.h',
)

We should use either _files or _sources consistently.

@@ -0,0 +1,152 @@
sources = [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sources = [
test_files = [

while IFS= read -r -d '' file; do
testname=$(basename "$file" .kmx)
printf "$(basename "$file")\t${testname#k_}\n"
done < <(find . -name \*.kmx -print0 | sort -z)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be < <?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the first one is the redirection of input, the second one takes the output of the command.

@ermshiperete ermshiperete force-pushed the chore/linux/5981_ibus-keyman_meson branch 2 times, most recently from 874aa2b to 00b5f34 Compare January 31, 2023 16:29
@ermshiperete ermshiperete force-pushed the chore/linux/5981_ibus-keyman_meson branch from 00b5f34 to c176ebc Compare January 31, 2023 16:38
@ermshiperete ermshiperete requested a review from mcdurdin January 31, 2023 17:43
emscripten doesn't support static libraries, so we explicitly
build a static library unless we're building for wasm.
@ermshiperete ermshiperete force-pushed the chore/linux/5981_ibus-keyman_meson branch from d3c5798 to d39ba17 Compare January 31, 2023 19:59
@mcdurdin
Copy link
Copy Markdown
Member

Latest Developer build failed with:

[23:18:47][Step 1/4] 	copy C:\BuildAgent\work\7ac43416c45637e9\keyman\core\build\x86\Release\src\kmnkbp0-0.dll C:\BuildAgent\work\7ac43416c45637e9\keyman\developer\bin
[23:18:47][Step 1/4] The system cannot find the file specified.

Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much closer, good work. We just need to avoid changes to Core impacting other platforms

The static library is currently only needed for the ibus-keyman
tests, so we only build it on Linux. It can't build with
emscripten, and on Windows it'd need some additional work.
@ermshiperete ermshiperete requested a review from mcdurdin February 1, 2023 07:38
Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is our minimum meson version requirement for Linux now? I am seeing conflicting data. We should make it consistent across all meson.build project specs and in our docs.

If we can go 0.49 or higher, then we can use / instead of join_paths() which would be superfantastic.

Apart from that, requesting lots of little tidy-up changes, mostly!

Comment on lines +20 to +21
'@0@/../../core/build/arch/debug/src'.format(meson.current_source_dir()),
'@0@/../../core/build/arch/release/src'.format(meson.current_source_dir())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to conditionalize these on whether we are doing a debug build?

And then use core_dir:

  core_dir / 'build/arch/debug/src'
  core_dir / 'build/arch/release/src'

Comment on lines +106 to +109
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
],
env: test_env,

Comment on lines +120 to +123
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
],
env: test_env,

Comment on lines +134 to +137
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
],
env: test_env,

Comment on lines +148 to +151
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
],
env: test_env,

- make use of new meson features
- some refactoring
@ermshiperete ermshiperete requested a review from mcdurdin February 3, 2023 09:12
@mcdurdin mcdurdin modified the milestones: A17S5, A17S6 Feb 4, 2023
Copy link
Copy Markdown
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ermshiperete ermshiperete merged commit 1ef7db5 into master Feb 6, 2023
@ermshiperete ermshiperete deleted the chore/linux/5981_ibus-keyman_meson branch February 6, 2023 16:47
@keyman-server
Copy link
Copy Markdown
Collaborator

Changes in this pull request will be available for download in Keyman version 17.0.43-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(linux): convert ibus-keyman to build with meson

3 participants