any1 / neatvnc

A liberally licensed VNC server library with a clean interface
ISC License
123 stars 30 forks source link

Consider properly versioning the SONAME of the library #124

Open charles2910 opened 3 weeks ago

charles2910 commented 3 weeks ago

Hi (again :-), first of all, thanks for developing NeatVNC!

(it will be a bit of copy-and-pasta from the issue on AML I've just opened any1/aml#15)

There are many big projects using it nowadays such weston and wayvnc. This means these projects rely on NeatVNC's ABI and so do distro maintainers to guarantee proper transitions when there is an ABI change. Currently, NeatVNC defines a fixed version: '0.0.0', in the library() section of meson.build. This in turn makes meson set the SONAME of the library as the major version of the version string which is always 0.

This complicates things for reverse-dependencies and distros, because one breaking change can be introduced in NeatVNC without bumping the SONAME and all of the sudden the reverse dependencies compiled against an older version of the library will stop working. On distros, we rely on the SONAME to not rebuilding every reverse-dependency when a new (backwards-compatible - therefore the same SONAME) of a library is available.

So, in the end I'd like to see NeatVNC managing the SONAME properly. Ideally, it would stick to the major version while it's backwards-compatible, and bump it when a backwards-incompatible change is introduced (removal of public functions, changes on public available structs, etc.). The patch below does this:

diff --git a/meson.build b/meson.build
index 52f4131..8386f57 100644
--- a/meson.build
+++ b/meson.build
@@ -170,7 +170,7 @@ configure_file(
 neatvnc = library(
        'neatvnc',
        sources,
-       version: '0.0.0',
+       version: meson.project_version(),
        dependencies: dependencies,
        include_directories: inc,
        install: true,

Mind that it will only bump the SONAME when bumping NeatVNC's major version.

If instead you don't want to guarantee ABI compatibility between versions, you can bump the SONAME on every new version:

diff --git a/meson.build b/meson.build
index 52f4131..c0c4e9c 100644
--- a/meson.build
+++ b/meson.build
@@ -170,7 +170,8 @@ configure_file(
 neatvnc = library(
        'neatvnc',
        sources,
-       version: '0.0.0',
+       version: meson.project_version(),
+       soversion: meson.project_version(),
        dependencies: dependencies,
        include_directories: inc,
        install: true,

Also, please consider bumping the SONAME since 0.8.0 breaks the ABI.

Cheers

any1 commented 3 days ago

No worries. I was planning on bumping the soversion on next ABI change. Thanks for the reminder!