[gnome-desktop/wip/fmuellner/meson: 37/40] build: Support the meson build system
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop/wip/fmuellner/meson: 37/40] build: Support the meson build system
- Date: Wed, 12 Sep 2018 11:54:12 +0000 (UTC)
commit c3a3769cf0f1f11f27ca2cc9b35561430b72cf1c
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Aug 2 03:15:24 2018 +0200
build: Support the meson build system
Yay, one more module off the list!
https://gitlab.gnome.org/GNOME/gnome-desktop/merge_requests/7
config.h.meson | 23 +++++
desktop-docs/fdl/meson.build | 1 +
desktop-docs/gpl/meson.build | 1 +
desktop-docs/lgpl/meson.build | 1 +
docs/reference/gnome-desktop3/meson.build | 16 ++++
libgnome-desktop/meson.build | 141 ++++++++++++++++++++++++++++++
meson.build | 135 ++++++++++++++++++++++++++++
meson_options.txt | 30 +++++++
po/meson.build | 1 +
tests/meson.build | 45 ++++++++++
tests/meta.test.in | 4 +
11 files changed, 398 insertions(+)
---
diff --git a/config.h.meson b/config.h.meson
new file mode 100644
index 00000000..2c72485a
--- /dev/null
+++ b/config.h.meson
@@ -0,0 +1,23 @@
+/* The gettext translation domain */
+#mesondefine GETTEXT_PACKAGE
+
+/* Path to library install prefix */
+#mesondefine INSTALL_PREFIX
+
+/* Define if using seccomp */
+#mesondefine ENABLE_SECCOMP
+
+/* Define to 1 if Bubblewrap support is available */
+#mesondefine HAVE_BWRAP
+
+/* we have the timerfd_create(2) system call */
+#mesondefine HAVE_TIMERFD
+#
+/* Define to 1 if you have the `openat' function. */
+#mesondefine HAVE_OPENAT
+
+/* define if udev is available */
+#mesondefine HAVE_UDEV
+
+/* Define to include GNU extensions */
+#mesondefine _GNU_SOURCE
diff --git a/desktop-docs/fdl/meson.build b/desktop-docs/fdl/meson.build
new file mode 100644
index 00000000..478a8d55
--- /dev/null
+++ b/desktop-docs/fdl/meson.build
@@ -0,0 +1 @@
+gnome.yelp('fdl', sources: 'index.docbook')
diff --git a/desktop-docs/gpl/meson.build b/desktop-docs/gpl/meson.build
new file mode 100644
index 00000000..4d545e9a
--- /dev/null
+++ b/desktop-docs/gpl/meson.build
@@ -0,0 +1 @@
+gnome.yelp('gpl', sources: 'index.docbook')
diff --git a/desktop-docs/lgpl/meson.build b/desktop-docs/lgpl/meson.build
new file mode 100644
index 00000000..59db6e58
--- /dev/null
+++ b/desktop-docs/lgpl/meson.build
@@ -0,0 +1 @@
+gnome.yelp('lgpl', sources: 'index.docbook')
diff --git a/docs/reference/gnome-desktop3/meson.build b/docs/reference/gnome-desktop3/meson.build
new file mode 100644
index 00000000..cd89ae7c
--- /dev/null
+++ b/docs/reference/gnome-desktop3/meson.build
@@ -0,0 +1,16 @@
+ignored_headers = [
+ 'gnome-rr-private.h',
+ 'libgsystem',
+ 'meta-dbus-idle-monitor.h',
+ 'meta-dbus-xrandr.h',
+ 'meta-xrandr-shared.h'
+]
+
+gnome.gtkdoc('gnome-desktop3',
+ main_sgml: 'gnome-desktop3-docs.sgml',
+ ignore_headers: ignored_headers,
+ scan_args: '--deprecated-guards="GNOME_DISABLE_DEPRECATED"',
+ mkdb_args: ['--sgml-mode', '--output-format=xml'],
+ src_dir: join_paths(meson.source_root(), 'libgnome-desktop'),
+ install: true
+)
diff --git a/libgnome-desktop/meson.build b/libgnome-desktop/meson.build
new file mode 100644
index 00000000..4bc7bdb8
--- /dev/null
+++ b/libgnome-desktop/meson.build
@@ -0,0 +1,141 @@
+libargs = [
+ '-DG_LOG_DOMAIN="GnomeDesktop"',
+ '-DGDK_DISABLE_DEPRECATION_WARNINGS',
+ '-DGTK_DISABLE_DEPRECATION_WARNINGS',
+ '-DGNOMELOCALEDIR="@0@"'.format(localedir),
+ '-DLIBLOCALEDIR="@0@"'.format(liblocaledir),
+ '-DISO_CODES_PREFIX="@0@"'.format(iso_codes_prefix),
+ '-DXKB_BASE="@0@"'.format(xkb_base)
+]
+
+introspection_sources = [
+ 'gnome-desktop-thumbnail.c',
+ 'gnome-bg.c',
+ 'gnome-bg-slide-show.c',
+ 'gnome-bg-crossfade.c',
+ 'gnome-rr.c',
+ 'gnome-rr-config.c',
+ 'gnome-rr-output-info.c',
+ 'gnome-pnp-ids.c',
+ 'gnome-wall-clock.c',
+ 'gnome-xkb-info.c',
+ 'gnome-idle-monitor.c',
+ 'gnome-languages.c'
+]
+
+dbus_xrandr_built_sources = gnome.gdbus_codegen('meta-dbus-xrandr',
+ 'xrandr.xml',
+ namespace: 'MetaDBus',
+ interface_prefix: 'org.gnome.Mutter'
+)
+
+dbus_idle_built_sources = gnome.gdbus_codegen('meta-dbus-idle-monitor',
+ 'idle-monitor.xml',
+ namespace: 'MetaDBus',
+ interface_prefix: 'org.gnome.Mutter',
+ object_manager: true
+)
+
+libgnome_desktop_sources = [
+ introspection_sources,
+ dbus_xrandr_built_sources,
+ dbus_idle_built_sources,
+ 'gnome-datetime-source.h',
+ 'gnome-datetime-source.c',
+ 'gnome-rr-private.h',
+ 'default-input-sources.h',
+ 'meta-xrandr-shared.h',
+ 'gnome-desktop-thumbnail-script.c',
+ 'gnome-desktop-thumbnail-script.h'
+]
+
+libgnome_desktop_headers = [
+ 'gnome-bg.h',
+ 'gnome-bg-crossfade.h',
+ 'gnome-bg-slide-show.h',
+ 'gnome-desktop-thumbnail.h',
+ 'gnome-rr.h',
+ 'gnome-rr-config.h',
+ 'gnome-pnp-ids.h',
+ 'gnome-wall-clock.h',
+ 'gnome-xkb-info.h',
+ 'gnome-idle-monitor.h',
+ 'gnome-languages.h'
+]
+
+install_headers(libgnome_desktop_headers,
+ subdir: 'gnome-desktop-3.0/libgnome-desktop'
+)
+
+gnome_desktop_deps = [
+ config_h,
+ gdk_pixbuf_dep,
+ gtk_dep,
+ glib_dep,
+ gio_dep,
+ gio_unix_dep,
+ schemas_dep,
+ xkb_config_dep,
+ iso_codes_dep,
+ udev_dep,
+ seccomp_dep
+]
+
+libgnome_desktop = library('gnome-desktop-3',
+ libgnome_desktop_sources,
+ dependencies: [gnome_desktop_deps, m_dep, rt_dep, x_dep],
+ soversion: soversion,
+ c_args: libargs,
+ install: true
+)
+
+libgnome_desktop_dep = declare_dependency(
+ dependencies: gnome_desktop_deps,
+ link_with: libgnome_desktop
+)
+
+gnome.generate_gir(libgnome_desktop,
+ sources: introspection_sources + libgnome_desktop_headers,
+ export_packages: 'gnome-desktop-3.0',
+ namespace: 'GnomeDesktop',
+ nsversion: '3.0',
+ includes: ['GObject-2.0', 'Gtk-3.0', 'GDesktopEnums-3.0'],
+ extra_args: '-DGNOME_DESKTOP_USE_UNSTABLE_API',
+ identifier_prefix: 'Gnome',
+ symbol_prefix: 'gnome',
+ install: true
+)
+
+desktop_pc = pkg.generate(
+ libraries: libgnome_desktop,
+ requires: ['gtk+-3.0', 'gsettings-desktop-schemas'],
+ version: meson.project_version(),
+ name: 'gnome-desktop-3.0',
+ filebase: 'gnome-desktop-3.0',
+ description: 'Utility library for loading .desktop files',
+ subdirs: 'gnome-desktop-3.0'
+)
+
+if get_option('debug_tools')
+ executable('gnome-rr-debug',
+ sources: 'gnome-rr-debug.c',
+ dependencies: libgnome_desktop_dep,
+ install_dir: libexecdir,
+ install: true
+ )
+endif
+
+test_programs = [
+ 'test-xkb-info',
+ 'test-pnp-ids',
+ 'test-wall-clock',
+ 'test-desktop-thumbnail',
+ 'test-idle-monitor',
+ 'test-languages'
+]
+
+foreach program : test_programs
+ executable(program, program + '.c',
+ dependencies: libgnome_desktop_dep
+ )
+endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..9b10bbf7
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,135 @@
+project('gnome-desktop', 'c',
+ meson_version: '>= 0.47.0',
+ version: '3.30.0',
+ license: ['GPL2+', 'LGPL2+']
+)
+
+# Before making a release, the soversion string should be modified.
+# The string is of the form C.A.R.
+# - If interfaces have been changed or added, but binary compatibility has
+# been preserved, change to C+1.A+1.0
+# - If binary compatibility has been broken (eg removed or changed interfaces)
+# change to C+1.0.0
+# - If the interface is the same as the previous version, change to C.A.R+1
+
+soversion = '17.0.2'
+
+gdk_pixbuf_req = '>= 2.36.5'
+gtk_req = '>= 3.3.6'
+glib_req = '>= 2.53.0'
+xrandr_req = '>= 1.3'
+schemas_req = '>= 3.27.0'
+xext_req = '>= 1.1'
+
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+prefix = get_option('prefix')
+
+datadir = join_paths(prefix, get_option('datadir'))
+libexecdir = join_paths(prefix, get_option('libexecdir'))
+
+liblocaledir = join_paths(get_option('prefix'), 'lib', 'locale')
+localedir = join_paths(datadir, 'locale')
+test_metadir = join_paths(datadir, 'installed-tests', meson.project_name())
+test_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name())
+versiondir = join_paths(datadir, 'gnome')
+
+gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req)
+gtk_dep = dependency('gtk+-3.0', version: gtk_req)
+glib_dep = dependency('glib-2.0', version: glib_req)
+gio_dep = dependency('gio-2.0', version: glib_req)
+gio_unix_dep = dependency('gio-unix-2.0', version: glib_req)
+schemas_dep = dependency('gsettings-desktop-schemas', version: schemas_req)
+xkb_config_dep = dependency('xkeyboard-config')
+iso_codes_dep = dependency('iso-codes')
+x_dep = dependency('x11')
+
+udev_dep = dependency('libudev', required: get_option('udev'))
+
+# Check for bubblewrap compatible platform
+host_os = host_machine.system()
+host_cpu = host_machine.cpu()
+supported_os = ['linux']
+unsupported_cpus = ['alpha', 'ia64', 'm68k', 'sh4', 'sparc64']
+if supported_os.contains(host_os) and not unsupported_cpus.contains(host_cpu)
+ seccomp_dep = dependency('libseccomp')
+else
+ seccomp_dep = dependency('', required: false)
+endif
+
+xkb_base = xkb_config_dep.get_pkgconfig_variable('xkb_base')
+iso_codes_prefix = iso_codes_dep.get_pkgconfig_variable('prefix')
+
+cc = meson.get_compiler('c')
+
+m_dep = cc.find_library('m', required: false)
+rt_dep = cc.find_library('rt', required: false)
+
+if not cc.has_function('clock_gettime', dependencies: rt_dep)
+ rt_dep = dependency('', required: false)
+endif
+
+conf = configuration_data()
+
+conf.set_quoted('GETTEXT_PACKAGE', '@0@-3.0'.format(meson.project_name()))
+conf.set_quoted('INSTALL_PREFIX', prefix)
+
+conf.set10('ENABLE_SECCOMP', seccomp_dep.found())
+conf.set10('HAVE_BWRAP', seccomp_dep.found())
+conf.set10('_GNU_SOURCE', seccomp_dep.found())
+
+conf.set10('HAVE_UDEV', udev_dep.found())
+
+conf.set10('HAVE_TIMERFD', cc.has_function('timerfd_create'))
+conf.set10('HAVE_OPENAT', cc.has_function('openat'))
+
+config_h = declare_dependency(
+ sources: configure_file(
+ configuration: conf,
+ input: 'config.h.meson',
+ output: 'config.h'
+ ),
+ include_directories: include_directories('.')
+)
+
+version_array = meson.project_version().split('.')
+version_conf = configuration_data()
+
+version_conf.set('GNOME_PLATFORM', version_array[0])
+version_conf.set('GNOME_MINOR', version_array[1])
+version_conf.set('GNOME_MICRO', version_array[2])
+version_conf.set('GNOME_DISTRIBUTOR', get_option('gnome_distributor'))
+
+if get_option('date_in_gnome_version')
+ date = run_command(['date', '+%Y-%m-%d'])
+ version_conf.set('GNOME_DATE', date.stdout().strip())
+ version_conf.set('GNOME_DATE_COMMENT_START', '')
+ version_conf.set('GNOME_DATE_COMMENT_END', '')
+else
+ version_conf.set('GNOME_DATE', '')
+ version_conf.set('GNOME_DATE_COMMENT_START', '<!--')
+ version_conf.set('GNOME_DATE_COMMENT_END', '-->')
+endif
+
+version_xml = configure_file(
+ configuration: version_conf,
+ input: 'gnome-version.xml.in',
+ output: 'gnome-version.xml'
+)
+install_data(version_xml, install_dir: versiondir)
+
+subdir('libgnome-desktop')
+subdir('po')
+subdir('tests')
+
+if get_option('desktop_docs')
+ subdir('desktop-docs/fdl')
+ subdir('desktop-docs/gpl')
+ subdir('desktop-docs/lgpl')
+endif
+
+if get_option('gtk_doc')
+ subdir('docs/reference/gnome-desktop3')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..b01005c4
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,30 @@
+option('gnome_distributor',
+ type: 'string', value: 'GNOME.Org',
+ description: 'Specify name of GNOME distributor'
+)
+
+option('date_in_gnome_version',
+ type: 'boolean', value: true,
+ description: 'Include the buid date in gnome-version.xml'
+)
+
+option('desktop_docs',
+ type: 'boolean', value: true,
+ description: 'Build desktop-wide help documents'
+)
+
+option('debug_tools',
+ type: 'boolean', value: true, description: 'Build debug tools'
+)
+
+option('udev',
+ type: 'feature', description: 'Udev support'
+)
+
+option('gtk_doc',
+ type: 'boolean', value: false, description: 'Build API reference'
+)
+
+option('installed_tests',
+ type: 'boolean', value: false, description: 'Enable installed tests'
+)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..d1fa7c6f
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('gnome-desktop-3.0', preset: 'glib')
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 00000000..b8ceaa6d
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,45 @@
+test_args = [
+ '-DG_LOG_DOMAIN="GnomeDesktop"',
+ '-DGDK_DISABLE_DEPRECATED_WARNINGS',
+ '-DGTK_DISABLE_DEPRECATED_WARNINGS',
+ '-DINSTALLED_TEST_DIR="@0@"'.format(test_execdir)
+]
+
+test_programs = [
+ 'wall-clock',
+ 'wallclock-reftest'
+]
+
+test_metas = []
+
+foreach program: test_programs
+ exe = executable(program, program + '.c',
+ dependencies: libgnome_desktop_dep,
+ c_args: test_args,
+ install_dir: test_execdir,
+ install: get_option('installed_tests')
+ )
+
+ if get_option('installed_tests')
+ meta_data = configuration_data()
+ meta_data.set('TEST_EXEC', join_paths(test_execdir, program))
+
+ test_metas += configure_file(
+ configuration: meta_data,
+ input: 'meta.test.in',
+ output: program + '.test',
+ )
+ endif
+endforeach
+
+if get_option('installed_tests')
+ test_data = files(
+ 'C.ref.ui',
+ 'C.ui',
+ 'en_US.utf-8.ref.ui',
+ 'en_US.utf-8.ui',
+ 'he_IL.utf8.ref.ui',
+ 'he_IL.utf8.ui'
+ )
+ install_data(test_data + test_metas, install_dir: test_metadir)
+endif
diff --git a/tests/meta.test.in b/tests/meta.test.in
new file mode 100644
index 00000000..ae2b2991
--- /dev/null
+++ b/tests/meta.test.in
@@ -0,0 +1,4 @@
+[Test]
+Type=session
+Exec=@TEST_EXEC@ --tap
+Output=TAP
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]