Avoid breaking with older binutils (silently not having versioned symbols).

https://github.com/xkbcommon/libxkbcommon/commit/621e31014cbc985bd99d778260ad11a5fee783da
https://github.com/xkbcommon/libxkbcommon/commit/1d8a25d6f10ecfc638d7a889bf7d42f79c692a40

From 621e31014cbc985bd99d778260ad11a5fee783da Mon Sep 17 00:00:00 2001
From: Pierre Le Marre <dev@wismill.eu>
Date: Tue, 16 Jul 2024 07:00:53 +0200
Subject: [PATCH] build: Require meson >= 0.58

This will enable f-strings and allow us to simplify the build file.
---
 meson.build                           | 14 ++++----------
 2 files changed, 5 insertions(+), 10 deletions(-)
 create mode 100644 changes/build/+meson_bump.breaking.md

--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,7 @@ project(
         'warning_level=2',
         'b_lundef=true',
     ],
-    meson_version : '>= 0.52.0',
+    meson_version : '>= 0.58.0', # Released on May 2021
 )
 pkgconfig = import('pkgconfig')
 cc = meson.get_compiler('c')
@@ -270,9 +270,7 @@ dep_libxkbcommon = declare_dependency(
     link_with: libxkbcommon,
     include_directories: include_directories('include'),
 )
-if meson.version().version_compare('>= 0.54.0')
-    meson.override_dependency('xkbcommon', dep_libxkbcommon)
-endif
+meson.override_dependency('xkbcommon', dep_libxkbcommon)
 pkgconfig.generate(
     libxkbcommon,
     name: 'xkbcommon',
@@ -341,9 +339,7 @@ You can disable X11 support with -Denable-x11=false.''')
         link_with: libxkbcommon_x11,
         include_directories: include_directories('include'),
     )
-    if meson.version().version_compare('>= 0.54.0')
-        meson.override_dependency('xkbcommon-x11', dep_libxkbcommon_x11)
-    endif
+    meson.override_dependency('xkbcommon-x11', dep_libxkbcommon_x11)
     pkgconfig.generate(
         libxkbcommon_x11,
         name: 'xkbcommon-x11',
@@ -409,9 +405,7 @@ if get_option('enable-xkbregistry')
         link_with: libxkbregistry,
         include_directories: include_directories('include'),
     )
-    if meson.version().version_compare('>= 0.54.0')
-        meson.override_dependency('xkbregistry', dep_libxkbregistry)
-    endif
+    meson.override_dependency('xkbregistry', dep_libxkbregistry)
 endif
 
 man_pages = []

From 1d8a25d6f10ecfc638d7a889bf7d42f79c692a40 Mon Sep 17 00:00:00 2001
From: Pierre Le Marre <dev@wismill.eu>
Date: Fri, 12 Jul 2024 11:10:46 +0200
Subject: [PATCH] build: Check for --undefined-version support

Gate the use of `--undefined-version` in the linker because it breaks on
older GNU `ld`: https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=58272.
---
 meson.build                 | 11 +++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index e8451b69..d0738468 100644
--- a/meson.build
+++ b/meson.build
@@ -142,10 +142,17 @@ configh_data.set('_CRT_NONSTDC_NO_DEPRECATE', 1)
 # Reduce unnecessary includes on MSVC.
 configh_data.set('WIN32_LEAN_AND_MEAN', 1)
 
+xkbcommon_map = meson.current_source_dir() / 'xkbcommon.map'
+
 # Supports -Wl,--version-script?
+if cc.has_link_argument('-Wl,--undefined-version')
+    extra_linker_args = ',--undefined-version'
+else
+    extra_linker_args = ''
+endif
 have_version_script = cc.links(
     'int main(){}',
-    args: '-Wl,--undefined-version,--version-script=' + meson.current_source_dir()/'xkbcommon.map',
+    args: f'-Wl,--version-script=@xkbcommon_map@@extra_linker_args@',
     name: '-Wl,--version-script',
 )
 
@@ -235,7 +242,7 @@ libxkbcommon_sources = [
 libxkbcommon_link_args = []
 libxkbcommon_link_deps = []
 if have_version_script
-    libxkbcommon_link_args += '-Wl,--version-script=' + meson.current_source_dir()/'xkbcommon.map'
+    libxkbcommon_link_args += f'-Wl,--version-script=@xkbcommon_map@'
     libxkbcommon_link_deps += 'xkbcommon.map'
 elif cc.get_argument_syntax() == 'msvc'
     libxkbcommon_def = custom_target('xkbcommon.def',
