diff --git a/meson.build b/meson.build index 48750d52..5fe269d7 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,7 @@ project( ], meson_version : '>= 0.58.0', # Released on May 2021 ) +xkbcommon_project_version = meson.project_version().split('.') pkgconfig = import('pkgconfig') cc = meson.get_compiler('c') @@ -254,6 +255,19 @@ elif cc.get_argument_syntax() == 'msvc' libxkbcommon_link_deps += libxkbcommon_def libxkbcommon_link_args += '/DEF:' + libxkbcommon_def.full_path() endif +if xkbcommon_project_version[0] != '1' + # The versioning used for the shared libraries assumes that the major + # version of xkbcommon as a whole will increase to 2 if and only if there + # is an ABI break, at which point we should probably bump the SONAME of + # all libraries to .so.2. + error('We probably need to bump the SONAME of libxkbcommon') +else + # To avoid an unnecessary SONAME bump, xkbcommon 1.x.y produces + # libxkbcommon.so.0.x.y. + libxkbcommon_version = '.'.join( + ['0', xkbcommon_project_version[1], xkbcommon_project_version[2]] + ) +endif libxkbcommon = library( 'xkbcommon', 'include/xkbcommon/xkbcommon.h', @@ -261,7 +275,7 @@ libxkbcommon = library( link_args: libxkbcommon_link_args, link_depends: libxkbcommon_link_deps, gnu_symbol_visibility: 'hidden', - version: '0.0.0', + version: libxkbcommon_version, install: true, include_directories: include_directories('src', 'include'), ) @@ -323,6 +337,19 @@ You can disable X11 support with -Denable-x11=false.''') libxkbcommon_x11_link_deps += libxkbcommon_x11_def libxkbcommon_x11_link_args += '/DEF:' + libxkbcommon_x11_def.full_path() endif + if xkbcommon_project_version[0] != '1' + # The versioning used for the shared libraries assumes that the major + # version of xkbcommon as a whole will increase to 2 if and only if there + # is an ABI break, at which point we should probably bump the SONAME of + # all libraries to .so.2. + error('We probably need to bump the SONAME of libxkbcommon-x11') + else + # To avoid an unnecessary SONAME bump, xkbcommon 1.x.y produces + # libxkbcommon-x11.so.0.x.y. + libxkbcommon_x11_version = '.'.join( + ['0', xkbcommon_project_version[1], xkbcommon_project_version[2]] + ) + endif libxkbcommon_x11 = library( 'xkbcommon-x11', 'include/xkbcommon/xkbcommon-x11.h', @@ -330,7 +357,7 @@ You can disable X11 support with -Denable-x11=false.''') link_args: libxkbcommon_x11_link_args, link_depends: libxkbcommon_x11_link_deps, gnu_symbol_visibility: 'hidden', - version: '0.0.0', + version: libxkbcommon_x11_version, install: true, include_directories: include_directories('src', 'include'), link_with: libxkbcommon, @@ -385,6 +412,19 @@ if get_option('enable-xkbregistry') libxkbregistry_link_deps += libxkbregistry_def libxkbregistry_link_args += '/DEF:' + libxkbregistry_def.full_path() endif + if xkbcommon_project_version[0] != '1' + # The versioning used for the shared libraries assumes that the major + # version of xkbcommon as a whole will increase to 2 if and only if there + # is an ABI break, at which point we should probably bump the SONAME of + # all libraries to .so.2. + error('We probably need to bump the SONAME of libxkbregistry') + else + # To avoid an unnecessary SONAME bump, xkbcommon 1.x.y produces + # libxkbregistry.so.0.x.y. + libxkbregistry_version = '.'.join( + ['0', xkbcommon_project_version[1], xkbcommon_project_version[2]] + ) + endif libxkbregistry = library( 'xkbregistry', 'include/xkbcommon/xkbregistry.h', @@ -393,7 +433,7 @@ if get_option('enable-xkbregistry') link_depends: libxkbregistry_link_deps, gnu_symbol_visibility: 'hidden', dependencies: deps_libxkbregistry, - version: '0.0.0', + version: libxkbregistry_version, install: true, include_directories: include_directories('src', 'include'), )