[gtk/wip/otte/build: 4/6] build: Make all X11 extensions mandatory




commit e544c891ca2505339e33d96740f373414fa6c14e
Author: Benjamin Otte <otte redhat com>
Date:   Fri Apr 2 02:13:49 2021 +0200

    build: Make all X11 extensions mandatory
    
    It's not 2011 anymore, and we shouldn't randomly build one of 10.000
    different combinations of X11 backends (I counted the possibilities) but
    exactly the one we expect people to use.

 meson.build       | 65 ++++++++++++++++++++++++-------------------------------
 meson_options.txt |  5 -----
 2 files changed, 28 insertions(+), 42 deletions(-)
---
diff --git a/meson.build b/meson.build
index 10665b855d..f3e4fa1a2a 100644
--- a/meson.build
+++ b/meson.build
@@ -497,46 +497,36 @@ if x11_enabled
   xrender_dep    = dependency('xrender')
   xi_dep         = dependency('xi')
   xext_dep       = dependency('xext')
-  xcursor_dep    = dependency('xcursor', required: false)
-  xdamage_dep    = dependency('xdamage', required: false)
-  xfixes_dep     = dependency('xfixes', required: false)
-  xcomposite_dep = dependency('xcomposite', required: false)
+  xcursor_dep    = dependency('xcursor')
+  xdamage_dep    = dependency('xdamage')
+  xfixes_dep     = dependency('xfixes')
+  xcomposite_dep = dependency('xcomposite')
   fontconfig_dep = dependency('fontconfig')
 
-  x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr']
+  x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr', 'xcursor', 'xdamage', 'xfixes', 'xcomposite', 
'xinerama']
 
-  if xcursor_dep.found()
-    x11_pkgs += ['xcursor']
-  endif
-  if xdamage_dep.found()
-    x11_pkgs += ['xdamage']
-  endif
-  if xfixes_dep.found()
-    x11_pkgs += ['xfixes']
-  endif
-  if xcomposite_dep.found()
-    x11_pkgs += ['xcomposite']
-  endif
-
-  cdata.set('HAVE_XCURSOR', xcursor_dep.found())
-  cdata.set('HAVE_XDAMAGE', xdamage_dep.found())
-  cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found())
-  cdata.set('HAVE_XFIXES', xfixes_dep.found())
+  cdata.set('HAVE_XCURSOR', 1)
+  cdata.set('HAVE_XDAMAGE', 1)
+  cdata.set('HAVE_XCOMPOSITE', 1)
+  cdata.set('HAVE_XFIXES', 1)
 
-  if cc.has_function('XkbQueryExtension', dependencies: x11_dep,
-                     prefix : '#include <X11/XKBlib.h>')
-    cdata.set('HAVE_XKB', 1)
+  if not cc.has_function('XkbQueryExtension', dependencies: x11_dep,
+                         prefix : '#include <X11/XKBlib.h>')
+    error('X11 backend enabled, but Xkb not found.')
   endif
+  cdata.set('HAVE_XKB', 1)
 
-  if cc.has_function('XSyncQueryExtension', dependencies: xext_dep,
-                     prefix: '''#include <X11/Xlib.h>
-                                #include <X11/extensions/sync.h>''')
-    cdata.set('HAVE_XSYNC', 1)
+  if not cc.has_function('XSyncQueryExtension', dependencies: xext_dep,
+                         prefix: '''#include <X11/Xlib.h>
+                                    #include <X11/extensions/sync.h>''')
+    error('X11 backend enabled, but Xsync not found.')
   endif
+  cdata.set('HAVE_XSYNC', 1)
 
-  if cc.has_function('XGetEventData', dependencies: x11_dep)
-    cdata.set('HAVE_XGENERICEVENTS', 1)
+  if not cc.has_function('XGetEventData', dependencies: x11_dep)
+    error('X11 backend enabled, but no generic event support.')
   endif
+  cdata.set('HAVE_XGENERICEVENTS', 1)
 
   if not xi_dep.found() or not cc.has_header('X11/extensions/XInput2.h', dependencies: xi_dep)
     error('X11 backend enabled, but XInput2 not found.')
@@ -549,15 +539,16 @@ if x11_enabled
   has_scroll_class_info = cc.has_member('XIScrollClassInfo', 'number', dependencies: xi_dep,
                                         prefix: '''#include <X11/Xlib.h>
                                                    #include <X11/extensions/XInput2.h>''')
-  if has_allow_touch_events and has_scroll_class_info
-    cdata.set('XINPUT_2_2', 1)
+  if not has_allow_touch_events or not has_scroll_class_info
+    error('X11 backend enabled, but XInput2.2 not found.')
   endif
+  cdata.set('XINPUT_2_2', 1)
 
-  xinerama_dep = dependency('xinerama', required: get_option('xinerama'))
-  if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', 
dependencies: xinerama_dep)
-    cdata.set('HAVE_XFREE_XINERAMA', 1)
-    x11_pkgs += ['xinerama']
+  xinerama_dep = dependency('xinerama')
+  if not cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: 
xinerama_dep)
+    error('X11 backend enabled, but Xinerama extension does not work.')
   endif
+  cdata.set('HAVE_XFREE_XINERAMA', 1)
 
   cdata.set('HAVE_RANDR', xrandr_dep.found())
   cdata.set('HAVE_RANDR15', xrandr15_dep.found())
diff --git a/meson_options.txt b/meson_options.txt
index 29d1862031..61878ceba4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -53,11 +53,6 @@ option('vulkan',
        value: 'disabled',
        description : 'Enable support for the experimental Vulkan graphics API')
 
-option('xinerama',
-       type: 'feature',
-       value: 'auto',
-       description : 'Enable support for the X11 Xinerama extension')
-
 option('cloudproviders',
        type: 'feature',
        value: 'disabled',


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