Skip to content

Improve default value of glib_debug option

Michael Catanzaro requested to merge mcatanzaro/build-best-practices into main

glib_debug is an auto option. This is clever because it allows us to guess the best default based on the build type, while also allowing an easy way to override if the guess is not good. Sadly, the attempt to guess based on the build type does not work well. For example, it considers debugoptimized builds to be debug builds, but despite the name, it is definitely a release build type (except on Windows, which we'll ignore here). The minsize build type has the exact same problem. The debug option is true for both build types, but this only controls whether debuginfo is enabled, not whether debug extras are enabled.

The plain build type has a different problem: debug is off, but the optimization option is off too, even though plain builds are distro builds are will almost always use optimization.

I've outlined an argument for why we should make these changes here: https://blogs.gnome.org/mcatanzaro/2022/07/15/best-practices-for-build-options/

Specifically, Rule 4 shows all the build types and whether they correspond to release builds or debug builds. Rule 6 argues that we should provide good defaults for plain builds.

Edited by Michael Catanzaro

Merge request reports