From eb0f326381f1d3dca219d2140643d05db9af537e Mon Sep 17 00:00:00 2001 From: Arnaud B Date: Thu, 31 Oct 2019 20:48:04 +0000 Subject: [PATCH] Add Meson support https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting https://gitlab.gnome.org/GNOME/libgnome-games-support/merge_requests/2 Co-Authored-By: Jan Tojnar Co-Authored-By: Michael Catanzaro --- games/meson.build | 56 +++++++++++++++++++++++++++++++++++++++++++++++ meson.build | 46 ++++++++++++++++++++++++++++++++++++++ po/meson.build | 1 + tests/meson.build | 18 +++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 games/meson.build create mode 100644 meson.build create mode 100644 po/meson.build create mode 100644 tests/meson.build diff --git a/games/meson.build b/games/meson.build new file mode 100644 index 0000000..bb551ab --- /dev/null +++ b/games/meson.build @@ -0,0 +1,56 @@ +includesubdir = 'gnome-games-support-1' + +lggs_interface_deps = [ + gee_dependency, + gio_dependency, + glib_dependency, + gtk_dependency, +] + +lggs = library('gnome-games-support-1', + [ + 'config.vapi', + 'gridframe.vala', + 'scores/category.vala', + 'scores/context.vala', + 'scores/dialog.vala', + 'scores/directory-importer.vala', + 'scores/history-file-importer.vala', + 'scores/importer.vala', + 'scores/score.vala', + ], + install: true, + install_dir: [ + true, # default libdir + join_paths(includedir, includesubdir), # headers + true, # default vapidir + ], + c_args: [ + # https://github.com/mesonbuild/meson/issues/4763 + '-include', 'config.h' + ], + vala_header: 'libgnome-games-support.h', + vala_vapi: 'libgnome-games-support-1.vapi', + vala_args: [ + '--abi-stability', + '--target-glib=2.44', + ], + soversion: soversion, + version: library_version, + dependencies: lggs_interface_deps, +) + +lggs_dependency = declare_dependency( + link_with: lggs, + include_directories: include_directories('.'), +) + +pkg = import('pkgconfig') +pkg.generate( + lggs, + filebase: 'libgnome-games-support-1', + requires: lggs_interface_deps, + name: meson.project_name(), + description: 'Useful functionality shared among GNOME games', + subdirs: includesubdir, +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..8aad65e --- /dev/null +++ b/meson.build @@ -0,0 +1,46 @@ +project( + 'libgnome-games-support', ['vala', 'c'], + version: '1.4.4', + license: 'LGPLv3+', + meson_version: '>= 0.50.0', +) + +# Before making a release, the library_version string should be modified. +# +# * Bump the first component if binary compatibility has been broken; or +# * Bump the second component if new APIs are added; or +# * Bump the third component otherwise. +# +# When bumping the first component version, set the second and third components +# to 0. When bumping the second version, set the third one to zero. +# +# A lot easier than libtool, right? +library_version = '3.0.1' +soversion = library_version.split('.')[0] + +# used to install help +gnome = import('gnome') +# used for internationalization +i18n = import('i18n') + +cc = meson.get_compiler('c') +valac = meson.get_compiler('vala') # TODO 0.39.6 min + +gee_dependency = dependency('gee-0.8', version: '>= 0.14.0') +gio_dependency = dependency('gio-2.0', version: '>= 2.40.0') +glib_dependency = dependency('glib-2.0', version: '>= 2.40.0') +gtk_dependency = dependency('gtk+-3.0', version: '>= 3.19.2') + +localedir = join_paths(get_option('prefix'), get_option('localedir')) +includedir = join_paths(get_option('prefix'), get_option('includedir')) + +conf = configuration_data() +conf.set_quoted('VERSION', meson.project_version()) +conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) +conf.set_quoted('LOCALEDIR', localedir) + +configure_file(output: 'config.h', configuration: conf) + +subdir('po') +subdir('games') +subdir('tests') diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..e9b77d7 --- /dev/null +++ b/po/meson.build @@ -0,0 +1 @@ +i18n.gettext(meson.project_name(), preset: 'glib') diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..9f6ce1c --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,18 @@ +lggs_tests = executable( + 'libgnome-games-support-tests', + [ 'test-scores.vala' ], + vala_args: [ + '--target-glib=2.44', + ], + dependencies: [ + gee_dependency, + glib_dependency, + gtk_dependency, + lggs_dependency, + ], +) +test( + 'libgnome-games-support-tests', + lggs_tests, + timeout: 1, +) -- 2.24.1