[gupnp-tools] Port build system to meson



commit baa61b70028d6934245d19f9b79901dd8035f527
Author: Jens Georg <mail jensge org>
Date:   Wed Jun 27 12:02:49 2018 +0200

    Port build system to meson

 .gitignore                                         |   1 -
 Makefile.am                                        |  26 ----
 autogen.sh                                         |  19 ---
 configure.ac                                       | 146 -------------------
 data/Makefile.am                                   |  42 ------
 ...-av-cp.desktop.in.in => gupnp-av-cp.desktop.in} |   2 +-
 ...esktop.in.in => gupnp-network-light.desktop.in} |   2 +-
 ...desktop.in.in => gupnp-universal-cp.desktop.in} |   2 +-
 data/meson.build                                   |  52 +++++++
 data/org.gupnp.Tools.Common.gresource.xml          |   5 -
 data/org.gupnp.Tools.Network-Light.gresource.xml   |   9 ++
 data/org.gupnp.Tools.Universal-CP.gresource.xml    |   7 +
 data/pixmaps/Makefile.am                           |  18 ---
 data/xml/Makefile.am                               |  11 --
 m4/as-ac-expand.m4                                 |  49 -------
 m4/ax_append_compile_flags.m4                      |  67 ---------
 m4/ax_append_flag.m4                               |  71 ---------
 m4/ax_append_link_flags.m4                         |  65 ---------
 m4/ax_check_compile_flag.m4                        |  74 ----------
 m4/ax_check_enable_debug.m4                        | 124 ----------------
 m4/ax_check_link_flag.m4                           |  74 ----------
 m4/ax_compiler_flags.m4                            | 158 ---------------------
 m4/ax_compiler_flags_cflags.m4                     | 133 -----------------
 m4/ax_compiler_flags_gir.m4                        |  60 --------
 m4/ax_compiler_flags_ldflags.m4                    |  75 ----------
 m4/ax_is_release.m4                                |  69 ---------
 m4/ax_require_defined.m4                           |  37 -----
 meson.build                                        |  43 ++++++
 meson_options.txt                                  |   3 +
 po/Makevars                                        |  78 ----------
 po/meson.build                                     |   1 +
 src/Makefile.am                                    |   7 -
 src/av-cp/Makefile.am                              |  72 ----------
 src/av-cp/didl-dialog.c                            |   9 +-
 src/av-cp/gui.c                                    |   2 +
 src/av-cp/meson.build                              |  25 ++++
 src/av-cp/playlist-treeview.c                      |   2 +
 src/av-cp/playlist-treeview.h                      |   2 +
 src/av-cp/renderer-combo.c                         |   2 +
 src/av-cp/renderer-combo.h                         |   2 +
 src/av-cp/renderer-controls.c                      |   2 +
 src/av-cp/renderer-controls.h                      |   2 +
 src/common/Makefile.am                             |  37 -----
 src/common/icons.c                                 |   5 +-
 src/common/meson.build                             |  10 ++
 src/discover/Makefile.am                           |  14 --
 src/discover/meson.build                           |   1 +
 src/meson.build                                    |  10 ++
 src/network-light/Makefile.am                      |  45 ------
 src/network-light/gui.c                            |  18 +--
 src/network-light/main.c                           |   2 +-
 src/network-light/meson.build                      |  16 +++
 src/network-light/upnp.c                           |   4 +
 src/universal-cp/Makefile.am                       |  48 -------
 src/universal-cp/action-dialog.c                   |   3 +
 src/universal-cp/details-treeview.c                |   2 +
 src/universal-cp/device-treeview.c                 |   2 +
 src/universal-cp/device-treeview.h                 |   2 +
 src/universal-cp/event-treeview.c                  |   2 +
 src/universal-cp/gui.c                             |  10 +-
 src/universal-cp/meson.build                       |  23 +++
 src/upload/Makefile.am                             |  28 ----
 src/upload/main.c                                  |   2 +
 src/upload/meson.build                             |  14 ++
 64 files changed, 274 insertions(+), 1674 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 22f714e..da98ac4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,6 @@ src/discover/gssdp-discover
 Makefile
 Makefile.in
 data/*.desktop
-data/*.desktop.in
 data/gupnp-av-cp.ui
 
 aclocal.m4
diff --git a/data/gupnp-av-cp.desktop.in.in b/data/gupnp-av-cp.desktop.in
similarity index 87%
rename from data/gupnp-av-cp.desktop.in.in
rename to data/gupnp-av-cp.desktop.in
index fdb0f3a..e26a566 100644
--- a/data/gupnp-av-cp.desktop.in.in
+++ b/data/gupnp-av-cp.desktop.in
@@ -4,7 +4,7 @@ Name=UPnP AV Control Point
 Categories=GTK;Development;
 Exec=gupnp-av-cp
 # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=@PKGDATADIR@/pixmaps/av-cp.png
+Icon=av-cp
 Terminal=false
 Type=Application
 StartupNotify=true
diff --git a/data/gupnp-network-light.desktop.in.in b/data/gupnp-network-light.desktop.in
similarity index 82%
rename from data/gupnp-network-light.desktop.in.in
rename to data/gupnp-network-light.desktop.in
index c348f09..ee7ea94 100644
--- a/data/gupnp-network-light.desktop.in.in
+++ b/data/gupnp-network-light.desktop.in
@@ -4,7 +4,7 @@ Name=UPnP Network Light
 Categories=GTK;Development;
 Exec=gupnp-network-light
 # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=@PKGDATADIR@/pixmaps/network-light-256x256.png
+Icon=network-light-256x256
 Terminal=false
 Type=Application
 StartupNotify=true
diff --git a/data/gupnp-universal-cp.desktop.in.in b/data/gupnp-universal-cp.desktop.in
similarity index 85%
rename from data/gupnp-universal-cp.desktop.in.in
rename to data/gupnp-universal-cp.desktop.in
index 0ded3f5..ac169f7 100644
--- a/data/gupnp-universal-cp.desktop.in.in
+++ b/data/gupnp-universal-cp.desktop.in
@@ -4,7 +4,7 @@ Name=UPnP Universal Control Point
 Categories=GTK;Development;
 Exec=gupnp-universal-cp
 # Translators: Do NOT translate or transliterate this text (this is an icon file name)!
-Icon=@PKGDATADIR@/pixmaps/universal-cp.png
+Icon=universal-cp
 Terminal=false
 Type=Application
 StartupNotify=true
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..a621c5d
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,52 @@
+didl_dialog_data = configuration_data()
+if gtksourceview.found()
+    didl_dialog_data.set('TEXT_VIEW', 'GtkSourceView')
+else
+    didl_dialog_data.set('TEXT_VIEW', 'GtkTextView')
+endif
+didl_dialog_ui = configure_file(input: 'didl-lite-dialog.ui.in', output: 'didl-lite-dialog.ui', 
configuration : didl_dialog_data)
+
+install_data(['xml/Dimming-scpd.xml', 'xml/network-light-desc.xml', 'xml/SwitchPower-scpd.xml'], install_dir 
: join_paths(shareddir, 'xml'))
+install_data(['pixmaps/av-cp.png',
+              'pixmaps/Makefile.am',
+              'pixmaps/media-renderer.png',
+              'pixmaps/network-light-22x22.png',
+              'pixmaps/network-light-256x256.png',
+              'pixmaps/network-light-off.png',
+              'pixmaps/network-light-on.png',
+              'pixmaps/universal-cp.png',
+              'pixmaps/upnp-action-arg-in.png',
+              'pixmaps/upnp-action-arg-out.png',
+              'pixmaps/upnp-device.png',
+              'pixmaps/upnp-service.png',
+              'pixmaps/upnp-state-variable.png'], install_dir : join_paths(shareddir, 'pixmaps'))
+
+install_data([
+              'pixmaps/network-light-256x256.png',
+              'pixmaps/universal-cp.png',
+              'pixmaps/av-cp.png'],
+              install_dir : join_paths(get_option('datadir'), 'icons', 'hicolor', '256x256'))
+
+
+desktop_conf = configuration_data()
+desktop_conf.set('PKGDATADIR', shareddir)
+
+podir = join_paths('..', 'po')
+
+i18n.merge_file(input: 'gupnp-av-cp.desktop.in', output: 'gupnp-av-cp.desktop',
+                po_dir : podir,
+                type: 'desktop',
+                install: true,
+                install_dir: desktopdir)
+
+i18n.merge_file(input: 'gupnp-universal-cp.desktop.in', output: 'gupnp-universal-cp.desktop',
+                po_dir : podir,
+                type: 'desktop',
+                install: true,
+                install_dir: desktopdir)
+
+i18n.merge_file(input: 'gupnp-network-light.desktop.in', output: 'gupnp-network-light.desktop',
+                po_dir : podir,
+                type: 'desktop',
+                install: true,
+                install_dir: desktopdir)
diff --git a/data/org.gupnp.Tools.Common.gresource.xml b/data/org.gupnp.Tools.Common.gresource.xml
index 1f42747..88a4c95 100644
--- a/data/org.gupnp.Tools.Common.gresource.xml
+++ b/data/org.gupnp.Tools.Common.gresource.xml
@@ -3,11 +3,6 @@
     <gresource prefix='/org/gupnp/Tools/Common'>
         <file>pixmaps/av-cp.png</file>
         <file>pixmaps/media-renderer.png</file>
-        <file>pixmaps/network-light-22x22.png</file>
-        <file>pixmaps/network-light-256x256.png</file>
-        <file>pixmaps/network-light-off.png</file>
-        <file>pixmaps/network-light-on.png</file>
-        <file>pixmaps/universal-cp.png</file>
         <file>pixmaps/upnp-action-arg-in.png</file>
         <file>pixmaps/upnp-action-arg-out.png</file>
         <file>pixmaps/upnp-device.png</file>
diff --git a/data/org.gupnp.Tools.Network-Light.gresource.xml 
b/data/org.gupnp.Tools.Network-Light.gresource.xml
new file mode 100644
index 0000000..70f1851
--- /dev/null
+++ b/data/org.gupnp.Tools.Network-Light.gresource.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+    <gresource prefix='/org/gupnp/Tools/Network-Light'>
+        <file preprocess='xml-stripblanks'>gupnp-network-light.ui</file>
+        <file>pixmaps/network-light-256x256.png</file>
+        <file>pixmaps/network-light-on.png</file>
+        <file>pixmaps/network-light-off.png</file>
+   </gresource>
+</gresources>
diff --git a/data/org.gupnp.Tools.Universal-CP.gresource.xml b/data/org.gupnp.Tools.Universal-CP.gresource.xml
new file mode 100644
index 0000000..6d0bf62
--- /dev/null
+++ b/data/org.gupnp.Tools.Universal-CP.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+    <gresource prefix='/org/gupnp/Tools/Universal-CP'>
+        <file preprocess='xml-stripblanks'>gupnp-universal-cp.ui</file>
+        <file>pixmaps/universal-cp.png</file>
+   </gresource>
+</gresources>
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..3152f4d
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,43 @@
+project('gupnp-tools', ['c'], version: '0.8.15')
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+gssdp = dependency('gssdp-1.0', version: '>= 0.13.3')
+gupnp = dependency('gupnp-1.0', version: '>= 0.20.14')
+soup = dependency('libsoup-2.4', version: '>= 2.42')
+gupnp_av = dependency('gupnp-av-1.0', version: '>= 0.5.5', required: false)
+gtk = dependency('gtk+-3.0', version: '>= 3.10')
+glib = dependency('glib-2.0', version: '>= 2.24')
+gio = dependency('gio-2.0', version: '>= 2.24')
+libxml = dependency('libxml-2.0', version: '>= 2.0')
+gobject = dependency('gobject-2.0', version: '>= 2.24')
+
+# Check for gtksourceview (used for XML syntax highlighting)
+gtksourceview = dependency('gtksourceview-4.0', required: false)
+if not gtksourceview.found()
+    gtksourceview = dependency('gtksourceview-3.0', version: '>= 3.2.0', required: false)
+endif
+
+resource_data = join_paths(meson.source_root(), 'data')
+if get_option('uninstalled')
+    shareddir = resource_data
+else
+    shareddir = join_paths(get_option('datadir'), meson.project_name())
+endif
+
+desktopdir = join_paths(get_option('datadir'), 'applications')
+
+conf = configuration_data()
+conf.set('VERSION', '"@0@"'.format(meson.project_version()))
+conf.set('DATA_DIR', '"@0@"'.format(shareddir))
+conf.set('HAVE_GTK_SOURCEVIEW', gtksourceview.found())
+conf.set('GETTEXT_PACKAGE', '"@0@"'.format(meson.project_name()))
+conf.set('LOCALEDIR', '"@0@"'.format(join_paths(get_option('prefix'), get_option('localedir'))))
+
+configure_file(input: 'config.h.meson', output: 'config.h', configuration: conf)
+config_header = declare_dependency(compile_args : '-DHAVE_CONFIG_H=1', include_directories : 
include_directories('.'))
+
+subdir('data')
+subdir('src')
+subdir('po')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..a74a9ec
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,3 @@
+option('av-tools', type: 'boolean', value: 'true', description: 'Built AV tools')
+option('uninstalled', type: 'boolean', value: 'false', description: 'Run UPnP tools from src tree')
+
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..2232299
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('gupnp-tools', preset: 'glib')
diff --git a/src/av-cp/didl-dialog.c b/src/av-cp/didl-dialog.c
index 62ac9f1..489f688 100644
--- a/src/av-cp/didl-dialog.c
+++ b/src/av-cp/didl-dialog.c
@@ -71,8 +71,6 @@ av_cp_didl_dialog_init (AVCPDidlDialog *self)
 static void
 av_cp_didl_dialog_constructed (GObject *object)
 {
-        AVCPDidlDialog *self = AV_CP_DIDL_DIALOG (object);
-        AVCPDidlDialogPrivate *priv;
         GObjectClass *parent_class = NULL;
 
         parent_class = G_OBJECT_CLASS (av_cp_didl_dialog_parent_class);
@@ -80,13 +78,16 @@ av_cp_didl_dialog_constructed (GObject *object)
             parent_class->constructed (object);
         }
 
-        priv = av_cp_didl_dialog_get_instance_private (self);
-
         g_signal_connect (object, "delete-event",
                           G_CALLBACK (gtk_widget_hide_on_delete), NULL);
 
 #ifdef HAVE_GTK_SOURCEVIEW
         {
+                AVCPDidlDialog *self = AV_CP_DIDL_DIALOG (object);
+                AVCPDidlDialogPrivate *priv;
+
+                priv = av_cp_didl_dialog_get_instance_private (self);
+
                 GtkSourceLanguageManager *manager =
                                 gtk_source_language_manager_get_default ();
                 GtkSourceLanguage *language =
diff --git a/src/av-cp/gui.c b/src/av-cp/gui.c
index 11df298..04c3b88 100644
--- a/src/av-cp/gui.c
+++ b/src/av-cp/gui.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <gmodule.h>
 
 #include "gui.h"
diff --git a/src/av-cp/meson.build b/src/av-cp/meson.build
new file mode 100644
index 0000000..59955ee
--- /dev/null
+++ b/src/av-cp/meson.build
@@ -0,0 +1,25 @@
+av_cp_resources = gnome.compile_resources('av-cp-resource',
+    join_paths(resource_data, 'org.gupnp.Tools.AV-CP.gresource.xml'),
+    source_dir : resource_data,
+    dependencies: didl_dialog_ui)
+
+executable('gupnp-av-cp',
+           ['didl-dialog.c',
+            'didl-dialog.h',
+            'gui.c',
+            'gui.h',
+            'main.c',
+            'main.h',
+            'playlist-treeview.c',
+            'playlist-treeview.h',
+            'renderer-combo.c',
+            'renderer-combo.h',
+            'renderer-controls.c',
+            'renderer-controls.h',
+            'search-dialog.c',
+            'search-dialog.h',
+            'server-device.c',
+            'server-device.h'] + av_cp_resources,
+           dependencies : [gupnp, gssdp, gupnp_av, gtk, util, gtksourceview, config_header],
+           export_dynamic : true,
+           install : true)
diff --git a/src/av-cp/playlist-treeview.c b/src/av-cp/playlist-treeview.c
index 1f7b3f1..bee3222 100644
--- a/src/av-cp/playlist-treeview.c
+++ b/src/av-cp/playlist-treeview.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <gmodule.h>
 
 #include "playlist-treeview.h"
diff --git a/src/av-cp/playlist-treeview.h b/src/av-cp/playlist-treeview.h
index 16b131e..b711df2 100644
--- a/src/av-cp/playlist-treeview.h
+++ b/src/av-cp/playlist-treeview.h
@@ -21,7 +21,9 @@
 #ifndef __PLAYLISTTREEVIEW_H__
 #define __PLAYLISTTREEVIEW_H__
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <gtk/gtk.h>
 
 #include <libgupnp/gupnp.h>
diff --git a/src/av-cp/renderer-combo.c b/src/av-cp/renderer-combo.c
index 250c564..2aef43b 100644
--- a/src/av-cp/renderer-combo.c
+++ b/src/av-cp/renderer-combo.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include "renderer-combo.h"
 #include "renderer-controls.h"
diff --git a/src/av-cp/renderer-combo.h b/src/av-cp/renderer-combo.h
index cf1126e..19ce3a1 100644
--- a/src/av-cp/renderer-combo.h
+++ b/src/av-cp/renderer-combo.h
@@ -23,7 +23,9 @@
 
 #include <libgupnp/gupnp.h>
 #include <libgupnp-av/gupnp-av.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <gtk/gtk.h>
 
 typedef enum
diff --git a/src/av-cp/renderer-controls.c b/src/av-cp/renderer-controls.c
index 04e3362..bd56403 100644
--- a/src/av-cp/renderer-controls.c
+++ b/src/av-cp/renderer-controls.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <gtk/gtk.h>
 #include <gmodule.h>
 
diff --git a/src/av-cp/renderer-controls.h b/src/av-cp/renderer-controls.h
index 9ac3b82..d63fe9b 100644
--- a/src/av-cp/renderer-controls.h
+++ b/src/av-cp/renderer-controls.h
@@ -23,7 +23,9 @@
 
 #include <libgupnp/gupnp.h>
 #include <libgupnp-av/gupnp-av.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <gtk/gtk.h>
 
 #include "renderer-combo.h"
diff --git a/src/common/icons.c b/src/common/icons.c
index a6cf842..51a986b 100644
--- a/src/common/icons.c
+++ b/src/common/icons.c
@@ -18,9 +18,12 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <string.h>
 #include <stdlib.h>
-#include <config.h>
 #include <libsoup/soup.h>
 
 #include "icons.h"
diff --git a/src/common/meson.build b/src/common/meson.build
new file mode 100644
index 0000000..68b1ca5
--- /dev/null
+++ b/src/common/meson.build
@@ -0,0 +1,10 @@
+util_resource = gnome.compile_resources('common-resource',
+    join_paths(resource_data, 'org.gupnp.Tools.Common.gresource.xml'),
+    source_dir : resource_data,
+    extra_args : ['--manual-register', '--c-name', 'gupnp_tools_common']
+)
+
+libutil = static_library('util', ['icons.c', 'icons.h', 'pretty-print.c', 'pretty-print.h'] + util_resource,
+    dependencies : [libxml, soup, gupnp, gtk])
+
+util = declare_dependency(link_with: libutil, include_directories : include_directories('.'))
diff --git a/src/discover/meson.build b/src/discover/meson.build
new file mode 100644
index 0000000..a67a403
--- /dev/null
+++ b/src/discover/meson.build
@@ -0,0 +1 @@
+executable('gssdp-discover', ['gssdp-discover.c'], dependencies : [gssdp, gobject], install: true)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..84b2ca2
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,10 @@
+subdir('common')
+
+if get_option('av-tools') and gupnp_av.found()
+    subdir('av-cp')
+endif
+
+subdir('discover')
+subdir('network-light')
+subdir('universal-cp')
+subdir('upload')
diff --git a/src/network-light/gui.c b/src/network-light/gui.c
index 7259801..3eea8d8 100644
--- a/src/network-light/gui.c
+++ b/src/network-light/gui.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 #include <gmodule.h>
 
 #include "gui.h"
@@ -28,10 +30,10 @@
 #include "upnp.h"
 #include "main.h"
 
-#define UI_FILE DATA_DIR "/gupnp-network-light.ui"
-#define ICON_FILE        "pixmaps/network-light-256x256.png"
-#define OFF_FILE         "pixmaps/network-light-off.png"
-#define ON_FILE          "pixmaps/network-light-on.png"
+#define UI_FILE   "/org/gupnp/Tools/Network-Light/gupnp-network-light.ui"
+#define ICON_FILE "/org/gupnp/Tools/Network-Light/pixmaps/network-light-256x256.png"
+#define OFF_FILE  "/org/gupnp/Tools/Network-Light/pixmaps/network-light-off.png"
+#define ON_FILE   "/org/gupnp/Tools/Network-Light/pixmaps/network-light-on.png"
 
 static GtkBuilder *builder;
 static GtkWidget  *main_window;
@@ -224,7 +226,7 @@ init_ui (gint   *argc,
         g_assert (builder != NULL);
         gtk_builder_set_translation_domain(builder, GETTEXT_PACKAGE);
 
-        if (!gtk_builder_add_from_file (builder, UI_FILE, &error)) {
+        if (!gtk_builder_add_from_resource (builder, UI_FILE, &error)) {
                 g_critical ("Unable to load the GUI file %s: %s",
                             UI_FILE,
                             error->message);
@@ -245,17 +247,17 @@ init_ui (gint   *argc,
                                                            "about-dialog"));
         g_assert (about_dialog != NULL);
 
-        on_pixbuf = load_pixbuf_file (ON_FILE);
+        on_pixbuf = gdk_pixbuf_new_from_resource (ON_FILE, NULL);
         if (on_pixbuf == NULL)
                 return FALSE;
 
-        off_pixbuf = load_pixbuf_file (OFF_FILE);
+        off_pixbuf = gdk_pixbuf_new_from_resource (OFF_FILE, NULL);
         if (off_pixbuf == NULL) {
                 g_object_unref (on_pixbuf);
                 return FALSE;
         }
 
-        icon_pixbuf = load_pixbuf_file (ICON_FILE);
+        icon_pixbuf = gdk_pixbuf_new_from_resource (ICON_FILE, NULL);
         if (icon_pixbuf == NULL) {
                 g_object_unref (on_pixbuf);
                 g_object_unref (off_pixbuf);
diff --git a/src/network-light/main.c b/src/network-light/main.c
index 5f62d8e..5d535a2 100644
--- a/src/network-light/main.c
+++ b/src/network-light/main.c
@@ -23,7 +23,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
 #include <stdio.h>
diff --git a/src/network-light/meson.build b/src/network-light/meson.build
new file mode 100644
index 0000000..daf1a27
--- /dev/null
+++ b/src/network-light/meson.build
@@ -0,0 +1,16 @@
+network_light_resource = gnome.compile_resources('network-light-resource',
+    join_paths(resource_data, 'org.gupnp.Tools.Network-Light.gresource.xml'),
+    source_dir : resource_data)
+
+executable('gupnp-network-light',
+           [
+               'gui.c',
+               'gui.h',
+               'main.c',
+               'main.h',
+               'upnp.c',
+               'upnp.h'
+           ] + network_light_resource,
+           export_dynamic: true,
+           install : true,
+           dependencies : [gupnp, gtk, util, gssdp, config_header])
diff --git a/src/network-light/upnp.c b/src/network-light/upnp.c
index e913028..b87e985 100644
--- a/src/network-light/upnp.c
+++ b/src/network-light/upnp.c
@@ -28,6 +28,10 @@
 #include <gmodule.h>
 #include <glib/gstdio.h>
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "gui.h"
 #include "upnp.h"
 #include "main.h"
diff --git a/src/universal-cp/action-dialog.c b/src/universal-cp/action-dialog.c
index 481b34d..6380fec 100644
--- a/src/universal-cp/action-dialog.c
+++ b/src/universal-cp/action-dialog.c
@@ -22,7 +22,10 @@
 
 #include <string.h>
 #include <stdlib.h>
+
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <gmodule.h>
 #include <glib/gi18n.h>
diff --git a/src/universal-cp/details-treeview.c b/src/universal-cp/details-treeview.c
index 9ce543d..0ac1c2b 100644
--- a/src/universal-cp/details-treeview.c
+++ b/src/universal-cp/details-treeview.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <gmodule.h>
 #include <glib/gi18n.h>
diff --git a/src/universal-cp/device-treeview.c b/src/universal-cp/device-treeview.c
index f027ace..bb904a6 100644
--- a/src/universal-cp/device-treeview.c
+++ b/src/universal-cp/device-treeview.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <gmodule.h>
 #include <glib/gi18n.h>
diff --git a/src/universal-cp/device-treeview.h b/src/universal-cp/device-treeview.h
index 94e5d25..89144be 100644
--- a/src/universal-cp/device-treeview.h
+++ b/src/universal-cp/device-treeview.h
@@ -23,7 +23,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 gboolean
 find_device             (GtkTreeModel              *model,
diff --git a/src/universal-cp/event-treeview.c b/src/universal-cp/event-treeview.c
index 9542b3c..f9d9cd1 100644
--- a/src/universal-cp/event-treeview.c
+++ b/src/universal-cp/event-treeview.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <gmodule.h>
 #include <glib/gi18n.h>
diff --git a/src/universal-cp/gui.c b/src/universal-cp/gui.c
index d307121..5dcea4b 100644
--- a/src/universal-cp/gui.c
+++ b/src/universal-cp/gui.c
@@ -20,7 +20,9 @@
 
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <gmodule.h>
 
@@ -31,8 +33,8 @@
 #include "icons.h"
 #include "main.h"
 
-#define UI_FILE DATA_DIR "/gupnp-universal-cp.ui"
-#define ICON_FILE  "pixmaps/universal-cp.png"
+#define UI_FILE "/org/gupnp/Tools/Universal-CP/gupnp-universal-cp.ui"
+#define ICON_FILE  "/org/gupnp/Tools/Universal-CP/pixmaps/universal-cp.png"
 
 GtkBuilder *builder;
 static GtkWidget *main_window;
@@ -116,7 +118,7 @@ init_ui (gint   *argc,
         g_assert (builder != NULL);
         gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
 
-        if (!gtk_builder_add_from_file (builder, UI_FILE, &error)) {
+        if (!gtk_builder_add_from_resource (builder, UI_FILE, &error)) {
                 g_critical ("Unable to load the GUI file %s: %s",
                             UI_FILE,
                             error->message);
@@ -167,7 +169,7 @@ init_ui (gint   *argc,
 
         init_icons ();
 
-        icon_pixbuf = load_pixbuf_file (ICON_FILE);
+        icon_pixbuf = gdk_pixbuf_new_from_resource (ICON_FILE, NULL);
         if (icon_pixbuf == NULL) {
                 return FALSE;
         }
diff --git a/src/universal-cp/meson.build b/src/universal-cp/meson.build
new file mode 100644
index 0000000..7e46524
--- /dev/null
+++ b/src/universal-cp/meson.build
@@ -0,0 +1,23 @@
+universal_cp_resource = gnome.compile_resources('universal-cp-resource',
+    join_paths(resource_data, 'org.gupnp.Tools.Universal-CP.gresource.xml'),
+    source_dir : resource_data)
+
+executable('gupnp-universal-cp',
+           [
+               'action-dialog.c',
+               'action-dialog.h',
+               'details-treeview.c',
+               'details-treeview.h',
+               'device-treeview.c',
+               'device-treeview.h',
+               'event-treeview.c',
+               'event-treeview.h',
+               'gui.c',
+               'gui.h',
+               'main.c',
+               'main.h'
+           ] + universal_cp_resource,
+           export_dynamic: true,
+           install : true,
+           dependencies : [util, glib, gupnp, gtk, gssdp, config_header])
+
diff --git a/src/upload/main.c b/src/upload/main.c
index 68af215..c97e31a 100644
--- a/src/upload/main.c
+++ b/src/upload/main.c
@@ -21,7 +21,9 @@
 #include <libgupnp/gupnp.h>
 #include <string.h>
 #include <stdlib.h>
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include "control_point.h"
 #include "item-creation.h"
diff --git a/src/upload/meson.build b/src/upload/meson.build
new file mode 100644
index 0000000..cc00936
--- /dev/null
+++ b/src/upload/meson.build
@@ -0,0 +1,14 @@
+executable('gupnp-upload',
+           ['main.c',
+            'transfer.c',
+            'container-search.c',
+            'item-creation.h',
+            'main.h',
+            'transfer.h',
+            'container-search.h',
+            'item-creation.c',
+            'control_point.h',
+            'control_point.c'],
+        dependencies: [gupnp, gssdp, gupnp_av, gio, config_header],
+        install: true,
+        export_dynamic : true)


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