From 663f05444a21577541320eea05fbc92c7fcf3425 Mon Sep 17 00:00:00 2001 From: kohnish Date: Sun, 16 Nov 2025 13:45:09 +0100 Subject: [PATCH] Meson support for Xvnc for xserver master branch with a patch --- unix/xserver/hw/vnc/meson.build | 117 +++++++++++++++++++++++++++++ unix/xserver/hw/vnc/xorg-version.h | 10 ++- unix/xservermain.patch | 40 ++++++++++ 3 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 unix/xserver/hw/vnc/meson.build create mode 100644 unix/xservermain.patch diff --git a/unix/xserver/hw/vnc/meson.build b/unix/xserver/hw/vnc/meson.build new file mode 100644 index 0000000000..1e6da1b70d --- /dev/null +++ b/unix/xserver/hw/vnc/meson.build @@ -0,0 +1,117 @@ +tigervnc_builddir = get_option('tigervnc_builddir') +cpp = meson.get_compiler('cpp') + +vnccommon_deps = [ + declare_dependency( + dependencies: cpp.find_library('core', dirs: join_paths(tigervnc_builddir, 'common/core'))), + declare_dependency( + dependencies: cpp.find_library('rfb', dirs: join_paths(tigervnc_builddir, 'common/rfb'))), + declare_dependency( + dependencies: cpp.find_library('rdr', dirs: join_paths(tigervnc_builddir, 'common/rdr'))), + declare_dependency( + dependencies: cpp.find_library('network', dirs: join_paths(tigervnc_builddir, 'common/network'))), + declare_dependency( + dependencies: cpp.find_library('unixcommon', dirs: join_paths(tigervnc_builddir, 'unix/common'))), + dependency('zlib'), + dependency('pam'), + dependency('gnutls'), + dependency('nettle'), + dependency('hogweed'), + dependency('gmp'), + dependency('libjpeg'), +] + +srcs_vnccommon = [ + 'vncPresent.c', + 'xvnc.c', + 'vncDRI3.c', + 'vncDRI3Draw.c', + 'qnum_to_xorgevdev.c', + 'qnum_to_xorgkbd.c', + 'RandrGlue.c', + 'RFBGlue.cc', + 'RFBGlue.h', + 'vncBlockHandler.c', + 'vncBlockHandler.h', + 'vncExt.c', + 'vncExtInit.cc', + 'vncHooks.c', + 'vncInput.c', + 'vncInput.h', + 'vncInputXKB.c', + 'vncSelection.c', + 'vncSelection.h', + 'xorg-version.h', + 'XorgGlue.c', + 'XorgGlue.h', + 'XserverDesktop.cc', + 'XserverDesktop.h', +] + +vnccommon_inc = include_directories( + '../../../../common', + '../../../common', + '../../../vncconfig', +) + +libvnccommon = static_library( + 'vnccommon', + srcs_vnccommon, + include_directories : [inc, vnccommon_inc], + dependencies: [common_dep, vnccommon_deps], + install: false, +) + +srcs_xvnc = [ + 'xvnc.c', + 'buildtime.c', + '../../fb/fbcmap_mi.c', + '../../mi/miinitext.c', + '../../Xi/stubs.c', +] + +xvnc_inc = include_directories( + '../../../../common', + '../../../common', +) + +xvnc = executable( + 'Xvnc', + srcs_xvnc, + include_directories : [inc, xvnc_inc], + dependencies: common_dep, + c_args: ['-DTIGERVNC', '-DNO_MODULE_EXTS'], + link_with: [ + libxserver, + libxserver_fb, + libxserver_main, + libxserver_glx, + libglxvnd, + libxserver_xi_stubs, + libxserver_xkb_stubs, + libvnccommon, + ], + install: true, +) + +libvnc_inc = include_directories( + '../xfree86/common', + '../xfree86/os-support', + '../xfree86/os-support/bus' +) + +libvnc = shared_module( + 'vnc', + 'vncModule.c', + include_directories : [inc, xvnc_inc, libvnc_inc], + dependencies: common_dep, + link_with: libvnccommon, + install: true, + install_dir: join_paths(module_dir, 'extensions') +) + +install_man(configure_file( + input: 'Xvnc.man', + output: 'Xvnc.1', + configuration: manpage_config, +)) diff --git a/unix/xserver/hw/vnc/xorg-version.h b/unix/xserver/hw/vnc/xorg-version.h index de39cfe770..eb72f056b1 100644 --- a/unix/xserver/hw/vnc/xorg-version.h +++ b/unix/xserver/hw/vnc/xorg-version.h @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, @@ -26,7 +26,7 @@ #include -#define XORG_AT_LEAST(major, minor, patch) \ +#define XORG_AT_LEAST(major, minor, patch) \ (VENDOR_RELEASE >= ((major * 10000000) + (minor * 100000) + (patch * 1000))) #define XORG_OLDER_THAN(major, minor, patch) \ (VENDOR_RELEASE < ((major * 10000000) + (minor * 100000) + (patch * 1000))) @@ -35,7 +35,9 @@ #error "X.Org older than 1.20 is not supported" #endif -#if XORG_AT_LEAST(1, 22, 0) +#if XORG_AT_LEAST(1, 25, 0) +#warning "Xserver master branch detected, compilation may fail" +#elif XORG_AT_LEAST(1, 22, 0) #error "X.Org newer than 1.21 is not supported" #endif diff --git a/unix/xservermain.patch b/unix/xservermain.patch new file mode 100644 index 0000000000..8564117398 --- /dev/null +++ b/unix/xservermain.patch @@ -0,0 +1,40 @@ +diff --git a/hw/meson.build b/hw/meson.build +index f9605a5b7..359b622dd 100644 +--- a/hw/meson.build ++++ b/hw/meson.build +@@ -1,3 +1,7 @@ ++if get_option('tigervnc_builddir') != '' ++ subdir('vnc') ++endif ++ + if build_xephyr + subdir('kdrive') + endif +diff --git a/meson.build b/meson.build +index 1556491eb..680d23e51 100644 +--- a/meson.build ++++ b/meson.build +@@ -1,4 +1,4 @@ +-project('xserver', 'c', ++project('xserver', ['c', 'cpp'], + default_options: [ + 'buildtype=debugoptimized', + 'c_std=gnu99', +@@ -8,7 +8,7 @@ project('xserver', 'c', + ) + release_date = '2021-07-05' + +-add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc']) ++add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc', 'cpp']) + cc = meson.get_compiler('c') + + add_project_arguments('-fno-strict-aliasing', language : 'c') +diff --git a/meson_options.txt b/meson_options.txt +index 94698f218..616686299 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -1,3 +1,4 @@ ++option('tigervnc_builddir', type: 'string', description: 'tigervncbuild dir', value: '') + option('xorg', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', + description: 'Enable Xorg X Server') + option('xephyr', type: 'boolean', value: false,