diff options
author | Federico Mena Quintero <federico@gnome.org> | 2022-05-23 19:51:36 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2022-05-23 19:51:36 -0500 |
commit | 16dd869a73dfa386f31b74896cf15933330f4867 (patch) | |
tree | 95530506d0fb7ef27051088433036d9d6340baeb | |
parent | a0c5a2694b81318e412776bf6aefda35a625f4ec (diff) | |
download | at-spi2-core-16dd869a73dfa386f31b74896cf15933330f4867.tar.gz |
Build atk as part of at-spi2-core
This is basically about merging atk-toplevel-files/meson.build into
the toplevel meson.build, and fixing up some meson variable names.
One notable change is that ATK's version is kept separate from
at-spi2-core's version, namely in the atk_version variable from
meson. This gets put as ATK_VERSION in config.h.
Then, atk_get_version() is changed to return that ATK_VERSION instead
of the plain VERSION, to avoid confusion. (at-spi2-core does not put
a VERSION macro anywhere, so there's no chance of using the wrong
value, but I prefer to have a namespaced value with an ATK prefix.)
-rw-r--r-- | atk/atkutil.c | 2 | ||||
-rw-r--r-- | atk/meson.build | 16 | ||||
-rw-r--r-- | doc/atk/meson.build | 2 | ||||
-rw-r--r-- | meson.build | 78 |
4 files changed, 87 insertions, 11 deletions
diff --git a/atk/atkutil.c b/atk/atkutil.c index f5efa590..ec61612d 100644 --- a/atk/atkutil.c +++ b/atk/atkutil.c @@ -581,7 +581,7 @@ atk_get_toolkit_version (void) const gchar * atk_get_version (void) { - return VERSION; + return ATK_VERSION; } static void diff --git a/atk/meson.build b/atk/meson.build index d19bbbac..f3e37378 100644 --- a/atk/meson.build +++ b/atk/meson.build @@ -78,12 +78,12 @@ atk_version_conf.set('ATK_MICRO_VERSION', atk_micro_version) atk_version_conf.set('ATK_BINARY_AGE', atk_binary_age) atk_version_conf.set('ATK_INTERFACE_AGE', atk_interface_age) atk_version_conf.set('LT_CURRENT_MINUS_AGE', '0') -atk_version_conf.set('ATK_VERSION', meson.project_version()) +atk_version_conf.set('ATK_VERSION', atk_version) atk_version_h = configure_file(input: 'atkversion.h.in', output: 'atkversion.h', configuration: atk_version_conf, - install_dir: join_paths(atk_includedir, atk_api_path), + install_dir: join_paths(atspi_includedir, atk_api_path), ) # Marshallers @@ -98,7 +98,7 @@ atk_enums = gnome.mkenums('atk-enum-types', sources: atk_headers, c_template: 'atk-enum-types.c.template', h_template: 'atk-enum-types.h.template', - install_dir: join_paths(atk_includedir, atk_api_path), + install_dir: join_paths(atspi_includedir, atk_api_path), install_header: true, ) atk_enum_h = atk_enums[1] @@ -109,7 +109,7 @@ atk_cflags = [ '-DGLIB_DISABLE_DEPRECATION_WARNINGS', '-DATK_DISABLE_DEPRECATION_WARNINGS', '-DATK_COMPILATION', - '-DATK_LOCALEDIR="@0@"'.format(join_paths(atk_datadir, 'locale')), + '-DATK_LOCALEDIR="@0@"'.format(join_paths(atspi_datadir, 'locale')), ] if host_system == 'windows' @@ -127,7 +127,7 @@ libatk = library(atk_api_name, soversion: atk_soversion, version: atk_libversion, install: true, - dependencies: glib_dep, + dependencies: [glib_dep, gobject_dep], include_directories: [ root_inc, atk_inc ], c_args: common_cflags + atk_cflags, link_args: common_ldflags, @@ -135,7 +135,7 @@ libatk = library(atk_api_name, atk_sources_dep = [ atk_enum_h ] -if get_option('introspection') +if have_gir atk_sources_dep += gnome.generate_gir(libatk, sources: atk_sources + atk_headers + [ atk_enum_h ] + [ atk_version_h ], namespace: 'Atk', @@ -155,7 +155,7 @@ endif libatk_dep = declare_dependency(link_with: libatk, include_directories: [ root_inc, atk_inc ], - dependencies: glib_dep, + dependencies: [glib_dep, gobject_dep], sources: atk_sources_dep, ) @@ -164,5 +164,5 @@ pkgconfig.generate(libatk, description: 'Accessibility Toolkit', subdirs: atk_api_name, filebase: 'atk', - libraries: glib_dep, + libraries: [glib_dep, gobject_dep], ) diff --git a/doc/atk/meson.build b/doc/atk/meson.build index 1e491e3e..d9d07ca9 100644 --- a/doc/atk/meson.build +++ b/doc/atk/meson.build @@ -7,7 +7,7 @@ private_headers = [ glib_prefix = dependency('glib-2.0').get_variable(pkgconfig: 'prefix') glib_docpath = glib_prefix / 'share/gtk-doc/html' -docpath = atk_datadir / 'gtk-doc/html' +docpath = atspi_datadir / 'gtk-doc/html' gnome.gtkdoc('atk', main_xml: 'atk-docs.xml', diff --git a/meson.build b/meson.build index 79f5c89e..941b31ba 100644 --- a/meson.build +++ b/meson.build @@ -17,10 +17,84 @@ host_system = host_machine.system() soversion = '0.0.1' +# This is just for atk - preserve the versioning scheme from the unmerged repositories +# until we decide what to do about the versions of different sub-libraries. +atk_version = '2.38.1' +version = atk_version.split('.') +atk_major_version = version[0].to_int() +atk_minor_version = version[1].to_int() +atk_micro_version = version[2].to_int() + +atk_interface_age = 1 +atk_binary_age = 10000 * atk_major_version + 100 * atk_minor_version + 10 + atk_micro_version + +atk_api_version = '1.0' +atk_api_name = 'atk-@0@'.format(atk_api_version) +atk_api_path = '@0@/atk'.format(atk_api_name) + +# Maintain version scheme with libtool +atk_soversion = 0 +current = atk_binary_age - atk_interface_age +atk_libversion = '@0@.@1@.@2@'.format(atk_soversion, current, atk_interface_age) +darwin_versions = ['@0@'.format(current + 1), '@0@.@1@'.format(current + 1, atk_interface_age)] + +add_project_arguments([ '-DG_DISABLE_SINGLE_INCLUDES', '-DATK_DISABLE_SINGLE_INCLUDES' ], language: 'c') + +if cc.get_id() == 'msvc' + add_project_arguments(cc.get_supported_arguments(['-FImsvc_recommended_pragmas.h', '-utf-8']), language: 'c') +endif + +# Compiler and linker flags +common_cflags = [] +common_ldflags = [] + +test_cflags = [] + at_spi_conf = configuration_data() -at_spi_conf.set('GETTEXT_PACKAGE', meson.project_name()) +at_spi_conf.set_quoted('ATK_VERSION', atk_version) +at_spi_conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) + +# Symbol visibility +if get_option('default_library') != 'static' + if host_system == 'windows' + atspi_conf.set('DLL_EXPORT', true) + at_spi_conf.set('_ATK_EXTERN', '__declspec(dllexport) extern') + if cc.get_id() != 'msvc' + test_cflags += ['-fvisibility=hidden'] + endif + else + at_spi_conf.set('_ATK_EXTERN', '__attribute__((visibility("default"))) extern') + test_cflags += ['-fvisibility=hidden'] + endif +endif + +# Check all compiler flags +common_cflags += cc.get_supported_arguments(test_cflags) + +# Linker flags +if host_machine.system() == 'linux' + test_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] + common_ldflags += cc.get_supported_link_arguments(test_ldflags) +endif + +# Maintain compatibility with autotools on macOS +if host_machine.system() == 'darwin' + common_ldflags += [ '-compatibility_version', darwin_versions[0], '-current_version', darwin_versions[1]] +endif + +# Functions +checked_funcs = [ + 'bind_textdomain_codeset', +] + +foreach f: checked_funcs + if cc.has_function(f) + at_spi_conf.set('HAVE_' + f.underscorify().to_upper(), 1) + endif +endforeach root_inc = include_directories('.') +atk_inc = include_directories('atk') registryd_inc = include_directories('registryd') atspi_prefix = get_option('prefix') @@ -118,12 +192,14 @@ xgettext = find_program('xgettext', required : false) configure_file(output: 'config.h', configuration: at_spi_conf) +pkgconfig = import('pkgconfig') gnome = import('gnome') subdir('dbind') subdir('atspi') subdir('bus') subdir('registryd') +subdir('atk') subdir('tests') if get_option('docs') |