[json-glib: 3/11] build: Clean up the hard-coded API version numbers
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [json-glib: 3/11] build: Clean up the hard-coded API version numbers
- Date: Mon, 10 Jul 2017 15:22:21 +0000 (UTC)
commit bbb2fbe4afb6fe071a4642e0dd0f08abfb8333c7
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Jul 10 10:28:57 2017 +0100
build: Clean up the hard-coded API version numbers
In order to be resilient towards future API bumps, we should have very
few places that deal with the API version encoded inside paths and file
names.
doc/xml/meson.build | 6 +++---
json-glib/meson.build | 12 ++++++------
json-glib/tests/meson.build | 4 ++--
meson.build | 25 ++++++++++---------------
po/meson.build | 2 +-
5 files changed, 22 insertions(+), 27 deletions(-)
---
diff --git a/doc/xml/meson.build b/doc/xml/meson.build
index 668435a..587d773 100644
--- a/doc/xml/meson.build
+++ b/doc/xml/meson.build
@@ -2,10 +2,10 @@ ent_conf = configuration_data()
ent_conf.set('PACKAGE', 'JSON-GLib')
ent_conf.set('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=json-glib')
ent_conf.set('PACKAGE_NAME', 'JSON-GLib')
-ent_conf.set('PACKAGE_STRING', 'json-glib')
-ent_conf.set('PACKAGE_TARNAME', 'json-glib-' + meson.project_version())
+ent_conf.set('PACKAGE_STRING', meson.project_name())
+ent_conf.set('PACKAGE_TARNAME', '@0@-@1@'.format(meson.project_name(), meson.project_version()))
ent_conf.set('PACKAGE_URL', 'http://wiki.gnome.org/Project/JsonGlib')
ent_conf.set('PACKAGE_VERSION', meson.project_version())
-ent_conf.set('PACKAGE_API_VERSION', apiversion)
+ent_conf.set('PACKAGE_API_VERSION', json_api_version)
configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
diff --git a/json-glib/meson.build b/json-glib/meson.build
index d636400..09ac672 100644
--- a/json-glib/meson.build
+++ b/json-glib/meson.build
@@ -1,4 +1,4 @@
-install_header_subdir = 'json-glib-1.0/json-glib'
+install_header_subdir = join_paths(json_api_name, 'json-glib')
install_header_dir = join_paths(json_includedir, install_header_subdir)
configure_file(output: 'config.h', configuration: cdata)
@@ -73,7 +73,7 @@ if host_system == 'darwin'
common_ldflags += [ '-compatibility_version=1', '-current_version=1.0', ]
endif
-json_lib = library('json-glib-1.0',
+json_lib = library(json_api_name,
source_c + json_glib_enums,
version: libversion,
soversion: soversion,
@@ -86,10 +86,10 @@ json_lib = library('json-glib-1.0',
pkgg = import('pkgconfig')
pkgg.generate(libraries: [ json_lib ],
- subdirs: 'json-glib-@0@'.format(apiversion),
+ subdirs: json_api_name,
version: json_version,
name: 'JSON-GLib',
- filebase: 'json-glib-@0@'.format(apiversion),
+ filebase: json_api_name,
description: 'JSON Parser for GLib.',
requires: 'gio-2.0')
@@ -107,10 +107,10 @@ if build_gir
gnome.generate_gir(json_lib,
sources: source_c + source_h + json_glib_enums + [ json_version_h ],
namespace: 'Json',
- nsversion: apiversion,
+ nsversion: json_api_version,
identifier_prefix: 'Json',
symbol_prefix: 'json',
- export_packages: 'json-glib-1.0',
+ export_packages: json_api_name,
includes: [ 'GObject-2.0', 'Gio-2.0', ],
install: true,
extra_args: gir_args)
diff --git a/json-glib/tests/meson.build b/json-glib/tests/meson.build
index c1cfee2..a80e8ce 100644
--- a/json-glib/tests/meson.build
+++ b/json-glib/tests/meson.build
@@ -19,8 +19,8 @@ test_data = [
'stream-load.json',
]
-installed_test_bindir = join_paths(json_libexecdir, 'installed-tests', 'json-glib-1.0')
-installed_test_datadir = join_paths(json_datadir, 'installed-tests', 'json-glib-1.0')
+installed_test_bindir = join_paths(json_libexecdir, 'installed-tests', json_api_name)
+installed_test_datadir = join_paths(json_datadir, 'installed-tests', json_api_name)
install_data(test_data, install_dir: installed_test_bindir)
diff --git a/meson.build b/meson.build
index 902692c..aa32885 100644
--- a/meson.build
+++ b/meson.build
@@ -7,29 +7,23 @@ project('json-glib', 'c', version: '1.3.1',
],
meson_version: '>= 0.40.1')
-
-# Versionning
+# Versioning
json_version = meson.project_version()
version_arr = json_version.split('.')
json_version_major = version_arr[0].to_int()
json_version_minor = version_arr[1].to_int()
json_version_micro = version_arr[2].to_int()
-apiversion = '1.0'
+json_interface_age = json_version_minor.is_even() ? json_version_micro : 0
+json_binary_age = 100 * json_version_minor + json_version_micro
+json_api_version = '1.0'
-if json_version_minor.is_odd()
- json_interface_age = 0
-else
- json_interface_age = json_version_micro
-endif
+json_api_name = '@0@-@1@'.format(meson.project_name(), json_api_version)
+json_gettext_domain = json_api_name
-# maintaining compatibility with the previous libtool versioning
-# current = minor * 100 + micro - interface
-# revision = interface
+# Maintain compatibility with the old soname versioning
soversion = 0
-current = json_version_minor * 100 + json_version_micro - json_interface_age
-revision = json_interface_age
-libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
+libversion = '@0@.@1@.@2@'.format(soversion, json_binary_age - json_interface_age, json_interface_age)
# Paths
json_includedir = join_paths(get_option('prefix'), get_option('includedir'))
@@ -58,7 +52,8 @@ foreach h: check_headers
cdata.set(h.get(1), 1)
endif
endforeach
-cdata.set_quoted('GETTEXT_PACKAGE', 'json-glib-1.0')
+
+cdata.set_quoted('GETTEXT_PACKAGE', json_gettext_domain)
if cc.get_id() == 'msvc'
# Compiler options taken from msvc_recommended_pragmas.h
diff --git a/po/meson.build b/po/meson.build
index d6af0ce..f674ffa 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,3 +1,3 @@
i18n = import('i18n')
-i18n.gettext('json-glib-1.0', preset: 'glib')
+i18n.gettext(json_gettext_domain, preset: 'glib')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]