meson: fix the shared object version.

The current code was wrong, hence was producing wrongly versioned shared
library files. This commit do it the same way as we do it on autotools build,
and additionally compute the library version (since "current:revision:age" gets
transformed into "(current - age).age.revision" by libtool, but meson doesn't
use libtool so we have to do this ourselves).

Now meson and autotools builds produce the same result at least. There are still
some points I'm wondering and which we should handle before GIMP 3.0 release:

* Since meson doesn't use libtool (and no .la files are created), should we
  actually stick to libtool version scheme? It seems like some projects would
  use semver instead. On the other hand libtool version gives a bit more info.
* Also it raises the question on whether we want the API version to be semver at
  all or simply follow GIMP version? It used not to be much of a problem as we
  wouldn't add features (hence new API) on micro version, yet now we can. So
  GIMP program's version could not pass as semantic versioning. On the other
  hand, having a diverging API version (whose minor version would increment
  faster in particular, with regular micro version resets) would be confusing
  too.
* If we keep libtool versioning, I'm thinking we should do it manually. It's
  actually pretty easy with a good docs (or even just following GNU docs:
  https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html),
  and simple to understand whereas the current code logic is very weird and we
  end up with huge current and age values with complicated computation.

Note also that I raise the "Libtool versioning" section near meson.build top and
updated gimp_interface_age to be the same as on autotools currently.
This commit is contained in:
Jehan 2022-12-12 19:58:17 +01:00
parent d5d0808fee
commit 8ab38eb883

View file

@ -51,6 +51,18 @@ gimp_api_version = '@0@.@1@'.format(api_version_major, api_version_minor)
gimp_api_name = 'gimp-' + gimp_api_version
# Libtool versioning
gimp_interface_age = 15
gimp_binary_age = 100 * gimp_app_version_minor + gimp_app_version_micro
lt_current = 100 * gimp_app_version_minor + gimp_app_version_micro - gimp_interface_age
lt_revision = gimp_interface_age
lt_age = gimp_binary_age - gimp_interface_age
# libtool's -version-info transforms "current:revision:age" into "(current - age).age.revision".
# Let's compute this ourselves.
so_version = '@0@.@1@.@2@'.format(lt_current - lt_age, lt_age, lt_revision)
gimp_command = 'gimp-' + gimp_app_version
@ -76,14 +88,6 @@ versionconfig.set('GIMP_VERSION', gimp_version)
versionconfig.set('GIMP_API_VERSION', gimp_api_version)
# Libtool versioning
gimp_interface_age = 0
lt_current = 0
lt_revision = gimp_app_version_micro
lt_age = 100*api_version_minor + 0
so_version = '@0@.@1@.@2@'.format(lt_current, lt_age, lt_revision)
################################################################################
# Get configuration and Meson modules