meson: Convert xquartz from autotools

Differences from autotools:

* Autotools defined NO_ALLOCA for OSX builds.  I don't think we need
this anymore as Xalloc.h is no longer used anywhere in the xserver.

* X11.bin is linked with -u,miDCInitialize, and then libserver_mi
provided to satisfy (just) that.  It's been that way since the commit
which added it.  We can't write the equivalent in meson due to linker
argument ordering issues, but do we really need to?

* An explicit -Dsecure-rpc=false is required for OSX, since in meson we
don't do the checks that XTRANS_SECURE_RPC_FLAGS did for the existence
of the specific RPC functions required.
This commit is contained in:
Jon Turney 2019-04-18 17:06:41 +01:00 committed by Adam Jackson
parent e5f4c7c80b
commit 655b1eb32e
11 changed files with 305 additions and 29 deletions

View File

@ -0,0 +1,5 @@
libcglcore = static_library('CGLCore',
['indirect.c', 'capabilities.c', 'visualConfigs.c'],
include_directories: [inc, glx_inc, '..', '../xpr'],
dependencies: [xproto_dep, pixman_dep],
)

View File

@ -0,0 +1,7 @@
#!/bin/sh
BUNDLE_ROOT=$1
if [[ $(id -u) == 0 ]] ; then
chown -R root:admin ${BUNDLE_ROOT}
fi

View File

@ -0,0 +1,65 @@
# system-wide Xquartz server defaults file
install_data('Xquartz.plist',
install_dir: join_paths(get_option('libdir'), 'X11/xserver'))
# generate Info.plist
cpp = find_program('cpp')
cpp_defs = [
'-DAPPLE_APPLICATION_NAME=@0@'.format(apple_application_name),
'-DBUNDLE_ID_PREFIX=@0@'.format(bundle_id_prefix),
'-DBUNDLE_VERSION=@0@'.format(bundle_version),
'-DBUNDLE_VERSION_STRING=@0@'.format(bundle_version_string),
]
if build_sparkle
cpp_defs += [
'-DXQUARTZ_SPARKLE',
'-DXQUARTZ_SPARKLE_FEED_URL=@0@'.format(xquartz_sparkle_feed_url),
]
endif
# bundle data
localities = [
'Dutch', 'English', 'French', 'German', 'Italian', 'Japanese', 'Spanish',
'ar','ca','cs','da','el','fi','he','hr','hu','ko','no','pl','pt','pt_PT',
'ro','ru','sk','sv','th','tr','uk','zh_CN','zh_TW'
]
foreach lang : localities
install_data(join_paths('Resources', lang + '.lproj', 'Localizable.strings'),
install_dir: join_paths(bundle_root, 'Contents/Resources', lang + '.lproj'),
install_mode: 'rw-r--r--')
install_data(join_paths('Resources', lang + '.lproj', 'main.nib/keyedobjects.nib'),
install_dir: join_paths(bundle_root, 'Contents/Resources', lang + '.lproj', 'main.nib'),
install_mode: 'rw-r--r--')
endforeach
install_data('Resources/English.lproj/main.nib/designable.nib',
install_dir: join_paths(bundle_root, 'Contents/Resources/English.lproj/main.nib'),
install_mode: 'rw-r--r--')
install_data('Resources/X11.icns',
install_dir: join_paths(bundle_root, 'Contents/Resources'),
install_mode: 'rw-r--r--')
custom_target('Info.plist',
command: [cpp, '-P', cpp_defs, '@INPUT@'],
capture: true,
input: 'Info.plist.cpp',
output: 'Info.plist',
install: true,
install_dir: join_paths(bundle_root, 'Contents'),
install_mode: 'rw-r--r--',
build_by_default: true,
)
install_data('PkgInfo',
install_dir: join_paths(bundle_root, 'Contents'),
install_mode: 'rw-r--r--')
install_data('X11.sh',
rename: 'X11',
install_dir: join_paths(bundle_root, 'Contents/MacOS'),
install_mode: 'rwxr-xr-x')
meson.add_install_script('chown-bundle.sh', bundle_root)

View File

@ -0,0 +1,92 @@
# mach interface
mig = find_program('mig')
mach_startup = custom_target('mach_startup',
command: [mig,
'-sheader', '@OUTPUT0@', '-header', '@OUTPUT2@',
'-server', '@OUTPUT1@', '-user', '@OUTPUT3@',
'@INPUT@'],
input: 'mach_startup.defs',
output: ['mach_startupServer.h',
'mach_startupServer.c',
'mach_startup.h',
'mach_startupUser.c'],
)
mach_startup_dep = declare_dependency(
sources: mach_startup[2] # mach_startup.h
)
# common defines
xquartz_defs = [
bundle_id_def,
'-DXSERVER_VERSION="@0@"'.format(meson.project_version()),
'-DX11BINDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('bindir'))),
]
# X11.bin
x11appdir = join_paths(bundle_root, 'Contents/MacOS')
x11_bin_deps = [
meson.get_compiler('c').find_library('Xplugin'),
dependency('Carbon', method: 'extraframework'),
cocoa,
dependency('CoreAudio', method: 'extraframework'),
dependency('IOKit', method: 'extraframework')
]
if build_glx
x11_bin_deps += [dependency('OpenGL', method: 'extraframework')]
endif
if build_sparkle
x11_bin_deps += sparkle
endif
x11_bin_libs = [
libXquartz,
libXquartzXpr,
libxpbproxy,
libxserver_fb,
libxserver,
libxserver_xkb_stubs,
]
if build_glx
x11_bin_libs += [libcglcore, libxserver_glx, libglxvnd]
endif
x11_bin = executable('X11.bin',
[
'bundle-main.c',
# strndup(3) was added in Mac OS X 10.7 (Lion), but we do this
# unconditionally to deal with the case where we build on 10.7 or later,
# but target 10.6 (Snow Leopard) or earlier as the minimum OS version.
'../../../os/strndup.c',
mach_startup[1], # mach_startupServer.c
mach_startup[3], # mach_startupUser.c
],
link_with: x11_bin_libs,
dependencies: [xproto_dep, x11_bin_deps, mach_startup_dep],
include_directories: [inc, '..', top_dir_inc],
c_args: xquartz_defs,
link_args: ['-Objc'],
install: true,
install_dir: x11appdir,
)
# Xquartz
xquartz_deps = [
dependency('CoreServices', method: 'extraframework'),
]
xquartz = executable('Xquartz',
[
'stub.c',
'launchd_fd.c',
mach_startup[3], # mach_startupUser.c
],
include_directories: inc,
c_args: xquartz_defs,
dependencies: [xquartz_deps, mach_startup_dep],
install: true,
)

View File

@ -1,6 +1,25 @@
add_languages('objc')
srcs = [
apple_applications_dir = get_option('apple-applications-dir')
apple_application_name = get_option('apple-application-name')
bundle_id_prefix = get_option('bundle-id-prefix')
xquartz_sparkle_feed_url = get_option('sparkle-feed-url')
bundle_version_string = meson.project_version() # CFBundleShortVersionString
bundle_version = release # CFBundleVersion
bundle_id_def = '-DBUNDLE_ID_PREFIX="@0@"'.format(bundle_id_prefix)
bundle_root = join_paths(apple_applications_dir, apple_application_name + '.app')
# using sparkle update framework?
build_sparkle = xquartz_sparkle_feed_url != ''
if build_sparkle
sparkle = dependency('Sparkle', method: 'extraframework')
endif
# libxquartz
srcs_libxquartz = [
'X11Application.m',
'X11Controller.m',
'applewm.c',
@ -17,30 +36,42 @@ srcs = [
'../../mi/miinitext.c',
]
xquartz_c_args = [
'-DXFree86Server',
# XXXX: BUILD_DATE
'-DXSERVER_VERSION="' + meson_project.version() + '"',
libxquartz_defs = [
'-DINXQUARTZ',
'-DUSE_NEW_CLUT',
'-DX11LIBDIR="@0@"'.format(join_paths(get_option('prefix'),
get_option('libdir'))),
'-DXFree86Server',
'-DXQUARTZ',
'-DXSERVER_VERSION="@0@"'.format(meson.project_version()),
bundle_id_def,
]
if cc.has_function('dispatch_async')
xquartz_c_args += '-DHAVE_LIBDISPATCH'
libxquartz_defs += '-DHAVE_LIBDISPATCH'
endif
executable(
'Xquartz',
srcs,
include_directories: inc,
link_with: [
libxserver_main,
libxserver,
libxserver_xkb_stubs,
libxserver_xi_stubs,
libxserver_glx,
libxserver_pseudoramix,
],
c_args: xquartz_c_args,
install: true,
libXquartz = static_library('Xquartz',
srcs_libxquartz,
c_args: libxquartz_defs,
objc_args: libxquartz_defs,
include_directories: [inc, '../../pseudoramiX', '../../miext/rootless', top_dir_inc],
dependencies: [xproto_dep, pixman_dep],
link_with: [libxserver_pseudoramix, libxserver_miext_rootless],
)
subdir('bundle')
if build_glx
subdir('GL')
endif
subdir('pbproxy')
subdir('xpr')
subdir('mach-startup')
# manpage
xquartz_man = configure_file(
input: 'man/Xquartz.man',
output: 'Xquartz.1',
configuration: manpage_config,
)
install_man(xquartz_man)

View File

@ -0,0 +1,29 @@
build_standalone_pbproxy = get_option('xpbproxy')
pbproxy_defs = [bundle_id_def]
if build_standalone_pbproxy
pbproxy_defs += ['-DSTANDALONE_XPBPROXY']
endif
libapplewm_dep = dependency('applewm', version: '>=1.4')
libxpbproxy = static_library('xpbproxy',
['main.m',
'x-input.m',
'x-selection.m'],
dependencies: [applewmproto_dep, libapplewm_dep, dependency('xfixes'), dependency('x11')],
objc_args: pbproxy_defs,
)
cocoa = dependency('Cocoa', method: 'extraframework')
# standalone xpbproxy
if build_standalone_pbproxy
executable('xpbproxy',
'app-main.m',
link_with: libxpbproxy,
dependencies: [cocoa, dependency('x11')],
objc_args: pbproxy_defs,
install: true,
)
endif

View File

@ -0,0 +1,18 @@
libXquartzXpr = static_library('XquartzXpr',
[
'appledri.c',
'dri.c',
'driWrap.c',
'xprAppleWM.c',
'xprCursor.c',
'xprEvent.c',
'xprFrame.c',
'xprScreen.c',
'x-hash.c',
'x-hook.c',
'x-list.c',
],
include_directories: [inc, '..', '../../../pseudoramiX', '../../../miext/rootless'],
c_args: [bundle_id_def, '-DXQUARTZ'],
dependencies: [xproto_dep, pixman_dep],
)

View File

@ -52,8 +52,6 @@ conf_data.set('_GNU_SOURCE', '1')
# ifdef for openbsd?
conf_data.set('HAS_APERTURE_DRV', host_machine.system() == 'openbsd')
# XXX: BUNDLE_ID_PREFIX
if get_option('input_thread') == 'false'
enable_input_thread = false
else
@ -289,6 +287,10 @@ if host_machine.system() == 'openbsd'
csrg_based = true
endif
if host_machine.system() == 'darwin'
csrg_based = true
endif
conf_data.set('SVR4', cc.compiles(defines_svr4))
conf_data.set_quoted('XKB_DFLT_RULES', get_option('xkb_default_rules'))
conf_data.set('XORGSERVER', build_xorg)

View File

@ -6,7 +6,7 @@ project('xserver', 'c',
version: '1.20.99.1',
meson_version: '>= 0.46.0',
)
add_project_arguments('-DHAVE_DIX_CONFIG_H', language: 'c')
add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc'])
cc = meson.get_compiler('c')
add_global_arguments('-fno-strict-aliasing', language : 'c')
@ -56,7 +56,7 @@ foreach wflag: test_wflags
endif
endforeach
add_global_arguments(common_wflags, language : 'c')
add_global_arguments(common_wflags, language : ['c', 'objc'])
xproto_dep = dependency('xproto', version: '>= 7.0.31')
randrproto_dep = dependency('randrproto', version: '>= 1.6.0')
@ -133,14 +133,21 @@ dfp = get_option('default_font_path')
if dfp == ''
fontutil_dep = dependency('fontutil')
fontrootdir = fontutil_dep.get_pkgconfig_variable('fontrootdir')
default_font_path = ','.join([
dfp_elements = [
join_paths(fontrootdir, 'misc'),
join_paths(fontrootdir, 'TTF'),
join_paths(fontrootdir, 'OTF'),
join_paths(fontrootdir, 'Type1'),
join_paths(fontrootdir, '100dpi'),
join_paths(fontrootdir, '75dpi'),
])
]
if host_machine.system() == 'darwin'
dfp_elements += [
'/Library/Fonts',
'/System/Library/Fonts',
]
endif
default_font_path = ','.join(dfp_elements)
else
default_font_path = dfp
endif
@ -149,7 +156,7 @@ hal_option = get_option('hal')
glamor_option = get_option('glamor')
build_udev = get_option('udev')
if host_machine.system() == 'windows'
if host_machine.system() == 'windows' or host_machine.system() == 'darwin'
build_udev = false
hal_option = 'false'
endif
@ -227,8 +234,14 @@ else
build_xwin = get_option('xwin') == 'true'
endif
# XXX: Finish these.
build_xquartz = false
if get_option('xquartz') == 'auto'
if host_machine.system() == 'darwin'
build_xquartz = true
endif
else
build_xquartz = get_option('xquartz') == 'true'
endif
build_rootless = false
if build_xquartz

View File

@ -16,6 +16,9 @@ option('xvfb', type: 'boolean', value: true,
description: 'Enable Xvfb X server')
option('xwin', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
description: 'Enable XWin X server')
option('xquartz', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
description: 'Enable Xquartz X server')
option('builder_addr', type: 'string', description: 'Builder address', value: 'xorg@lists.freedesktop.org')
option('builder_string', type: 'string', description: 'Additional builder string')
@ -104,3 +107,14 @@ option('agp', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
option('dri1', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Build DRI1 extension (default: auto)')
option('dri2', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Build DRI2 extension (default: auto)')
option('dri3', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Build DRI3 extension (default: auto)')
option('apple-applications-dir', type: 'string', value: '/Applications/Utilities',
description: 'Applications directory')
option('apple-application-name', type: 'string', value: 'X11',
description: 'Application name')
option('bundle-id-prefix', type: 'string', value: 'org.x',
description: 'RDNS prefix for bundle identifier')
option('sparkle-feed-url', type: 'string',
description: 'Feed URL for autoupdating with the Sparkle Framework (default: disabled)')
option('xpbproxy', type: 'boolean', value: false,
description: 'Build a standalone X pasteboard proxy')

View File

@ -62,7 +62,7 @@ if get_option('secure-rpc')
if not (rpc_dep.found() or cc.has_header('rpc/rpc.h'))
error('secure-rpc requested, but neither libtirpc or libc RPC support were found')
endif
# XXX: also check if RPC library provides xdr_opaque_auth, authdes_(sec)create ???
srcs_os += 'rpcauth.c'
endif