[PATCH xserver 3/3] Add meson.build for XWin server

Jon Turney jon.turney at dronecode.org.uk
Fri May 26 19:46:38 UTC 2017


On 23/05/2017 00:17, Eric Anholt wrote:
> Jon Turney <jon.turney at dronecode.org.uk> writes:
> 
>> This needs a meson with PRs #1784, #1792 and #1794
>>
>> Future work: remove conditionals which are always on, and simplify redundant
>> CYGDEBUG conditionals
> 
> This looks pretty good!  Just a few little cleanups I see.

Thanks for taking a look.

>> +#
> 
> There seem to be some stray comment markers in this file.

Removed.

>> +
>> +xwin_glx_c_args = []
>> +xwin_glx_c_args += '-DXWIN_MULTIWINDOW'
>> +xwin_glx_c_args += '-DXWIN_GLX_WINDOWS'
> 
> This variable seems to be dead.
> 
>> +xwin_glx = static_library(
>> +    'XwinGLX',
>> +    srcs_windows_glx,
>> +    include_directories: [
>> +        inc,
>> +        top_srcdir_inc,
>> +        include_directories('../'),
>> +    ],
>> +    dependencies: pixman_dep,
>> +    c_args: xwin_c_args,

... should have been used here.

>> +
>> +if build_glx
>> +    if build_windowsdri
>> +        xwin_c_args += '-DXWIN_WINDOWS_DRI'
>> +        subdir('dri')
>> +    endif
>> +  xwin_c_args += '-DXWIN_GLX_WINDOWS'
>> +  xwin_sys_libs += '-lopengl32'
>> +  subdir('glx')
> 
> Mismatched indentation

Fixed.

>> +if cc.sizeof('unsigned long') == 8
>> +   xwin_data.set('_XSERVER64', '1')
>> +endif
> 
> xwin-config.h's definition of this one seems to be redundant with
> dix-config.h's.  I think you could just drop this block and the value in
> xwin-config.h.meson.in.

Yes, removed.

Updated patch attached.
-------------- next part --------------
From b614ffd5034faf2b720dab2e6c08689a11a330bd Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney at dronecode.org.uk>
Date: Sun, 7 May 2017 20:53:04 +0100
Subject: [PATCH xserver 3/3] Add meson.build for XWin server (v2)

This needs a meson with PRs #1784, #1792 and #1794

Future work: remove conditionals which are always on, and simplify redundant
CYGDEBUG conditionals
---
 hw/meson.build                   |   4 +
 hw/xwin/dri/meson.build          |  14 ++++
 hw/xwin/glx/meson.build          | 100 +++++++++++++++++++++++
 hw/xwin/meson.build              | 170 +++++++++++++++++++++++++++++++++++++++
 hw/xwin/winclipboard/meson.build |  31 +++++++
 include/meson.build              |  32 ++++++--
 include/xwin-config.h.meson.in   |  24 ++++++
 meson.build                      |  13 ++-
 meson_options.txt                |   5 ++
 9 files changed, 386 insertions(+), 7 deletions(-)
 create mode 100644 hw/xwin/dri/meson.build
 create mode 100644 hw/xwin/glx/meson.build
 create mode 100644 hw/xwin/meson.build
 create mode 100644 hw/xwin/winclipboard/meson.build
 create mode 100644 include/xwin-config.h.meson.in

diff --git a/hw/meson.build b/hw/meson.build
index c389a995b..c0d2db3f5 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -23,3 +23,7 @@ endif
 if build_xwayland
     subdir('xwayland')
 endif
+
+if build_xwin
+    subdir('xwin')
+endif
diff --git a/hw/xwin/dri/meson.build b/hw/xwin/dri/meson.build
new file mode 100644
index 000000000..0d8703c38
--- /dev/null
+++ b/hw/xwin/dri/meson.build
@@ -0,0 +1,14 @@
+srcs_windows_dri = [
+    'windowsdri.c',
+    'windowsdri.h',
+]
+
+xwin_windowsdri = static_library(
+    'WindowsDRI',
+    srcs_windows_dri,
+    include_directories: [ inc, include_directories('../') ],
+    dependencies: [
+        windowsdri_dep,
+        pixman_dep,
+    ],
+)
diff --git a/hw/xwin/glx/meson.build b/hw/xwin/glx/meson.build
new file mode 100644
index 000000000..77ffeda28
--- /dev/null
+++ b/hw/xwin/glx/meson.build
@@ -0,0 +1,100 @@
+python3 = import('python3')
+
+# XWin requires OpenGL spec files in order to generate wrapper code for native GL functions
+py3 = python3.find_python()
+if run_command(py3, '-c', 'import lxml;').returncode() != 0
+    error('python3 lxml module not found')
+endif
+
+khronos_spec_dir = dependency('khronos-opengl-registry').get_pkgconfig_variable('specdir')
+
+gen_gl_wrappers_opts= ['-nodebug']
+gen_gl_wrappers_cmd = ['env', 'PYTHONPATH=' + khronos_spec_dir, py3, files('./gen_gl_wrappers.py'), gen_gl_wrappers_opts]
+
+wgl_wrappers = custom_target(
+    'gen_wgl_wrappers',
+    command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-prefix', 'wgl', '-wrapper', '-preresolve', '-outfile', '@OUTPUT@'],
+    input: join_paths(khronos_spec_dir, 'wgl.xml'),
+    output: 'generated_wgl_wrappers.c',
+    depend_files: join_paths(khronos_spec_dir, 'reg.py'),
+)
+
+gl_shim = custom_target(
+    'gen_gl_shim',
+    command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-shim', '-outfile', '@OUTPUT@'],
+    input: join_paths(khronos_spec_dir, 'gl.xml'),
+    output: 'generated_gl_shim.c',
+    depend_files: join_paths(khronos_spec_dir, 'reg.py'),
+)
+
+gl_thunks = custom_target(
+    'gen_gl_thunks',
+    command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunk', '-outfile', '@OUTPUT@'],
+    input: join_paths(khronos_spec_dir, 'gl.xml'),
+    output: 'generated_gl_thunks.c',
+    depend_files: join_paths(khronos_spec_dir, 'reg.py'),
+)
+
+gl_thunks_def = custom_target(
+    'gen_gl_thunks_def',
+    command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunkdefs', '-outfile', '@OUTPUT@'],
+    input: join_paths(khronos_spec_dir, 'gl.xml'),
+    output: 'generated_gl_thunks.def',
+    depend_files: join_paths(khronos_spec_dir, 'reg.py'),
+)
+
+srcs_windows_glx = [
+    'winpriv.c',
+    'winpriv.h',
+    'glwindows.h',
+    'glshim.c',
+    'indirect.c',
+    'indirect.h',
+    'wgl_ext_api.c',
+    'wgl_ext_api.h',
+]
+
+if build_windowsdri
+    srcs_windows_glx += [
+        'dri_helpers.c',
+        'dri_helpers.h',
+    ]
+endif
+
+xwin_glx_c_args = []
+xwin_glx_c_args += '-DHAVE_XWIN_CONFIG_H'
+xwin_glx_c_args += '-DXWIN_MULTIWINDOW'
+xwin_glx_c_args += '-DXWIN_GLX_WINDOWS'
+
+xwin_glx = static_library(
+    'XwinGLX',
+    srcs_windows_glx,
+    include_directories: [
+        inc,
+        top_srcdir_inc,
+        include_directories('../'),
+    ],
+    dependencies: pixman_dep,
+    c_args: xwin_glx_c_args,
+)
+
+srcs_wgl_thunk = [
+    'glthunk.c',
+]
+
+WGLthunk = shared_library(
+    'nativeGLthunk',
+    srcs_wgl_thunk,
+    include_directories: [
+        inc,
+        top_srcdir_inc,
+    ],
+    c_args: xwin_glx_c_args + [
+      '-Wno-unused-function',
+      '-Wno-missing-prototypes',
+      '-Wno-missing-declarations',
+    ],
+    link_args: ['-lopengl32'],
+    vs_module_defs: gl_thunks_def,
+    install: true,
+)
diff --git a/hw/xwin/meson.build b/hw/xwin/meson.build
new file mode 100644
index 000000000..7e418206a
--- /dev/null
+++ b/hw/xwin/meson.build
@@ -0,0 +1,170 @@
+windows = import('windows')
+
+windowsdri_dep = dependency('windowsdriproto', required: false)
+
+build_windowsdri = windowsdri_dep.found()
+
+xwin_sys_libs = []
+xwin_sys_libs += '-ldxguid'
+
+if host_machine.system() == 'cygwin'
+    server_name = 'XWin'
+else
+    server_name = 'Xming'
+    xwin_sys_libs += ['-lpthread', '-lws2_32']
+endif
+
+xwin_c_args = []
+xwin_c_args += '-DHAVE_XWIN_CONFIG_H'
+xwin_c_args += '-Wno-bad-function-cast'
+# XXX: these conditionals are always on and can be removed
+xwin_c_args += '-DXWIN_CLIPBOARD'
+xwin_c_args += '-DXWIN_MULTIWINDOW'
+xwin_c_args += '-DXWIN_RANDR'
+
+srcs_windows = [
+    'winclipboardinit.c',
+    'winclipboardwrappers.c',
+]
+subdir('winclipboard')
+
+if build_glx
+    if build_windowsdri
+        xwin_c_args += '-DXWIN_WINDOWS_DRI'
+        subdir('dri')
+    endif
+    xwin_c_args += '-DXWIN_GLX_WINDOWS'
+    xwin_sys_libs += '-lopengl32'
+    subdir('glx')
+endif
+
+srcs_windows += [
+     'winmultiwindowshape.c',
+     'winmultiwindowwindow.c',
+     'winmultiwindowwm.c',
+     'winmultiwindowwndproc.c',
+     'propertystore.h',
+     'winSetAppUserModelID.c',
+]
+xwin_sys_libs += ['-lshlwapi', '-lole32']
+
+srcs_windows += [
+     'winrandr.c',
+]
+
+srcs_windows += [
+    'InitInput.c',
+    'InitOutput.c',
+    'winallpriv.c',
+    'winauth.c',
+    'winblock.c',
+    'wincmap.c',
+    'winconfig.c',
+    'wincreatewnd.c',
+    'wincursor.c',
+    'windialogs.c',
+    'winengine.c',
+    'winerror.c',
+    'winglobals.c',
+    'winkeybd.c',
+    'winkeyhook.c',
+    'winmisc.c',
+    'winmonitors.c',
+    'winmouse.c',
+    'winmsg.c',
+    'winmsgwindow.c',
+    'winmultiwindowclass.c',
+    'winmultiwindowicons.c',
+    'winos.c',
+    'winprefs.c',
+    'winprocarg.c',
+    'winscrinit.c',
+    'winshadddnl.c',
+    'winshadgdi.c',
+    'wintaskbar.c',
+    'wintrayicon.c',
+    'winvalargs.c',
+    'winwakeup.c',
+    'winwindow.c',
+    'winwndproc.c',
+    'ddraw.h',
+    'winconfig.h',
+    'win.h',
+    'winglobals.h',
+    'winkeybd.h',
+    'winkeynames.h',
+    'winlayouts.h',
+    'winmessages.h',
+    'winmonitors.h',
+    'winmsg.h',
+    'winms.h',
+    'winmultiwindowclass.h',
+    'winmultiwindowicons.h',
+    'winprefs.h',
+    'winresource.h',
+    'winwindow.h',
+    'windisplay.c',
+    'windisplay.h',
+    '../../mi/miinitext.c',
+]
+
+rsrc = windows.compile_resources('XWin.rc', include_directories: include_directories('../../include/'))
+srcs_windows += rsrc
+
+flex = find_program('flex')
+bison = find_program('bison')
+
+lgen = generator(
+    flex,
+    output : '@PLAINNAME at .yy.c',
+    arguments : ['-i', '-o', '@OUTPUT@', '@INPUT@']
+)
+
+lfiles = lgen.process('winprefslex.l')
+srcs_windows += lfiles
+
+pgen = generator(
+    bison,
+    output : ['@BASENAME at .c', '@BASENAME at .h'],
+    arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']
+)
+
+pfiles = pgen.process('winprefsyacc.y')
+srcs_windows += pfiles
+
+xwin_dep = [
+    common_dep,
+    dependency('x11-xcb'),
+    dependency('xcb-aux'),
+    dependency('xcb-image'),
+    dependency('xcb-ewmh'),
+    dependency('xcb-icccm'),
+]
+
+executable(
+    server_name,
+    srcs_windows,
+    include_directories: [inc, top_srcdir_inc],
+    dependencies: xwin_dep,
+    link_with: [
+        xwin_windowsdri,
+        xwin_glx,
+        xwin_clipboard,
+        libxserver_fb,
+        libxserver,
+        libxserver_glx,
+        libxserver_xkb_stubs,
+        libxserver_miext_shadow,
+        libxserver_pseudoramix,
+        libxserver_xi_stubs,
+    ],
+    link_args: ['-Wl,--disable-stdcall-fixup', '-Wl,--export-all-symbols'] +  xwin_sys_libs,
+    c_args: xwin_c_args,
+    gui_app: true,
+    install: true,
+)
+
+install_data(
+    'system.XWinrc',
+    install_dir: join_paths(get_option('sysconfdir'), 'X11')
+)
diff --git a/hw/xwin/winclipboard/meson.build b/hw/xwin/winclipboard/meson.build
new file mode 100644
index 000000000..1c784c384
--- /dev/null
+++ b/hw/xwin/winclipboard/meson.build
@@ -0,0 +1,31 @@
+srcs_windows_clipboard = [
+    'winclipboard.h',
+    'textconv.c',
+    'thread.c',
+    'wndproc.c',
+    'xevents.c',
+]
+
+xwin_clipboard = static_library(
+    'XWinclipboard',
+    srcs_windows_clipboard,
+    include_directories: inc,
+    c_args: '-DHAVE_XWIN_CONFIG_H',
+    dependencies: [
+        dependency('x11'),
+        dependency('xfixes'),
+    ],
+)
+
+srcs_xwinclip = [
+    'xwinclip.c',
+    'debug.c',
+]
+
+executable(
+    'xwinclip',
+    srcs_xwinclip,
+    link_with: xwin_clipboard,
+    link_args: ['-lgdi32', '-lpthread'],
+    install: true,
+)
diff --git a/include/meson.build b/include/meson.build
index 2f8882803..e94b29e0c 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -1,3 +1,10 @@
+version_split = meson.project_version().split('.')
+major = version_split[0].to_int()
+minor = version_split[1].to_int()
+patch = version_split[2].to_int()
+subpatch = version_split[3].to_int()
+
+release = major * 10000000 + minor * 100000 + patch * 1000 + subpatch
 
 dri_dep = dependency('dri', required: build_dri2 or build_dri3)
 
@@ -78,6 +85,7 @@ conf_data.set_quoted('PROJECTROOT', get_option('prefix'))
 conf_data.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir')))
 
 # XXX: Stopped enumerating at COMPILEDEFAULTFONTPATH
+conf_data.set('XORG_VERSION_CURRENT', release)
 
 conf_data.set('HASXDMAUTH', get_option('xdm-auth-1'))
 
@@ -190,23 +198,20 @@ conf_data.set_quoted('XVENDORNAME', get_option('vendor_name'))
 conf_data.set_quoted('XVENDORNAMESHORT', get_option('vendor_name_short'))
 conf_data.set_quoted('__VENDORDWEBSUPPORT__', get_option('vendor_web'))
 conf_data.set_quoted('OSVENDOR', get_option('os_vendor'))
+conf_data.set_quoted('BUILDERADDR', get_option('builder_addr'))
+conf_data.set_quoted('BUILDERSTRING', get_option('builder_string'))
 
 configure_file(output : 'dix-config.h',
                configuration : conf_data)
 
-version_split = meson.project_version().split('.')
-major = version_split[0].to_int()
-minor = version_split[1].to_int()
-patch = version_split[2].to_int()
-subpatch = version_split[3].to_int()
 
-release = major * 10000000 + minor * 100000 + patch * 1000 + subpatch
 
 version_data = configuration_data()
 version_data.set('VENDOR_RELEASE', '@0@'.format(release))
 version_data.set_quoted('VENDOR_NAME', get_option('vendor_name'))
 version_data.set_quoted('VENDOR_NAME_SHORT', get_option('vendor_name_short'))
 version_data.set_quoted('VENDOR_WEB', get_option('vendor_web'))
+version_data.set_quoted('VENDOR_MAN_VERSION', 'Version @0 at .@1 at .@2@'.format(major, minor, patch))
 configure_file(output : 'version-config.h',
                configuration : version_data)
 
@@ -269,6 +274,21 @@ configure_file(output : 'xorg-config.h',
                input : 'xorg-config.h.meson.in',
                configuration : xorg_data)
 
+xwin_data = configuration_data()
+xwin_data.set_quoted('DEFAULT_LOGDIR', log_dir)
+xwin_data.set('HAS_WINSOCK', host_machine.system() == 'windows', description: 'Use Windows sockets')
+xwin_data.set('HAS_DEVWINDOWS', host_machine.system() == 'cygwin', description: 'Has /dev/windows for signaling new win32 messages')
+xwin_data.set('RELOCATE_PROJECTROOT', host_machine.system() == 'windows', description: 'Make paths relative to the xserver installation location')
+# XXX: these three are all the same as DEBUG so we should just change to that
+enable_debugging = (get_option('buildtype') == 'debug') or (get_option('buildtype') == 'debugoptimized')
+xwin_data.set10('CYGDEBUG', enable_debugging)
+xwin_data.set10('CYGWINDOWING_DEBUG',enable_debugging)
+xwin_data.set10('CYGMULTIWINDOW_DEBUG', enable_debugging)
+
+configure_file(output : 'xwin-config.h',
+               input : 'xwin-config.h.meson.in',
+               configuration : xwin_data)
+
 if build_xorg
     install_data(
         [
diff --git a/include/xwin-config.h.meson.in b/include/xwin-config.h.meson.in
new file mode 100644
index 000000000..993227398
--- /dev/null
+++ b/include/xwin-config.h.meson.in
@@ -0,0 +1,24 @@
+/*
+ * xwin-config.h.in
+ *
+ * This file has all defines used in the xwin ddx
+ *
+ */
+#include <dix-config.h>
+
+/* Winsock networking */
+#mesondefine HAS_WINSOCK
+
+/* Cygwin has /dev/windows for signaling new win32 messages */
+#mesondefine HAS_DEVWINDOWS
+
+/* Switch on debug messages */
+#mesondefine CYGDEBUG
+#mesondefine CYGWINDOWING_DEBUG
+#mesondefine CYGMULTIWINDOW_DEBUG
+
+/* Default log location */
+#mesondefine DEFAULT_LOGDIR
+
+/* Whether we should re-locate the root to where the executable lives */
+#mesondefine RELOCATE_PROJECTROOT
diff --git a/meson.build b/meson.build
index dab3d4423..f0b1ef0a2 100644
--- a/meson.build
+++ b/meson.build
@@ -135,9 +135,18 @@ if (host_machine.system() != 'darwin' and
     endif
 endif
 
+build_xwin = false
+if get_option('xwin') == 'auto'
+    if (host_machine.system() == 'cygwin' or
+        host_machine.system() == 'windows')
+            build_xwin = true
+    endif
+else
+    build_xwin = get_option('xwin') == 'yes'
+endif
+
 # XXX: Finish these.
 build_xquartz = false
-build_xwin = false
 
 if get_option('ipv6') == 'auto'
     build_ipv6 = cc.has_function('getaddrinfo')
@@ -331,6 +340,8 @@ inc = include_directories(
 
 glx_inc = include_directories('glx')
 
+top_srcdir_inc = include_directories('.')
+
 serverconfigdir = join_paths(get_option('libdir'), '/xorg')
 
 # Include must come first, as it sets up dix-config.h
diff --git a/meson_options.txt b/meson_options.txt
index 88423e25e..56d5afa19 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -10,6 +10,11 @@ option('xnest', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto',
        description: 'Enable Xnest nested X server')
 option('dmx', type: 'boolean', value: false,
        description: 'Enable DMX nested X server')
+option('xwin', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto',
+       description: 'Enable XWin X server')
+
+option('builder_addr', type: 'string', description: 'Builder address', value: 'xorg at lists.freedesktop.org')
+option('builder_string', type: 'string', description: 'Additional builder string')
 
 option('log_dir', type: 'string')
 option('module_dir', type: 'string',
-- 
2.12.3



More information about the xorg-devel mailing list