From 200c43e16d892c092f14490383b99ffd34c29d17 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 30 May 2025 01:27:02 +0800 Subject: [PATCH 3/9] Fixes to meson.build files --- hw/xquartz/GL/meson.build | 2 +- hw/xquartz/bundle/meson.build | 2 -- hw/xquartz/mach-startup/meson.build | 41 +++++++++++++++++++++++++---- hw/xquartz/meson.build | 5 ++-- hw/xquartz/pbproxy/meson.build | 11 +++++--- hw/xquartz/xpr/meson.build | 2 +- 6 files changed, 49 insertions(+), 14 deletions(-) diff --git a/hw/xquartz/GL/meson.build b/hw/xquartz/GL/meson.build index 556417525..b4c176a05 100644 --- a/hw/xquartz/GL/meson.build +++ b/hw/xquartz/GL/meson.build @@ -1,5 +1,5 @@ libcglcore = static_library('CGLCore', ['indirect.c', 'capabilities.c', 'visualConfigs.c'], - include_directories: [inc, glx_inc, '..', '../xpr'], + include_directories: [inc, glx_inc, '..', '../xpr', '../../../miext/damage'], dependencies: [xproto_dep, pixman_dep], ) diff --git a/hw/xquartz/bundle/meson.build b/hw/xquartz/bundle/meson.build index 22941203b..29d0e5fce 100644 --- a/hw/xquartz/bundle/meson.build +++ b/hw/xquartz/bundle/meson.build @@ -55,5 +55,3 @@ install_data('PkgInfo', install_data('X11.sh', install_dir: join_paths(bundle_root, 'Contents/MacOS'), install_mode: 'rwxr-xr-x') - -meson.add_install_script('chown-bundle.sh', bundle_root) diff --git a/hw/xquartz/mach-startup/meson.build b/hw/xquartz/mach-startup/meson.build index 2f7694252..edb43e52e 100644 --- a/hw/xquartz/mach-startup/meson.build +++ b/hw/xquartz/mach-startup/meson.build @@ -28,14 +28,32 @@ x11appdir = join_paths(bundle_root, 'Contents/MacOS') x11_bin_deps = [ meson.get_compiler('c').find_library('Xplugin'), +] + +# Meson is a broken build system. It cannot find frameworks with gcc. +if cc.get_id() == 'clang' + x11_bin_deps += [ dependency('Carbon', method: 'extraframework'), cocoa, dependency('CoreAudio', method: 'extraframework'), dependency('IOKit', method: 'extraframework') -] + ] + binlinkargs = ['-Objc'] +else + binlinkargs = [ + '-framework', 'Carbon', + '-framework', 'Cocoa', + '-framework', 'CoreAudio', + '-framework', 'IOKit' + ] +endif if build_glx + if cc.get_id() == 'clang' x11_bin_deps += [dependency('OpenGL', method: 'extraframework')] + else + binlinkargs += ['-framework', 'OpenGL'] + endif endif if build_sparkle @@ -65,26 +83,38 @@ x11_bin = executable('X11.bin', dependencies: [xproto_dep, x11_bin_deps, mach_startup_dep], include_directories: [inc, '..', top_dir_inc], c_args: xquartz_defs, - link_args: ['-Objc'], + link_args: binlinkargs, install: true, install_dir: x11appdir, ) +if cc.get_id() == 'clang' + execlinkargs = ['-Objc'] +else + execlinkargs = [] +endif + # X11 (Bundle trampoline) x11 = executable('X11', [ 'bundle_trampoline.c', ], c_args: xquartz_defs, - link_args: ['-Objc'], + link_args: execlinkargs, install: true, install_dir: x11appdir, ) # Xquartz -xquartz_deps = [ +if cc.get_id() == 'clang' + xquartz_deps = [ dependency('CoreServices', method: 'extraframework'), -] + ] + xquartz_linkargs = [] +else + xquartz_deps = [] + xquartz_linkargs = ['-framework', 'CoreServices'] +endif xquartz = executable('Xquartz', [ @@ -94,6 +124,7 @@ xquartz = executable('Xquartz', ], include_directories: inc, c_args: xquartz_defs, + link_args: xquartz_linkargs, dependencies: [xquartz_deps, mach_startup_dep], install: true, ) diff --git a/hw/xquartz/meson.build b/hw/xquartz/meson.build index 83e79eae8..d269a6403 100644 --- a/hw/xquartz/meson.build +++ b/hw/xquartz/meson.build @@ -41,7 +41,6 @@ endif # libxquartz srcs_libxquartz = [ - 'NSUserDefaults+XQuartzDefaults.m', 'X11Application.m', 'X11Controller.m', 'applewm.c', @@ -50,11 +49,12 @@ srcs_libxquartz = [ 'darwinXinput.c', 'keysym2ucs.c', 'quartz.c', + 'quartzCocoa.m', 'quartzKeyboard.c', 'quartzStartup.c', 'quartzRandR.c', + 'console_redirect.c', '../../mi/miinitext.c', - '../../mi/miinitext.h', ] libxquartz_defs = [ @@ -63,6 +63,7 @@ libxquartz_defs = [ '-DXQUARTZ', '-DXQUARTZ_DATA_DIR="@0@"'.format(xquartz_data_dir), '-DXSERVER_VERSION="@0@"'.format(meson.project_version()), + '-DX11LIBDIR="@0@"'.format(libdir), bundle_id_def, sparkle_defs, ] diff --git a/hw/xquartz/pbproxy/meson.build b/hw/xquartz/pbproxy/meson.build index 206cbdca3..ffdfbcac7 100644 --- a/hw/xquartz/pbproxy/meson.build +++ b/hw/xquartz/pbproxy/meson.build @@ -11,8 +11,7 @@ endif libapplewm_dep = dependency('applewm', version: '>=1.4') libxpbproxy = static_library('xpbproxy', - ['../NSUserDefaults+XQuartzDefaults.m', - 'main.m', + ['main.m', 'x-input.m', 'x-selection.m'], include_directories: ['..'], @@ -20,13 +19,19 @@ libxpbproxy = static_library('xpbproxy', objc_args: pbproxy_defs, ) -cocoa = dependency('Cocoa', method: 'extraframework') +if cc.get_id() == 'clang' + cocoa = dependency('Cocoa', method: 'extraframework') + xpbproxy_linkargs = [] +else + xpbproxy_linkargs = ['-framework Cocoa'] +endif # standalone xpbproxy if build_standalone_pbproxy executable('xpbproxy', 'app-main.m', link_with: libxpbproxy, + link_args: xpbproxy_linkargs, dependencies: [cocoa, dependency('x11')], objc_args: pbproxy_defs, install: true, diff --git a/hw/xquartz/xpr/meson.build b/hw/xquartz/xpr/meson.build index 590727f47..6b39f6923 100644 --- a/hw/xquartz/xpr/meson.build +++ b/hw/xquartz/xpr/meson.build @@ -12,7 +12,7 @@ libXquartzXpr = static_library('XquartzXpr', 'x-hook.c', 'x-list.c', ], - include_directories: [inc, '..', '../../../pseudoramiX', '../../../miext/rootless'], + include_directories: [inc, '..', '../../../pseudoramiX', '../../../miext', '../../../miext/rootless'], c_args: [bundle_id_def, '-DXQUARTZ'], dependencies: [xproto_dep, pixman_dep], ) -- 2.24.3 (Apple Git-128)