[libgnomekbd/tintou/meson] Add meson build system
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgnomekbd/tintou/meson] Add meson build system
- Date: Mon, 13 Jun 2022 21:04:03 +0000 (UTC)
commit d06cda624fece7967e0197940055cef30c9f517c
Author: Corentin Noël <corentin noel collabora com>
Date: Mon Jun 13 22:58:52 2022 +0200
Add meson build system
Signed-off-by: Corentin Noël <corentin noel collabora com>
libgnomekbd/meson.build | 171 ++++++++++++++++++++++++++++++++++++++++++++++++
meson.build | 54 +++++++++++++++
meson_options.txt | 9 +++
po/meson.build | 3 +
test/meson.build | 17 +++++
5 files changed, 254 insertions(+)
---
diff --git a/libgnomekbd/meson.build b/libgnomekbd/meson.build
new file mode 100644
index 0000000..f7c228c
--- /dev/null
+++ b/libgnomekbd/meson.build
@@ -0,0 +1,171 @@
+pkg_data_dir = get_option('prefix') / get_option('datadir') / 'libgnomekbd'
+ui_dir = pkg_data_dir / 'ui'
+icons_dir = pkg_data_dir / 'icons'
+
+install_data(
+ 'show-layout.ui',
+ install_dir: ui_dir
+)
+
+install_data(
+ 'kbdled-caps-lock.svg',
+ 'kbdled-num-lock.svg',
+ 'kbdled-scroll-lock.svg',
+ install_dir: icons_dir
+)
+
+libgnomekbd_deps = [
+ glib_dep,
+ gobject_dep,
+ gio_dep,
+ gdk_dep,
+ gtk_dep,
+ x11_dep,
+ libxklavier_dep,
+]
+
+libgnomekbd_sources = files(
+ 'gkbd-desktop-config.c',
+ 'gkbd-keyboard-config.c',
+ 'gkbd-util.c',
+)
+
+libgnomekbd_headers = files(
+ 'gkbd-desktop-config.h',
+ 'gkbd-keyboard-config.h',
+ 'gkbd-util.h',
+)
+
+libgnomekbd_lib = library(
+ 'gnomekbd',
+ libgnomekbd_sources,
+ config_h,
+ dependencies: libgnomekbd_deps,
+ include_directories: root_include,
+ version: meson.project_version(),
+ soversion: library_version,
+ install: true,
+)
+
+libgnomekbd_dep = declare_dependency(
+ link_with: libgnomekbd_lib,
+ include_directories: root_include,
+ dependencies: libgnomekbd_deps,
+ sources: config_h,
+)
+
+libgnomekbdui_sources = files(
+ 'gkbd-configuration.c',
+ 'gkbd-indicator-config.c',
+ 'gkbd-indicator.c',
+ 'gkbd-status.c',
+ 'gkbd-keyboard-drawing.c',
+)
+
+libgnomekbdui_headers = files(
+ 'gkbd-configuration.h',
+ 'gkbd-indicator.h',
+ 'gkbd-status.h',
+ 'gkbd-indicator-config.h',
+ 'gkbd-keyboard-drawing.h',
+)
+
+gkbd_indicator_marshal = gnome.genmarshal(
+ 'gkbd-indicator-marshal',
+ prefix: 'gkbd_indicator',
+ sources: 'gkbd-indicator-marshal.list',
+)
+
+gkbd_keyboard_drawing_marshal = gnome.genmarshal(
+ 'gkbd-keyboard-drawing-marshal',
+ prefix: 'gkbd_keyboard_drawing',
+ sources: 'gkbd-keyboard-drawing-marshal.list',
+)
+
+
+libgnomekbdui_deps = [
+ libgnomekbd_dep,
+ m_dep,
+]
+
+libgnomekbdui_lib = library(
+ 'gnomekbdui',
+ libgnomekbdui_sources,
+ config_h,
+ gkbd_indicator_marshal,
+ gkbd_keyboard_drawing_marshal,
+ dependencies: libgnomekbdui_deps,
+ include_directories: root_include,
+ version: meson.project_version(),
+ soversion: library_version,
+ c_args: [
+ '-DUIDIR="@0@"'.format(ui_dir),
+ '-DDATADIR="@0@"'.format(pkg_data_dir),
+ '-DICONSDIR="@0@"'.format(icons_dir),
+ ],
+ install: true,
+)
+
+libgnomekbdui_dep = declare_dependency(
+ link_with: libgnomekbdui_lib,
+ include_directories: root_include,
+ dependencies: libgnomekbdui_deps,
+ sources: [config_h, gkbd_indicator_marshal, gkbd_keyboard_drawing_marshal],
+)
+
+gkbd_keyboard_display_exe = executable(
+ 'gkbd-keyboard-display',
+ 'gkbd-keyboard-display.c',
+ dependencies: libgnomekbdui_dep,
+ include_directories: root_include,
+ c_args: [
+ '-DGNOMELOCALEDIR="@0@"'.format(get_option('prefix') / get_option('datadir') / 'locale')
+ ],
+ install: true,
+)
+
+install_headers(
+ libgnomekbd_headers,
+ libgnomekbdui_headers,
+ subdir: 'libgnomekbd',
+)
+
+gkbd_keyboard_display_cfg = configuration_data()
+gkbd_keyboard_display_cfg.set('VERSION', meson.project_version())
+
+gkbd_keyboard_display_in = configure_file(
+ input: 'gkbd-keyboard-display.desktop.in.in',
+ output: 'gkbd-keyboard-display.desktop.in',
+ configuration: gkbd_keyboard_display_cfg,
+)
+
+i18n.merge_file(
+ input: gkbd_keyboard_display_in,
+ output: 'gkbd-keyboard-display.desktop',
+ po_dir: '../po',
+ type: 'desktop',
+ install: true,
+ install_dir: get_option('prefix') / get_option('datadir') / 'applications',
+)
+
+install_data(
+ 'libgnomekbd.convert',
+ install_dir: get_option('prefix') / get_option('datadir') / 'GConf' / 'gsettings'
+)
+
+gnome.generate_gir(
+ libgnomekbd_lib, libgnomekbdui_lib,
+ sources: [
+ libgnomekbd_sources,
+ libgnomekbdui_sources,
+ libgnomekbd_headers,
+ libgnomekbdui_headers,
+ gkbd_indicator_marshal,
+ gkbd_keyboard_drawing_marshal,
+ ],
+ dependencies: [ libgnomekbd_deps, m_dep ],
+ include_directories: root_include,
+ namespace: 'Gkbd',
+ nsversion: '3.0',
+ includes: ['GObject-2.0', 'Gtk-3.0', 'xlib-2.0', 'Xkl-1.0'],
+)
\ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..1fc63d1
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,54 @@
+project('libgnomekbd', 'c',
+ version: '3.26.1',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'warning_level=1',
+ # We only need c99, but glib needs GNU-specific features
+ # https://github.com/mesonbuild/meson/issues/2289
+ 'c_std=gnu99',
+ ],
+ meson_version : '>= 0.59',
+ license: 'LGPL-2.1-or-later')
+
+library_version = '8.0.0'
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+cc = meson.get_compiler('c')
+
+glib_req = '>= 2.18.0'
+gdk_req = '>= 2.91.7'
+gtk_req = '>= 2.90'
+libxklavier_req = '>= 5.2'
+
+glib_dep = dependency('glib-2.0', version: glib_req)
+gobject_dep = dependency('gobject-2.0', version: glib_req)
+gio_dep = dependency('gio-2.0', version: glib_req)
+gdk_dep = dependency('gdk-3.0', version: gdk_req)
+gtk_dep = dependency('gtk+-3.0', version: gtk_req)
+x11_dep = dependency('x11')
+libxklavier_dep = dependency('libxklavier', version: libxklavier_req)
+m_dep = cc.find_library('m', required : false)
+
+add_project_arguments('-DGETTEXT_PACKAGE="libgnomekbd"', language: 'c')
+add_project_arguments('-DHAVE_CONFIG_H=1', language: 'c')
+
+
+config_cfg = configuration_data()
+config_cfg.set_quoted('VERSION', meson.project_version())
+
+config_h = configure_file(
+ output: 'config.h',
+ configuration: config_cfg,
+)
+
+root_include = include_directories('.')
+
+subdir('libgnomekbd')
+
+subdir('po')
+
+if get_option('tests')
+ subdir('test')
+endif
\ No newline at end of file
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..63596da
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,9 @@
+option('gir',
+ type: 'boolean', value: true,
+ description: 'Generate gir data (requires gobject-introspection)')
+option('vapi',
+ type: 'boolean', value: true,
+ description: 'Generate vapi data (requires vapigen)')
+option('tests',
+ type : 'boolean', value : true,
+ description: 'Enable tests')
\ No newline at end of file
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..f5c00d3
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n = import('i18n')
+
+i18n.gettext('libgnomekbd', preset : 'glib')
\ No newline at end of file
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..179c1cf
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,17 @@
+test_names = [
+ 'gkbd-indicator-test',
+ 'gkbd-keyboard-drawing-test',
+ 'gkbd-status-test',
+]
+
+foreach test_name : test_names
+ test_exec = executable(
+ test_name,
+ test_name + '.c',
+ dependencies: libgnomekbdui_dep,
+ c_args: [
+ '-DGNOMELOCALEDIR="@0@"'.format (get_option('prefix') / get_option('datadir') / 'locale'),
+ ],
+ build_by_default: true,
+ )
+endforeach
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]