Skip to content

build: Target a specific GLib API version

Simon McVittie requested to merge wip/smcv/target-specific-glib into master

Since GLib 2.32 (2012), setting GLIB_VERSION_MIN_REQUIRED selects the minimum required version of GLib for this project. Code that was deprecated after that version will not cause deprecation warnings, and where header files have changed their compile-time behaviour over time, the behaviour that was seen in the selected version will be used where possible. pan officially only requires GLib 2.17 if D-Bus is not enabled, but 2.26 is required for D-Bus and is also the oldest version for which version macros are provided, so behave as though that is the minimum.

In particular, this disables new C++ behaviour introduced in GLib 2.68, which caused this project to fail to build.

Similarly, setting GLIB_VERSION_MAX_ALLOWED causes GLib to emit warnings if a function introduced after the selected version is used, even inside a GLIB_CHECK_VERSION guard. The newest GLIB_CHECK_VERSION in pan seems to be for GLib 2.36 (2013), so use that.

Resolves: #128 (closed)


I have successfully compiled Debian's pan 0.146-2 package with the addition of this commit against GLib 2.68, and confirmed that it resolves the build failure, but not otherwise tested the resulting executable (I'm doing QA work for Debian, and I am not a user of pan myself).

To resolve #128 (closed), it is sufficient to apply either this or !15 (merged), but it would be most robust to do both.

Merge request reports