Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the Meson build system #125

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

guijan
Copy link

@guijan guijan commented Jul 6, 2021

Hello, I've written Meson build definitions for xclip.

This patch appears to depend on #123 on my system, without it a build error occurs due to the missing #include. That's not a build system issue so it's in its own PR.

I've kept the new build system mostly functionally the same as the autotools-based one, I'm not aware of any lost functionality. The differences are as follows:

  • The build is now done with Link Time Optimization by default.
  • Meson abstracts enabling compiler warnings, I've set them to the highest level which for GCC and Clang translates into "-Wall -Wextra -Wpedantic". This differs from the Autotools script which uses "-Wall" under GCC.
  • I've explicitly set the C standard to C99, the project didn't build with Clang/GCC set to C89 mode due to mixing declarations and code.
  • The test in "borked.c" was integrated into Meson's test support, "xctest" wasn't because I haven't figured out how to do it.

I think Meson is a better build system because it took me roughly 9 hours to translate the Autotools definitions into a meson.build and test the result, and this has already gained the project the following:

  • Out of source build support, requested in Allow out of source build #111. Meson always uses a build directory, this directory can be outside the source.
  • Meson produces a compile_commands.json file.
  • pkg-config is used to find Xmu, iconv on the other hand is a complicated case and may be part of the libc or provided by something like GNU libiconv, I've only tested this patch on OpenBSD and it appears to find libiconv where Autotools can't.
  • Simplified build. Just type meson setup build and meson compile -C build and Meson sets itself up in the "build" directory and produces a debug binary at "build/xclip".
  • Test integration. This should make it easy for package maintainers to test xclip before updating it in their distro/OS, it should also make it easier for xclip developers to produce and run tests. So far only "borked.c" is integrated.
  • Ease of development. Meson notices when you change your compiler flags and triggers a rebuild, Meson also notices changes made to headers included by source files and triggers rebuilds of files that include the specific header.
  • Whichever Meson feature turns out to be useful. Meson supports cross compilation, many compilers, test coverage reports, it automagically figures out what to put in a dist file, it runs on Windows, it makes separating the source tree into folders easy and more.

All of this by depending on Python, Ninja and Meson at build time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant