Simplify the Wayland code generation
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 11 Apr 2018 13:37:57 +0000 (14:37 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 11 Apr 2018 14:06:43 +0000 (15:06 +0100)
Instead of going through an ancillary script to strip away the
`WL_EXPORT` annotation from the generated code, we should bump up the
required version of Wayland, and use the `private-code` argument for
wayland-scanner, which does the right thing for us.

gdk/wayland/genprotocolfiles.py [deleted file]
gdk/wayland/meson.build
gtk/meson.build
meson.build

diff --git a/gdk/wayland/genprotocolfiles.py b/gdk/wayland/genprotocolfiles.py
deleted file mode 100755 (executable)
index 1edd4e3..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-
-import sys
-import re
-import shutil
-import subprocess
-
-scanner  = sys.argv[1]
-in_file  = sys.argv[2]
-out_file = sys.argv[3]
-#TODO: We can infer this optinon from the name of the output file!
-option   = sys.argv[4]
-
-pc = subprocess.Popen([scanner, option, in_file, out_file], stdout=subprocess.PIPE)
-(stdo, _) = pc.communicate()
-if pc.returncode != 0:
-    sys.exit(pc.returncode)
-
-# Now read the generated file again and remove all WL_EXPORTs
-content = ""
-with open(out_file, 'r', encoding='utf-8') as content_file:
-    content = content_file.read()
-
-content = content.replace('WL_EXPORT ', '')
-ofile = open(out_file, 'w')
-ofile.write(content)
-ofile.close()
-
-
-
-# unstable = False
-
-# if "unstable" in out_file:
-    # unstable = True
-
-
-# if out_file.endswith("-protocol.c"):
-    # print("protocol source")
-# elif out_file.endswith("-client-protocol.h"):
-    # print("client protocol header")
-# elif out_file.endswith("-server-protocol.h"):
-    # print("server protocol header")
-# else:
-    # print("ERROR: '",out_file,"' is not a valid output file")
index 6390e57c19e0ca9a1d3b6196f792f978161fcb6b..8bf47186110e316051ed16f1c1d16cfa658c3115 100644 (file)
@@ -41,7 +41,6 @@ proto_dir = dependency('wayland-protocols').get_pkgconfig_variable('pkgdatadir')
 assert(proto_dir != '', 'Could not get pkgdatadir from wayland-protocols.pc')
 
 wayland_scanner = find_program('wayland-scanner')
-genprotocols = find_program('genprotocolfiles.py')
 
 # Format:
 #  - protocol name
@@ -77,20 +76,18 @@ foreach p: proto_sources
                                            input: input,
                                            output: '@0@-client-protocol.h'.format(output_base),
                                            command: [
-                                             genprotocols,
                                              wayland_scanner,
-                                             '@INPUT@', '@OUTPUT@',
                                              'client-header',
+                                             '@INPUT@', '@OUTPUT@',
                                            ])
 
   gdk_wayland_sources += custom_target('@0@ source'.format(output_base),
                                        input: input,
                                        output: '@0@-protocol.c'.format(output_base),
                                        command: [
-                                         genprotocols,
                                          wayland_scanner,
+                                         'private-code',
                                          '@INPUT@', '@OUTPUT@',
-                                         'code',
                                        ])
 endforeach
 
index f1e057189d1cb18268578e200a220b82556ab85d..075cc9069fdeb3d57817a39b2773955df1f16852 100644 (file)
@@ -600,10 +600,6 @@ proto_sources = [
 ]
 
 im_wayland_sources = files('gtkimcontextwayland.c')
-if wayland_enabled
-  wayland_scanner = find_program('wayland-scanner')
-  genprotocols = find_program('../gdk/wayland/genprotocolfiles.py')
-endif
 
 foreach p: proto_sources
   proto_name = p.get(0)
@@ -619,24 +615,23 @@ foreach p: proto_sources
   endif
 
   if wayland_enabled
+    # wayland_scanner is defined in gdk/wayland/meson.build
     im_wayland_sources += custom_target('@0@ client header'.format(output_base),
                                         input: input,
                                         output: '@0@-client-protocol.h'.format(output_base),
                                         command: [
-                                          genprotocols,
                                           wayland_scanner,
-                                          '@INPUT@', '@OUTPUT@',
                                           'client-header',
+                                          '@INPUT@', '@OUTPUT@',
                                         ])
 
     im_wayland_sources += custom_target('@0@ source'.format(output_base),
                                         input: input,
                                         output: '@0@-protocol.c'.format(output_base),
                                         command: [
-                                          genprotocols,
                                           wayland_scanner,
+                                          'private-code',
                                           '@INPUT@', '@OUTPUT@',
-                                          'code',
                                         ])
   endif
 endforeach
index de66c987eb5315397e9b46bbafa9d67cb449a5fa..fbc23ba2577bf5b5c577e9c47a96ee3f3236b6a7 100644 (file)
@@ -33,7 +33,7 @@ cairo_req          = '>= 1.14.0'
 gdk_pixbuf_req     = '>= 2.30.0'
 introspection_req  = '>= 1.39.0'
 wayland_proto_req  = '>= 1.9'
-wayland_req        = '>= 1.9.91'
+wayland_req        = '>= 1.14.91'
 graphene_req       = '>= 1.5.1'
 epoxy_req          = '>= 1.4'
 cloudproviders_req = '>= 0.2.5'