[gnome-boxes/wip/feborges/meson] Port to meson



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

    Port to meson

 .gitmodules               |    4 +-
 build-aux/post_install.py |   19 +++++
 data/meson.build          |   53 +++++++++++++++
 help/meson.build          |   53 +++++++++++++++
 libgd                     |    1 -
 meson.build               |   82 +++++++++++++++++++++++
 meson_options.txt         |   11 +++
 po/meson.build            |    1 +
 src/meson.build           |  163 +++++++++++++++++++++++++++++++++++++++++++++
 subprojects/libgd         |    1 +
 vapi/uuid.vapi            |   60 +++++++++++++++++
 11 files changed, 445 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..791e02b
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,53 @@
+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
+
+# osinfo?
+
+resource_files = files ('gnome-boxes.gresource.xml')
+resources = gnome.compile_resources ('org.gnome.Boxes', #is this right?
+                                     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.in',
+  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..2204ee5
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,82 @@
+project ('gnome-boxes',
+         ['vala', 'c'],
+         version: '3.25.2',
+         license: 'GPL2+',
+         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')
+uuid = dependency('uuid')
+
+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 ('GNOMELOCALEDIR', 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'))
+
+run_target ('release',
+            command: [
+                join_paths ('build_aux', 'release.sh'),
+                meson.project_name (), meson.project_version ()
+           ])
+
+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..e741cf7
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,163 @@
+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,
+  uuid,
+]
+
+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
diff --git a/vapi/uuid.vapi b/vapi/uuid.vapi
new file mode 100644
index 0000000..106e2e0
--- /dev/null
+++ b/vapi/uuid.vapi
@@ -0,0 +1,60 @@
+/* libuuid Vala Bindings
+ * Copyright 2014 Evan Nemerson <evan nemerson com>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+[CCode (cheader_filename = "uuid.h", lower_case_cprefix = "uuid_")]
+namespace UUID {
+       [CCode (cname = "int", has_type_id = false)]
+       public enum Variant {
+               NCS,
+               DCE,
+               MICROSOFT,
+               OTHER
+       }
+
+       [CCode (cname = "int", has_type_id = false)]
+       public enum Type {
+               DCE_TIME,
+               DCE_RANDOM
+       }
+
+       public static void clear ([CCode (array_length = false)] uint8 uu[16]);
+       public static void copy (uint8 dst[16], uint8 src[16]);
+
+       public static void generate ([CCode (array_length = false)] uint8 @out[16]);
+       public static void generate_random ([CCode (array_length = false)] uint8 @out[16]);
+       public static void generate_time ([CCode (array_length = false)] uint8 @out[16]);
+       public static void generate_time_safe ([CCode (array_length = false)] uint8 @out[16]);
+
+       public static bool is_null ([CCode (array_length = false)] uint8 uu[16]);
+
+       public static int parse (string in, [CCode (array_length = false)] uint8 uu[16]);
+
+       public static void unparse ([CCode (array_length = false)] uint8 uu[16], [CCode (array_length = 
false)] char @out[37]);
+       public static void unparse_lower ([CCode (array_length = false)] uint8 uu[16], [CCode (array_length = 
false)] char @out[37]);
+       public static void unparse_upper ([CCode (array_length = false)] uint8 uu[16], [CCode (array_length = 
false)] char @out[37]);
+
+       public static time_t time ([CCode (array_length = false)] uint8 uu[16], out Posix.timeval ret_tv);
+       public static UUID.Type type ([CCode (array_length = false)] uint8 uu[16]);
+       public static UUID.Variant variant ([CCode (array_length = false)] uint8 uu[16]);
+}


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