[gnome-boxes] build: Port to meson



commit 11a6ba04b8faeb316d2fa0fd5d1a23e3eb25e603
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue May 30 13:56:06 2017 +0200

    build: Port to meson
    
    This has been based in the outdated work of Zeeshan Ali in
    wip/meson, and in the recent port of GNOME Clocks to meson.
    
    libgd was moved into the subprojects/ directory so we can
    benefit from meson the subproject() utility.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783234

 .gitmodules               |    4 +-
 build-aux/post_install.py |   19 +++++
 data/meson.build          |   51 ++++++++++++++
 help/meson.build          |   53 +++++++++++++++
 libgd                     |    1 -
 meson.build               |   75 +++++++++++++++++++++
 meson_options.txt         |   11 +++
 po/meson.build            |    1 +
 src/meson.build           |  162 +++++++++++++++++++++++++++++++++++++++++++++
 subprojects/libgd         |    1 +
 10 files changed, 375 insertions(+), 3 deletions(-)
---
diff --git a/.gitmodules b/.gitmodules
index bfd964e..e91a9d2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
-[submodule "libgd"]
-       path = libgd
+[submodule "subprojects/libgd"]
+       path = subprojects/libgd
        url = git://git.gnome.org/libgd
diff --git a/build-aux/post_install.py b/build-aux/post_install.py
new file mode 100755
index 0000000..c1faf09
--- /dev/null
+++ b/build-aux/post_install.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python3
+
+import os
+import pathlib
+import subprocess
+
+prefix = pathlib.Path(os.environ.get('MESON_INSTALL_PREFIX', '/usr/local'))
+datadir = prefix / 'share'
+destdir = os.environ.get('DESTDIR', '')
+
+if not destdir:
+    print('Compiling gsettings schemas...')
+    subprocess.call(['glib-compile-schemas', str(datadir / 'glib-2.0' / 'schemas')])
+
+    print('Updating icon cache...')
+    subprocess.call(['gtk-update-icon-cache', '-qtf', str(datadir / 'icons' / 'hicolor')])
+
+    print('Updating desktop database...')
+    subprocess.call(['update-desktop-database', '-q', str(datadir / 'applications')])
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..dc7c24f
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,51 @@
+icons_dir = join_paths (data_dir, 'icons', 'hicolor')
+foreach size: ['16x16', '22x22', '32x32', '48x48', '256x256', 'symbolic']
+  install_subdir('icons/hicolor/' + size, install_dir: icons_dir)
+endforeach
+
+resource_files = files ('gnome-boxes.gresource.xml')
+resources = gnome.compile_resources ('org.gnome.Boxes',
+                                     resource_files,
+                                     c_name: 'resources')
+
+custom_target ('desktop-file',
+              input: files ('org.gnome.Boxes.desktop.in.in'),
+              output: 'org.gnome.Boxes.desktop',
+              install: true,
+              install_dir: join_paths (data_dir, 'applications'),
+              command: [msgfmt, '--desktop', '-d', '../po', '--template', '@INPUT@', '-o', '@OUTPUT@'])
+
+dbus_conf = configuration_data ()
+dbus_conf.set ('bindir', join_paths (get_option ('prefix'), get_option ('bindir')))
+configure_file (
+  input: 'org.gnome.Boxes.service.in',
+  output: 'org.gnome.Boxes.service',
+  configuration: dbus_conf,
+  install: true,
+  install_dir: join_paths (data_dir, 'dbus-1', 'services')
+)
+
+custom_target ('appdata-file',
+  input: 'org.gnome.Boxes.appdata.xml.in',
+  output: 'org.gnome.Boxes.appdata.xml',
+  install: true,
+  install_dir: join_paths (data_dir, 'appdata'),
+  command: [ msgfmt, '--xml', '--template', '@INPUT@', '-d', po_dir, '-o', '@OUTPUT@' ],
+)
+
+configure_file (
+  input: 'gnome-boxes-search-provider.ini.in',
+  output: 'gnome-boxes-search-provider.ini',
+  configuration: configuration_data (),
+  install_dir: join_paths (data_dir, 'gnome-shell', 'search-providers'),
+)
+
+gsettings_conf = configuration_data ()
+gsettings_conf.set ('GETTEXT_PACKAGE', meson.project_name ())
+configure_file (
+  input: 'org.gnome.boxes.gschema.xml',
+  output: 'org.gnome.boxes.gschema.xml',
+  configuration: gsettings_conf,
+  install: true,
+  install_dir: join_paths(data_dir, 'glib-2.0', 'schemas'),
+)
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..09aa9f2
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,53 @@
+help_files = [
+  'clipboard.page',
+  'connect.page',
+  'continuous.page',
+  'create.page',
+  'delete.page',
+  'disk-images.page',
+  'index.page',
+  'interface.page',
+  'keystrokes.page',
+  'legal.xml',
+  'prop-system.page',
+  'prop-trouble.page',
+  'search.page',
+  'shortcuts.page',
+  'shutdown.page',
+  'snapshot-create.page',
+  'snapshot-delete.page',
+  'snapshot-rename.page',
+  'snapshot-revert.page',
+  'supported-protocols.page',
+  'system-requirements.page',
+  'usb-redirection.page',
+  'virtualization.page',
+  'what-is-a-virtual-machine.page',
+  'why-do-i-need-virtual-machine.page',
+]
+
+help_media = [
+  'figures/boxes_icon.png',
+  'figures/input-keyboard-symbolic.svg',
+  'figures/open-menu-symbolic.svg'
+]
+
+help_linguas = [
+  'cs',
+  'de',
+  'el',
+  'es',
+  'fr',
+  'hu',
+  'it',
+  'ko',
+  'pt_BR',
+  'sv'
+]
+
+gnome.yelp (meson.project_name (),
+            sources: help_files,
+            media: help_media,
+            languages: help_linguas,
+            symlink_media: true,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..7f5b7fe
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,75 @@
+project ('gnome-boxes',
+         ['vala', 'c'],
+         version: '3.25.3',
+         license: 'LGPLv2+',
+         meson_version: '>= 0.40',
+)
+
+gnome = import ('gnome')
+i18n = import ('i18n')
+
+glib = dependency ('glib-2.0', version: '>= 2.38.0')
+gio = dependency ('gio-2.0', version: '>= 2.38.0')
+gobject = dependency ('gobject-2.0', version: '>= 2.44')
+govirt = dependency ('govirt-1.0', version: '>= 0.3.4')
+gtk = dependency ('gtk+-3.0', version: '>= 3.19.8')
+gtk_vnc = dependency ('gtk-vnc-2.0', version: '>= 0.4.4')
+gudev = dependency ('gudev-1.0', version: '>= 165')
+libarchive = dependency ('libarchive', version: '>= 3.0.0')
+libosinfo = dependency ('libosinfo-1.0', version: '>= 0.2.12')
+libsecret = dependency ('libsecret-1')
+libsoup = dependency ('libsoup-2.4', version: '>= 2.38')
+libusb = dependency ('libusb-1.0', version: '>= 1.0.9')
+libvirt_glib = dependency ('libvirt-gobject-1.0', version: '>= 0.2.0')
+libvirt_gconfig = dependency ('libvirt-gconfig-1.0', version: '>= 0.2.0')
+libxml = dependency ('libxml-2.0', version: '>= 2.7.8')
+spice_client_gtk = dependency ('spice-client-gtk-3.0', version: '>= 0.32')
+tracker = dependency ('tracker-sparql-1.0')
+
+cc = meson.get_compiler ('c')
+
+pkglibdir = join_paths (get_option ('libdir'), meson.project_name ())
+libgd = subproject (
+  'libgd',
+  default_options: [
+    'pkglibdir=' + pkglibdir,
+    'with-gtk-hacks=true',
+    'with-main-view=true',
+    'with-vapi=true',
+  ],
+)
+
+libgd_vapi_dep = libgd.get_variable ('libgd_vapi_dep')
+libgd_dep = libgd.get_variable('libgd_dep')
+
+msgfmt = find_program ('msgfmt')
+
+po_dir = join_paths (meson.source_root (), 'po')
+data_dir = join_paths (get_option ('prefix'), get_option ('datadir'))
+locale_dir = join_paths (data_dir, '/locale')
+
+conf = configuration_data ()
+conf.set_quoted ('PACKAGE_NAME', meson.project_name ())
+conf.set_quoted ('PACKAGE_TARNAME', meson.project_name ())
+conf.set_quoted ('PACKAGE_VERSION', meson.project_version ())
+conf.set_quoted ('GETTEXT_PACKAGE', meson.project_name ())
+conf.set('PACKAGE_URL', '"https://wiki.gnome.org/Apps/Boxes";')
+conf.set_quoted ('VERSION', meson.project_version ())
+conf.set_quoted ('DATADIR', data_dir)
+conf.set_quoted ('CACHEDIR', '/var/cache')
+conf.set_quoted ('LOCALEDIR', locale_dir)
+conf.set('PACKAGE_BUGREPORT', '"https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-boxes";')
+
+if govirt.found()
+  conf.set10 ('HAVE_OVIRT', get_option ('enable-ovirt'))
+endif
+
+configure_file (output: 'config.h', configuration: conf)
+config_h_dir = include_directories ('.')
+
+meson.add_install_script (join_paths ('build-aux', 'post_install.py'))
+
+subdir ('data')
+subdir ('help')
+subdir ('po')
+subdir ('src')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..92aa7d7
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,11 @@
+option ('enable-ovirt',
+        type: 'boolean',
+        value: true)
+
+option ('enable-debug',
+        type: 'boolean',
+        value: false)
+
+option ('enable-strict-cc',
+        type: 'boolean',
+        value: false)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..b2e9e42
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext (meson.project_name (), preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..5fa9809
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,162 @@
+common_sources = [
+  'async-launcher.vala',
+  'box-config.vala',
+  'collection-source.vala',
+  'util.vala',
+]
+
+vala_sources = [
+  'app.vala',
+  'app-window.vala',
+  'actions-popover.vala',
+  'archive-reader.vala',
+  'archive-writer.vala',
+  'auth-notification.vala',
+  'collection.vala',
+  'collection-filter-switcher.vala',
+  'collection-toolbar.vala',
+  'display-page.vala',
+  'display-toolbar.vala',
+  'display.vala',
+  'editable-entry.vala',
+  'i-properties-provider.vala',
+  'i-collection-view.vala',
+  'icon-view.vala',
+  'installer-media.vala',
+  'installed-media.vala',
+  'keys-input-popover.vala',
+  'libvirt-cloned-media.vala',
+  'libvirt-media.vala',
+  'iso-extractor.vala',
+  'libvirt-broker.vala',
+  'libvirt-machine.vala',
+  'libvirt-machine-properties.vala',
+  'list-view.vala',
+  'list-view-row.vala',
+  'machine.vala',
+  'machine-thumbnailer.vala',
+  'main.vala',
+  'media-manager.vala',
+  'resource-graph.vala',
+  'notification.vala',
+  'notificationbar.vala',
+  'os-database.vala',
+  'properties.vala',
+  'properties-window.vala',
+  'properties-page-widget.vala',
+  'properties-toolbar.vala',
+  'remote-machine.vala',
+  'searchbar.vala',
+  'selectionbar.vala',
+  'selection-toolbar.vala',
+  'shared-folder-popover.vala',
+  'spice-display.vala',
+  'topbar.vala',
+  'ui.vala',
+  'unattended-installer.vala',
+  'unattended-file.vala',
+  'unattended-setup-box.vala',
+  'util-app.vala',
+  'vm-configurator.vala',
+  'vm-creator.vala',
+  'vm-importer.vala',
+  'libvirt-system-importer.vala',
+  'libvirt-vm-cloner.vala',
+  'libvirt-vm-importer.vala',
+  'vnc-display.vala',
+  'wizard-window.vala',
+  'wizard-source.vala',
+  'wizard-toolbar.vala',
+  'wizard.vala',
+  'downloader.vala',
+  'empty-boxes.vala',
+  'tracker-iso-query.vala',
+  'troubleshoot-log.vala',
+  'snapshot-list-row.vala',
+  'snapshots-property.vala',
+]
+
+if govirt.found ()
+  if get_option ('enable-ovirt')
+    vala_sources += [
+      'ovirt-broker.vala',
+      'ovirt-machine.vala',
+    ]
+  endif
+endif
+
+boxes_sources = [
+  common_sources,
+  vala_sources,
+  resources
+]
+
+vala_args = [
+  '--enable-experimental',
+  '--target-glib', '2.44',
+  '--vapidir', meson.current_source_dir (),
+  '--vapidir', join_paths (meson.source_root (), 'vapi'),
+  '--vapidir', join_paths (meson.source_root (), 'vapi', 'upstream'),
+  '--vapidir', join_paths (meson.build_root (), 'subprojects', 'libgd', 'libgd'),
+  '--pkg', 'config',
+  '--pkg', 'gio-2.0-workaround',
+  '--pkg', 'posix',
+  '--pkg', 'linux',
+  '--pkg', 'rest-0.7',
+  '--gresources', resource_files,
+]
+
+if get_option ('enable-debug')
+  vala_args += '-g'
+endif
+
+dependencies = [
+  glib,
+  gio,
+  gobject,
+  gtk,
+  gtk_vnc,
+  libgd_vapi_dep,
+  libgd_dep,
+  libsecret,
+  libvirt_glib,
+  libvirt_gconfig,
+  libxml,
+  libusb,
+  spice_client_gtk,
+  gudev,
+  libosinfo,
+  libsoup,
+  libarchive,
+  tracker,
+]
+
+if govirt.found()
+  if get_option ('enable-ovirt')
+    dependencies += govirt
+  endif
+endif
+
+c_args = [
+  '-DDATADIR="' + data_dir + '"',
+  '-DGNOMELOCALEDIR="' + locale_dir + '"',
+  '-DGETTEXT_PACKAGE="gnome-boxes"',
+  '-DCACHEDIR="/var/cache/"',
+  '-DG_LOG_DOMAIN="Boxes"',
+]
+
+if get_option ('enable-debug')
+  c_args += ['-00 -ggdb3']
+endif
+
+if get_option ('enable-strict-cc')
+  c_args += ['-Wall', '-Werror']
+endif
+
+executable ('gnome-boxes', boxes_sources,
+            include_directories: config_h_dir,
+            vala_args: vala_args,
+            c_args : c_args,
+            dependencies: dependencies,
+            install: true
+)
diff --git a/subprojects/libgd b/subprojects/libgd
new file mode 160000
index 0000000..edcb3af
--- /dev/null
+++ b/subprojects/libgd
@@ -0,0 +1 @@
+Subproject commit edcb3af3790a0d108bf303aca989c24eab675c49


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]