[gedit] meson: get filebrowser plugin working again



commit b90d9f49013fac4b6feb6311da4780ee100020d0
Author: Jeremy Bicha <jbicha ubuntu com>
Date:   Sun Jan 27 17:13:22 2019 -0500

    meson: get filebrowser plugin working again
    
    This won't work on Windows but it's good enough for now.
    
    This functionally matches what autotools did:
    cat the 2 mkenums templates together. It feels a
    bit messy to me but it seems to make sense.

 .../gedit-file-browser-enum-register.c.template    |  2 +-
 ...edit-file-browser-enum-types-stage1.c.template} |  2 +-
 .../gedit-file-browser-enum-types.h.template       |  2 +-
 plugins/filebrowser/meson.build                    | 27 +++++++++++++++++++---
 4 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-enum-register.c.template 
b/plugins/filebrowser/gedit-file-browser-enum-register.c.template
index 1b20fdffc..c97ffff48 100644
--- a/plugins/filebrowser/gedit-file-browser-enum-register.c.template
+++ b/plugins/filebrowser/gedit-file-browser-enum-register.c.template
@@ -5,7 +5,7 @@ gedit_file_browser_enum_and_flag_register_type (GTypeModule * module)
 /*** END file-header ***/
 
 /*** BEGIN file-production ***/
-       /* Enumerations from "@filename@" */
+       /* Enumerations from "@basename@" */
 
 /*** END file-production ***/
 
diff --git a/plugins/filebrowser/gedit-file-browser-enum-types.c.template 
b/plugins/filebrowser/gedit-file-browser-enum-types-stage1.c.template
similarity index 97%
rename from plugins/filebrowser/gedit-file-browser-enum-types.c.template
rename to plugins/filebrowser/gedit-file-browser-enum-types-stage1.c.template
index 4e89370de..fd58866db 100644
--- a/plugins/filebrowser/gedit-file-browser-enum-types.c.template
+++ b/plugins/filebrowser/gedit-file-browser-enum-types-stage1.c.template
@@ -5,7 +5,7 @@
 
 /*** BEGIN file-production ***/
 /* enumerations from "@filename@" */
-#include "@filename@"
+#include "@basename@"
 
 /*** END file-production ***/
 
diff --git a/plugins/filebrowser/gedit-file-browser-enum-types.h.template 
b/plugins/filebrowser/gedit-file-browser-enum-types.h.template
index c2013e12f..c13167abe 100644
--- a/plugins/filebrowser/gedit-file-browser-enum-types.h.template
+++ b/plugins/filebrowser/gedit-file-browser-enum-types.h.template
@@ -9,7 +9,7 @@ G_BEGIN_DECLS
 /*** END file-header ***/
 
 /*** BEGIN file-production ***/
-/* Enumerations from "@filename@" */
+/* Enumerations from "@basename@" */
 
 /*** END file-production ***/
 
diff --git a/plugins/filebrowser/meson.build b/plugins/filebrowser/meson.build
index 081e854d0..374d7eda2 100644
--- a/plugins/filebrowser/meson.build
+++ b/plugins/filebrowser/meson.build
@@ -29,15 +29,36 @@ libfilebrowser_c_args = [
 
 subdir('messages')
 
-libfilebrowser_enums = gnome.mkenums(
+libfilebrowser_register_enums = gnome.mkenums(
+  'gedit-file-browser-enum-register',
+  sources: libfilebrowser_public_h,
+  c_template: 'gedit-file-browser-enum-register.c.template',
+)
+
+libfilebrowser_type_enums = gnome.mkenums(
   'gedit-file-browser-enum-types',
+  depends : [libfilebrowser_register_enums],
   sources: libfilebrowser_public_h,
   h_template: 'gedit-file-browser-enum-types.h.template',
-  c_template: 'gedit-file-browser-enum-types.c.template',
+  c_template: 'gedit-file-browser-enum-types-stage1.c.template',
+)
+
+# cat won't work on Windows so this
+# will need to be reimplemented as a script
+cat = find_program('cat')
+
+# Combine the 2 C mkenums templates together before compiling
+libfilebrowser_enums_c = custom_target('libfilebrowser_enums_c',
+  input: [libfilebrowser_type_enums.get(0),
+          libfilebrowser_register_enums],
+  output: 'gedit-file-browser-enum-types.c',
+  command: [cat, '@INPUT0@', '@INPUT1@'],
+  # redirects the command output since we can't use >> here
+  capture: true,
 )
 
 libfilebrowser_sources += [
-  libfilebrowser_enums.get(0),
+  libfilebrowser_enums_c,
 ]
 
 subdir('resources')


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