Review debug mode management in the meson template
We can't just rely on the buildtype option to decide which flags to
add, as the user can directly set the debug and optimization
options, which usually result in a buildtype option set to custom.
It also seems that buildtype=debugoptimized corresponds to a
production build, for which we shouldn't enable debug logs (see
reference below).
This doesn't exactly reproduce the autotools build mode of the
--enable-debug option, which we should probably accept having to
deviate from:
-
--enable-debug={full,yes}are mixed up in the same debug mode, where all debug logs are enabled (which is perhaps no bad thing?). This corresponds tobuildtype=debug. -
--enable-debug=minimalcorresponds tobuildtype=debugoptimized, where no flag is set. -
--enable-debug=nocorresponds tobuildtype={minsize,release}, where we set aggressive optimization flags. -
buildtype=plainis also a production mode, for which we don't set debug flags, but for which we don't really know the optimization mode, so we don't set aggressive optimization flags either.
Related: !98 (merged)
See-also:
https://blogs.gnome.org/mcatanzaro/2022/07/15/best-practices-for-build-options/
https://mesonbuild.com/Builtin-options.html
Edited by Gaël Bonithon