libs: Tie DSO minor versions to libdrm version

There is an excellent writeup explaining this requirement here:
    https://gitlab.freedesktop.org/wayland/wayland/-/issues/175

In short, for mixed environments such as the Steam Runtime and other
container-like environments, choosing which libdrm to link into the
client's address space is a hard problem. If the runtime has a newer
libdrm than the host, then it should be preferred, because the client
may be using newly-added symbols. But if the host has a newer libdrm,
then that should be used, because drivers may be depending on those.

Bumping the DSO minor version is transparent to all users because apps
only link against the major version, e.g. DT_NEEDED libdrm.so.2; the
fact that libdrm.so.2 is a link to libdrm.so.2.122.0 is a detail known
only to the loader, but it does let a smart runtime make better
decisions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2024-07-17 13:07:00 +01:00
parent 4bd09d78df
commit b0815faac0
10 changed files with 17 additions and 10 deletions

View file

@ -37,7 +37,7 @@ libdrm_amdgpu = library(
include_directories : [inc_root, inc_drm],
link_with : libdrm,
dependencies : [dep_threads, dep_atomic_ops, dep_rt],
version : '1.0.0',
version : '1.@0@.0'.format(patch_ver),
install : true,
)

View file

@ -33,7 +33,7 @@ libdrm_etnaviv = library(
c_args : libdrm_c_args,
gnu_symbol_visibility : 'hidden',
dependencies : [dep_threads, dep_rt, dep_atomic_ops],
version : '1.0.0',
version : '1.@0@.0'.format(patch_ver),
install : true,
)

View file

@ -26,7 +26,7 @@ libdrm_exynos = library(
include_directories : [inc_root, inc_drm],
link_with : libdrm,
dependencies : [dep_threads],
version : '1.0.0',
version : '1.@0@.0'.format(patch_ver),
install : true,
)

View file

@ -46,7 +46,7 @@ libdrm_freedreno = library(
include_directories : [inc_root, inc_drm],
dependencies : [dep_valgrind, dep_threads, dep_rt, dep_atomic_ops],
link_with : libdrm,
version : '1.0.0',
version : '1.@0@.0'.format(patch_ver),
install : true,
)

View file

@ -32,7 +32,7 @@ libdrm_intel = library(
dependencies : [dep_pciaccess, dep_threads, dep_rt, dep_valgrind, dep_atomic_ops],
c_args : libdrm_c_args,
gnu_symbol_visibility : 'hidden',
version : '1.0.0',
version : '1.@0@.0'.format(patch_ver),
install : true,
)

View file

@ -18,6 +18,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# The versioning should always stay at 2.4.x. If bumping away from this,
# you must ensure that all users of patch_ver are changed such that DSO versions
# continuously increment (e.g. blindly bumping from 2.4.122 to 2.5.0 would
# roll the libdrm DSO versioning from libdrm.so.2.122.0 back to libdrm.so.2.0.0
# which would be bad)
project(
'libdrm',
['c'],
@ -27,6 +32,8 @@ project(
default_options : ['buildtype=debugoptimized', 'c_std=c11'],
)
patch_ver = meson.project_version().split('.')[2]
if ['windows', 'darwin'].contains(host_machine.system())
error('unsupported OS: @0@'.format(host_machine.system()))
endif
@ -256,7 +263,7 @@ libdrm_files = [files(
if android
libdrm_kw = {}
else
libdrm_kw = {'version' : '2.4.0'}
libdrm_kw = { 'version' : '2.@0@.0'.format(patch_ver) }
endif
libdrm = library(

View file

@ -27,7 +27,7 @@ libdrm_nouveau = library(
include_directories : [inc_root, inc_drm],
link_with : libdrm,
dependencies : [dep_threads, dep_atomic_ops],
version : '2.0.0',
version : '2.@0@.0'.format(patch_ver),
install : true,
)

View file

@ -26,7 +26,7 @@ libdrm_omap = library(
gnu_symbol_visibility : 'hidden',
link_with : libdrm,
dependencies : [dep_threads, dep_atomic_ops],
version : '1.0.0',
version : '1.@0@.0'.format(patch_ver),
install : true,
)

View file

@ -33,7 +33,7 @@ libdrm_radeon = library(
include_directories : [inc_root, inc_drm],
link_with : libdrm,
dependencies : [dep_threads, dep_atomic_ops],
version : '1.0.1',
version : '1.@0@.0'.format(patch_ver),
install : true,
)

View file

@ -31,7 +31,7 @@ libdrm_tegra = library(
dependencies : [dep_threads, dep_atomic_ops],
c_args : libdrm_c_args,
gnu_symbol_visibility : 'hidden',
version : '0.0.0',
version : '0.@0@.0'.format(patch_ver),
install : true,
)