[libgweather/ebassi/gtk4] Bump up the API version of libgweather



commit b6feff04c389621681fbdd356269ca4d2f291c97
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Oct 13 12:35:34 2021 +0100

    Bump up the API version of libgweather
    
    We're now at 4.0. The version bump requires some additional changes:
    
    - the project version is 3.90, while we are in a development cycle
    - the main gettext domain has been changed to libgweather-4.0
    - the gettext domain for the locations has been changed to
      libgweather-4.0-locations
    - the settings schemas have been changed to org.gnome.GWeather4
    - the soname of the shared library has been changed to match the
      versioning scheme used by GLib and GTK

 doc/meson.build                                    |  2 +-
 libgweather/gweather-weather.c                     |  2 +-
 libgweather/meson.build                            | 38 ++++++++++++----------
 libgweather/tests/test_libgweather.c               | 12 +++----
 meson.build                                        | 25 ++++----------
 po-locations/meson.build                           |  3 +-
 po/meson.build                                     |  3 +-
 schemas/meson.build                                |  6 ++--
 ...gschema.xml => org.gnome.GWeather4.gschema.xml} | 12 +++----
 9 files changed, 46 insertions(+), 57 deletions(-)
---
diff --git a/doc/meson.build b/doc/meson.build
index 7e18715b..7ee4cd0a 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -21,7 +21,7 @@ if get_option('gtk_doc') and get_option('introspection')
 
   custom_target('libgweather-doc',
     input: gweather_gir[0],
-    output: 'libgweather-3.0',
+    output: libgweather_full_version,
     command: [
       gidocgen,
       'generate',
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 3e8b60a6..53b85523 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -563,7 +563,7 @@ void
 gweather_info_init (GWeatherInfo *info)
 {
     info->providers = GWEATHER_PROVIDER_METAR | GWEATHER_PROVIDER_IWIN;
-    info->settings = g_settings_new ("org.gnome.GWeather");
+    info->settings = g_settings_new ("org.gnome.GWeather4");
 
     g_signal_connect_object (info->settings, "changed",
                             G_CALLBACK (settings_changed_cb), info, 0);
diff --git a/libgweather/meson.build b/libgweather/meson.build
index a534bfd6..d50036f1 100644
--- a/libgweather/meson.build
+++ b/libgweather/meson.build
@@ -22,16 +22,17 @@ add_project_arguments(c_compiler.get_supported_arguments([
   '-Werror=missing-include-dirs',
 ]), language: 'c')
 
-header_subdir = 'libgweather-3.0/libgweather'
-
-# convert to soname
-current = libgweather_lt_c - libgweather_lt_a
-interface_age = libgweather_lt_r
-libgweather_so_version = '@0@.@1@.@2@'.format(
-  current,
-  libgweather_lt_a,
-  interface_age,
-)
+header_subdir = libgweather_full_version / 'libgweather'
+
+libgweather_major = libgweather_version[0].to_int()
+libgweather_minor = libgweather_version[1].to_int()
+libgweather_micro = libgweather_version[2].to_int()
+interface_age = libgweather_minor.is_odd() ? 0 : libgweather_micro
+binary_age = libgweather_minor * 100 + libgweather_micro
+current = binary_age - interface_age
+
+libgweather_soversion = 0
+libgweather_library_version = '@0@.@1@.@2@'.format(libgweather_soversion, current, interface_age)
 
 libgweather_darwin_versions = [
   current + 1,
@@ -80,9 +81,9 @@ configure_file(
 )
 
 versionconf = configuration_data()
-versionconf.set('GWEATHER_MAJOR_VERSION', libgweather_version[0])
-versionconf.set('GWEATHER_MINOR_VERSION', libgweather_version[1])
-versionconf.set('GWEATHER_MICRO_VERSION', libgweather_version[2])
+versionconf.set('GWEATHER_MAJOR_VERSION', libgweather_major)
+versionconf.set('GWEATHER_MINOR_VERSION', libgweather_minor)
+versionconf.set('GWEATHER_MICRO_VERSION', libgweather_micro)
 versionconf.set_quoted('GWEATHER_VERSION', meson.project_version())
 configure_file(
   input: 'gweather-version.h.in',
@@ -164,10 +165,11 @@ libgweather_static_dep = declare_dependency(sources: gweather_c_sources,
   link_with: libgweather_static,
 )
 
-lib_libgweather = shared_library('gweather-3',
+lib_libgweather = shared_library('gweather-4',
   dependencies: deps_libgweather,
   link_whole: libgweather_static,
-  version: libgweather_so_version,
+  soversion: libgweather_soversion,
+  version: libgweather_library_version,
   gnu_symbol_visibility: 'hidden',
   darwin_versions: libgweather_darwin_versions,
   include_directories: [
@@ -191,12 +193,12 @@ if build_gir
   gweather_gir = gnome.generate_gir(lib_libgweather,
     sources: introspection_sources,
     dependencies: deps_libgweather,
-    nsversion: '3.0',
+    nsversion: libgweather_api_version,
     namespace: 'GWeather',
     includes: ['GObject-2.0', 'Gtk-3.0'],
     symbol_prefix: 'gweather',
     identifier_prefix: 'GWeather',
-    export_packages: 'gweather-3.0',
+    export_packages: 'gweather-' + libgweather_api_version,
     header: 'libgweather/gweather.h',
     extra_args: [
       '--warn-all',
@@ -220,7 +222,7 @@ libgweather_dep = declare_dependency(
 )
 
 if build_vapi and build_gir
-  gnome.generate_vapi('gweather-3.0',
+  gnome.generate_vapi('gweather-' + libgweather_api_version,
     sources: gweather_gir[0],
     packages: ['gobject-2.0', 'gtk+-3.0'],
     metadata_dirs: '.',
diff --git a/libgweather/tests/test_libgweather.c b/libgweather/tests/test_libgweather.c
index d00159d4..1cc8a49b 100644
--- a/libgweather/tests/test_libgweather.c
+++ b/libgweather/tests/test_libgweather.c
@@ -457,22 +457,22 @@ set_gsettings (void)
        g_assert_nonnull (tmpdir);
 
        /* Copy the schemas files */
-       g_assert_true (g_file_get_contents (SCHEMAS_BUILDDIR "/org.gnome.GWeather.enums.xml", &schema_text, 
NULL, NULL));
-       dest = g_strdup_printf ("%s/org.gnome.GWeather.enums.xml", tmpdir);
+       g_assert_true (g_file_get_contents (SCHEMAS_BUILDDIR "/org.gnome.GWeather4.enums.xml", &schema_text, 
NULL, NULL));
+       dest = g_build_filename (tmpdir, "org.gnome.GWeather4.enums.xml", NULL);
        g_assert_true (g_file_set_contents (dest, schema_text, -1, NULL));
        g_free (dest);
        g_free (schema_text);
 
-       g_assert_true (g_file_get_contents (SCHEMASDIR "/org.gnome.GWeather.gschema.xml", &schema_text, NULL, 
NULL));
-       dest = g_strdup_printf ("%s/org.gnome.GWeather.gschema.xml", tmpdir);
+       g_assert_true (g_file_get_contents (SCHEMASDIR "/org.gnome.GWeather4.gschema.xml", &schema_text, 
NULL, NULL));
+       dest = g_build_filename (tmpdir, "org.gnome.GWeather4.gschema.xml", NULL);
        g_assert_true (g_file_set_contents (dest, schema_text, -1, NULL));
        g_free (dest);
        g_free (schema_text);
 
        /* Compile the schemas */
        cmdline = g_strdup_printf ("glib-compile-schemas --targetdir=%s "
-                                  "--schema-file=%s/org.gnome.GWeather.enums.xml "
-                                  "--schema-file=%s/org.gnome.GWeather.gschema.xml",
+                                  "--schema-file=%s/org.gnome.GWeather4.enums.xml "
+                                  "--schema-file=%s/org.gnome.GWeather4.gschema.xml",
                                   tmpdir, SCHEMAS_BUILDDIR, SCHEMASDIR);
        g_assert_true (g_spawn_command_line_sync (cmdline, NULL, NULL, &result, NULL));
        g_assert_cmpint (result, ==, 0);
diff --git a/meson.build b/meson.build
index 136dcdc4..8c84f43b 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
 project('libgweather', 'c',
-  version: '40.0',
+  version: '3.90.0',
   license: 'GPL-2.0-or-later',
   meson_version: '>= 0.55.0',
   default_options: [
@@ -9,20 +9,9 @@ project('libgweather', 'c',
   ],
 )
 
-# Add another 0, so that we can release without a suffix
-libgweather_version = meson.project_version().split('.') + [0]
-
-# We use libtool-version numbers because it's easier to understand.
-# Before making a release, the libgweather_so_*
-# numbers should be modified. The components are of the form C:R:A.
-# a) If binary compatibility has been broken (eg removed or changed interfaces)
-#    change to C+1:0:0.
-# b) If interfaces have been changed or added, but binary compatibility has
-#    been preserved, change to C+1:0:A+1
-# c) If the interface is the same as the previous version, change to C:R+1:A
-libgweather_lt_c=16
-libgweather_lt_r=0
-libgweather_lt_a=0
+libgweather_version = meson.project_version().split('.')
+libgweather_api_version = '4.0'
+libgweather_full_version = '@0@-@1@'.format(meson.project_name(), libgweather_api_version)
 
 pkgconfig = import('pkgconfig')
 gnome = import('gnome')
@@ -45,7 +34,7 @@ gtk_req_version = '>= 3.13.5'
 libsoup_req_version = '>= 2.44.0'
 libxml_req_version = '>= 2.6.0'
 
-GETTEXT_PACKAGE = 'libgweather-3.0'
+GETTEXT_PACKAGE = libgweather_full_version
 
 pylint = find_program('pylint-3', 'pylint3', 'pylint', required: false)
 pylint_flags = [
@@ -77,12 +66,12 @@ subdir('po-locations')
 meson.add_install_script('build-aux/meson/meson_post_install.py')
 
 pkgconfig.generate(
-  filebase: 'gweather-3.0',
+  filebase: 'gweather-' + libgweather_api_version,
   name: 'GWeather',
   description: 'GWeather shared library',
   version: meson.project_version(),
   libraries: lib_libgweather,
-  subdirs: 'libgweather-3.0',
+  subdirs: libgweather_full_version,
   requires: [
     'gtk+-3.0',
   ],
diff --git a/po-locations/meson.build b/po-locations/meson.build
index 7aa587da..6ad5af84 100644
--- a/po-locations/meson.build
+++ b/po-locations/meson.build
@@ -1,5 +1,4 @@
 # XXX: This should be a files() object in data/ but i18n.gettext() does not
 # like that with Meson 0.43
 locations_its = join_paths(meson.current_source_dir(), '../data/locations.its')
-i18n.gettext('libgweather-locations',
-             args: ['--its', locations_its])
+i18n.gettext(GETTEXT_PACKAGE + '-locations', args: ['--its', locations_its])
diff --git a/po/meson.build b/po/meson.build
index 0136c4c8..a9e1d3e6 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,2 +1 @@
-i18n.gettext('libgweather-3.0',
-             preset: 'glib')
+i18n.gettext(GETTEXT_PACKAGE, preset: 'glib')
diff --git a/schemas/meson.build b/schemas/meson.build
index 677e4ef5..3226aef0 100644
--- a/schemas/meson.build
+++ b/schemas/meson.build
@@ -1,12 +1,12 @@
 gsettingsdir = datadir / 'glib-2.0/schemas'
-install_data('org.gnome.GWeather.gschema.xml',
+install_data('org.gnome.GWeather4.gschema.xml',
   install_dir: gsettingsdir,
 )
 
-gnome.mkenums('org.gnome.GWeather.enums.xml',
+gnome.mkenums('org.gnome.GWeather4.enums.xml',
   comments: '<!-- @comment@ -->',
   fhead: '<schemalist>',
-  vhead: '<@type@ id="org.gnome.GWeather.@EnumName@">',
+  vhead: '<@type@ id="org.gnome.GWeather4.@EnumName@">',
   vprod: '<value nick="@valuenick@" value="@valuenum@"/>',
   vtail: '</@type@>',
   ftail: '</schemalist>',
diff --git a/schemas/org.gnome.GWeather.gschema.xml b/schemas/org.gnome.GWeather4.gschema.xml
similarity index 85%
rename from schemas/org.gnome.GWeather.gschema.xml
rename to schemas/org.gnome.GWeather4.gschema.xml
index 14818425..43de2361 100644
--- a/schemas/org.gnome.GWeather.gschema.xml
+++ b/schemas/org.gnome.GWeather4.gschema.xml
@@ -1,5 +1,5 @@
-<schemalist gettext-domain="libgweather-3.0">
-  <schema id="org.gnome.GWeather" path="/org/gnome/GWeather/">
+<schemalist gettext-domain="libgweather-4.0">
+  <schema id="org.gnome.GWeather4" path="/org/gnome/GWeather4/">
     <key name="radar" type="s">
       <default>''</default>
       <summary>URL for the radar map</summary>
@@ -8,7 +8,7 @@
        for disabling radar maps.
       </description>
     </key>
-    <key name="temperature-unit" enum="org.gnome.GWeather.GWeatherTemperatureUnit">
+    <key name="temperature-unit" enum="org.gnome.GWeather4.GWeatherTemperatureUnit">
       <default>'default'</default>
       <summary>Temperature unit</summary>
       <description>
@@ -16,7 +16,7 @@
        “centigrade” and “fahrenheit”.
       </description>
     </key>
-    <key name="distance-unit" enum="org.gnome.GWeather.GWeatherDistanceUnit">
+    <key name="distance-unit" enum="org.gnome.GWeather4.GWeatherDistanceUnit">
       <default>'default'</default>
       <summary>Distance unit</summary>
       <description>
@@ -24,7 +24,7 @@
        distance of important events). Valid values are “meters”, “km” and “miles”.
       </description>
     </key>
-    <key name="speed-unit" enum="org.gnome.GWeather.GWeatherSpeedUnit">
+    <key name="speed-unit" enum="org.gnome.GWeather4.GWeatherSpeedUnit">
       <default>'default'</default>
       <summary>Speed unit</summary>
       <description>
@@ -33,7 +33,7 @@
        per hour), “knots” and “bft” (Beaufort scale).
       </description>
     </key>
-    <key name="pressure-unit" enum="org.gnome.GWeather.GWeatherPressureUnit">
+    <key name="pressure-unit" enum="org.gnome.GWeather4.GWeatherPressureUnit">
       <default>'default'</default>
       <summary>Pressure unit</summary>
       <description>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]