[balsa/wip/gmime3: 103/197] Use gnome.genmarshal if glib is new enough



commit 0567829c31ab41746b8f3ad327f449b6782d0b28
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Sep 26 11:21:55 2017 -0400

    Use gnome.genmarshal if glib is new enough
    
        * meson.build: check whether glib version >= 2.53.4.
        * libbalsa/imap/meson.build: use gnome.genmarshal if glib is new
        enough; otherwise, use glib-genmarshal directly instead of in a
        sh command.
        * libbalsa/meson.build: ditto.

 ChangeLog                 |   10 +++++++
 doc/ChangeLog             |    6 ++++
 doc/meson.build           |    2 -
 libbalsa/imap/meson.build |   58 +++++++++++++++++++++++---------------------
 libbalsa/meson.build      |   58 ++++++++++++++++++++++++---------------------
 meson.build               |   27 +++++++++++----------
 6 files changed, 91 insertions(+), 70 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index abceb7e..66183db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2017-09-26  Peter Bloomfield  <pbloomfield bellsouth net>
 
+       Use gnome.genmarshal if glib is new enough
+
+       * meson.build: check whether glib version >= 2.53.4.
+       * libbalsa/imap/meson.build: use gnome.genmarshal if glib is new
+       enough; otherwise, use glib-genmarshal directly instead of in a
+       sh command.
+       * libbalsa/meson.build: ditto.
+
+2017-09-26  Peter Bloomfield  <pbloomfield bellsouth net>
+
        Use --output option of glib-genmarshal
 
        * libbalsa/imap/meson.build:
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 7eaf4b5..4feacab 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-26  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       reviewed by: <delete if not using a buddy>
+
+       * meson.build:
+
 2017-09-14  Peter Bloomfield  <pbloomfield bellsouth net>
 
        reviewed by: <delete if not using a buddy>
diff --git a/doc/meson.build b/doc/meson.build
index e8eeee3..1feb9ba 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,7 +1,5 @@
 # doc/meson.build
 
-gnome = import('gnome')
-
 HELP_ID      = 'balsa'
 
 HELP_LINGUAS = [ 'cs', 'de', 'el', 'es', 'fr', 'sl' ]
diff --git a/libbalsa/imap/meson.build b/libbalsa/imap/meson.build
index 2288c54..d417390 100644
--- a/libbalsa/imap/meson.build
+++ b/libbalsa/imap/meson.build
@@ -25,42 +25,44 @@ libimap_a_sources = [
 # genmarshal
 #
 
-libimap_marshal_h = custom_target('libimap_marshal_h',
-  input   : 'libimap-marshal.list',
-  output  : 'libimap-marshal.h',
-  command : [
-    'sh', '-c',
-    glib_genmarshal +
-    ' --header' +
-    ' --prefix=libimap' +
-    ' --output=@OUTPUT@' +
-    ' @INPUT@'
-  ]
-)
+if use_gnome_genmarshal
+  libimap_marshal_files = gnome.genmarshal('libimap_marshal',
+                                           sources : 'libimap-marshal.list')
+else # use_gnome_genmarshal
+  libimap_marshal_h = custom_target('libimap_marshal_h',
+    input   : 'libimap-marshal.list',
+    output  : 'libimap-marshal.h',
+    command : [
+      glib_genmarshal,
+      '--header',
+      '--prefix=libimap',
+      '--output=@OUTPUT@',
+      '@INPUT@'
+    ]
+  )
 
-libimap_marshal_c = custom_target('libimap_marshal_c',
-  input   : 'libimap-marshal.list',
-  output  : 'libimap-marshal.c',
-  command : [
-    'sh', '-c',
-    glib_genmarshal +
-    ' --header' +
-    ' --body' +
-    ' --prefix=libimap' +
-    ' --output=@OUTPUT@' +
-    ' @INPUT@'
-  ]
-)
+  libimap_marshal_c = custom_target('libimap_marshal_c',
+    input   : 'libimap-marshal.list',
+    output  : 'libimap-marshal.c',
+    command : [
+      glib_genmarshal,
+      '--header',
+      '--body',
+      '--prefix=libimap',
+      '--output=@OUTPUT@',
+      '@INPUT@'
+    ]
+  )
 
-#
+  libimap_marshal_files = [libimap_marshal_c, libimap_marshal_h]
+endif # use_gnome_genmarshal
 
 libimap_compile_arg = '-ansi'
 libimap_link_arg    = '-lz'
 libimap_compile_dep  = declare_dependency(compile_args : libimap_compile_arg,
                                           link_args    : libimap_link_arg)
 
-libimap_a = static_library('imap', libimap_a_sources,
-                           libimap_marshal_c, libimap_marshal_h,
+libimap_a = static_library('imap', libimap_a_sources, libimap_marshal_files,
                            dependencies        : balsa_deps + [libimap_compile_dep],
                            include_directories : [top_include, libnetclient_include],
                            install             : false)
diff --git a/libbalsa/meson.build b/libbalsa/meson.build
index 46de801..b58ad23 100644
--- a/libbalsa/meson.build
+++ b/libbalsa/meson.build
@@ -138,37 +138,41 @@ libbalsa_a_sources += libbalsa_gpgme_extra
 # genmarshal
 #
 
-libbalsa_marshal_h = custom_target('libbalsa_marshal_h',
-  input   : 'libbalsa-marshal.list',
-  output  : 'libbalsa-marshal.h',
-  command : [
-    'sh', '-c',
-    glib_genmarshal +
-    ' --header' +
-    ' --prefix=libbalsa' +
-    ' --output=@OUTPUT@' +
-    ' @INPUT@'
-  ]
-)
+if use_gnome_genmarshal
+  libbalsa_marshal_files = gnome.genmarshal('libbalsa_marshal',
+                                             sources : 'libbalsa-marshal.list')
+else # use_gnome_genmarshal
+  libbalsa_marshal_h = custom_target('libbalsa_marshal_h',
+    input   : 'libbalsa-marshal.list',
+    output  : 'libbalsa-marshal.h',
+    command : [
+      glib_genmarshal,
+      '--header',
+      '--prefix=libbalsa',
+      '--output=@OUTPUT@',
+      '@INPUT@'
+    ]
+  )
 
-libbalsa_marshal_c = custom_target('libbalsa_marshal_c',
-  input   : 'libbalsa-marshal.list',
-  output  : 'libbalsa-marshal.c',
-  command : [
-    'sh', '-c',
-    glib_genmarshal +
-    ' --header' +
-    ' --body' +
-    ' --prefix=libbalsa' +
-    ' --output=@OUTPUT@' +
-    ' @INPUT@'
-  ]
-)
+  libbalsa_marshal_c = custom_target('libbalsa_marshal_c',
+    input   : 'libbalsa-marshal.list',
+    output  : 'libbalsa-marshal.c',
+    command : [
+      glib_genmarshal,
+      '--header',
+      '--body',
+      '--prefix=libbalsa',
+      '--output=@OUTPUT@',
+      '@INPUT@'
+    ]
+  )
+
+  libbalsa_marshal_files = [libbalsa_marshal_c, libbalsa_marshal_h]
+endif # use_gnome_genmarshal
 
 libimap_include = include_directories('imap')
 
-libbalsa_a = static_library('balsa', libbalsa_a_sources,
-                            libbalsa_marshal_c, libbalsa_marshal_h,
+libbalsa_a = static_library('balsa', libbalsa_a_sources, libbalsa_marshal_files,
                             dependencies        : balsa_deps,
                             include_directories : [top_include,
                                                    libnetclient_include,
diff --git a/meson.build b/meson.build
index 3226ebe..27e813b 100644
--- a/meson.build
+++ b/meson.build
@@ -81,19 +81,6 @@ if compiler.has_member('struct utsname', 'domainname', prefix : uts_prefix)
     description : 'Defined if domainname is a member of struct utsname')
 endif
 
-# glib-genmarshal
-#
-# We cannot use gnome.genmarshal because it generates a source file that
-# does not include the header file, which causes an error when compiling
-# with -Wmissing-prototypes and -Werror.
-#
-# If gnome.genmarshal is ever enhanced by adding the --include-header
-# option that is implemented in glib's internal build system, we should
-# use instead of this:
-
-glib_genmarshal = run_command('pkg-config',
-                              ['--variable=glib_genmarshal', 'glib-2.0']).stdout().strip()
-
 # yelp
 
 if help_files
@@ -164,6 +151,18 @@ libnetclient_deps = [glib_dep,
                      gio_dep,
                      gnutls_dep]
 
+# glib-genmarshal
+#
+# If glib is too old, we cannot use gnome.genmarshal
+# because it generates a source file that does not include the header file,
+# which causes an error when compiling with -Wmissing-prototypes and -Werror.
+
+use_gnome_genmarshal = glib_dep.version().version_compare('>= 2.53.4')
+if not use_gnome_genmarshal
+  glib_genmarshal = run_command('pkg-config',
+                                ['--variable=glib_genmarshal', 'glib-2.0']).stdout().strip()
+endif
+
 # Check whether res_init is available
 result = compiler.has_function('res_init', prefix : '#include <resolv.h>')
 if not result
@@ -736,6 +735,8 @@ libbalsa_include      = include_directories('libbalsa')
 libinit_balsa_include = include_directories('libinit_balsa')
 src_include           = include_directories('src')
 
+gnome = import('gnome')
+
 subdir('sounds')
 subdir('images')
 subdir('libnetclient')


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