meson.build 20.9 KB
Newer Older
1
project('xserver', 'c',
Adam Jackson's avatar
Adam Jackson committed
2 3 4 5
        default_options: [
            'buildtype=debugoptimized',
            'c_std=gnu99',
        ],
Adam Jackson's avatar
Adam Jackson committed
6
        version: '1.20.99.1',
7
        meson_version: '>= 0.46.0',
8
)
9
add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc'])
10 11 12 13 14 15 16
cc = meson.get_compiler('c')

add_global_arguments('-fno-strict-aliasing', language : 'c')
add_global_arguments('-fvisibility=hidden', language : 'c')

add_global_link_arguments('-fvisibility=hidden', language : 'c')

17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
    test_wflags = [
        '-Wall',
        '-Wpointer-arith',
        '-Wmissing-declarations',
        '-Wformat=2',
        '-Wstrict-prototypes',
        '-Wmissing-prototypes',
        '-Wnested-externs',
        '-Wbad-function-cast',
        '-Wold-style-definition',
        '-Wunused',
        '-Wuninitialized',
        '-Wshadow',
        '-Wmissing-noreturn',
        '-Wmissing-format-attribute',
        '-Wredundant-decls',
        '-Werror=implicit',
        '-Werror=nonnull',
        '-Werror=init-self',
        '-Werror=main',
        '-Werror=missing-braces',
        '-Werror=sequence-point',
        '-Werror=return-type',
        '-Werror=trigraphs',
        '-Werror=array-bounds',
        '-Werror=write-strings',
        '-Werror=address',
        '-Werror=int-to-pointer-cast',
        '-Werror=pointer-to-int-cast',
    ]
else
    test_wflags = []
endif

common_wflags = []
foreach wflag: test_wflags
    if cc.has_argument(wflag)
        common_wflags += [ wflag ]
    endif
endforeach

59
add_global_arguments(common_wflags, language : ['c', 'objc'])
60 61

xproto_dep = dependency('xproto', version: '>= 7.0.31')
62
randrproto_dep = dependency('randrproto', version: '>= 1.6.0')
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
renderproto_dep = dependency('renderproto', version: '>= 0.11')
xextproto_dep = dependency('xextproto', version: '>= 7.2.99.901')
inputproto_dep = dependency('inputproto', version: '>= 2.3')
kbproto_dep = dependency('kbproto', version: '>= 1.0.3')
fontsproto_dep = dependency('fontsproto', version: '>= 2.1.3')
fixesproto_dep = dependency('fixesproto', version: '>= 5.0')
damageproto_dep = dependency('damageproto', version: '>= 1.1')
xcmiscproto_dep = dependency('xcmiscproto', version: '>= 1.2.0')
bigreqsproto_dep = dependency('bigreqsproto', version: '>= 1.1.0')
xtrans_dep = dependency('xtrans', version: '>= 1.3.5')

videoproto_dep = dependency('videoproto')
compositeproto_dep = dependency('compositeproto', version: '>= 0.4')
recordproto_dep = dependency('recordproto', version: '>= 1.13.99.1')
scrnsaverproto_dep = dependency('scrnsaverproto', version: '>= 1.1')
resourceproto_dep = dependency('resourceproto', version: '>= 1.2.0')
79 80
xf86driproto_dep = dependency('xf86driproto', version: '>= 2.1.0', required: get_option('dri1') == 'true')
dri2proto_dep = dependency('dri2proto', version: '>= 2.8', required: get_option('dri2') == 'true')
81
dri3proto_dep = dependency('dri3proto', version: '>= 1.2', required: get_option('dri3') == 'true')
82 83
xineramaproto_dep = dependency('xineramaproto')
xf86bigfontproto_dep = dependency('xf86bigfontproto', version: '>= 1.2.0')
84
xf86vidmodeproto_dep = dependency('xf86vidmodeproto', version: '>= 2.2.99.1')
85
applewmproto_dep = dependency('applewmproto', version: '>= 1.4', required: false)
86
xshmfence_dep = dependency('xshmfence', version: '>= 1.1', required: false)
87 88 89

pixman_dep = dependency('pixman-1')
libbsd_dep = dependency('libbsd', required: false)
90
xkbcomp_dep = dependency('xkbcomp', required: false)
91 92
xkbfile_dep = dependency('xkbfile')
xfont2_dep = dependency('xfont2', version: '>= 2.0')
93
nettle_dep = dependency('nettle')
94

95
dbus_required = get_option('systemd_logind') == 'true'
96 97
dbus_dep = dependency('dbus-1', version: '>= 1.0', required: dbus_required)

98 99 100 101 102 103
# libsystemd-daemon was moved into libsystemd in version 209
libsystemd_daemon_dep = dependency('libsystemd', version: '>= 209', required: false)
if not libsystemd_daemon_dep.found()
    libsystemd_daemon_dep = dependency('libsystemd-daemon', required: false)
endif

104 105
build_hashtable = false

106 107 108
# Resolve default values of some options
xkb_dir = get_option('xkb_dir')
if xkb_dir == ''
109 110 111
    if xkbcomp_dep.found() and xkbcomp_dep.type_name() == 'pkgconfig'
        xkb_dir = xkbcomp_dep.get_pkgconfig_variable('xkbconfigdir')
    endif
112 113 114
    if xkb_dir == ''
        xkb_dir = join_paths(get_option('prefix'), 'share/X11/xkb')
    endif
115 116 117 118
endif

xkb_output_dir = get_option('xkb_output_dir')
if xkb_output_dir == ''
119
    xkb_output_dir = join_paths(xkb_dir, 'compiled')
120 121
endif

122 123
xkb_bin_dir = get_option('xkb_bin_dir')
if xkb_bin_dir == ''
124 125 126
    if xkbcomp_dep.found() and xkbcomp_dep.type_name() == 'pkgconfig'
        xkb_bin_dir = xkbcomp_dep.get_pkgconfig_variable('bindir')
    endif
127 128 129
    if xkb_bin_dir == ''
        xkb_bin_dir = join_paths(get_option('prefix'), get_option('bindir'))
    endif
130 131
endif

132 133 134 135
dfp = get_option('default_font_path')
if dfp == ''
    fontutil_dep = dependency('fontutil')
    fontrootdir = fontutil_dep.get_pkgconfig_variable('fontrootdir')
136
    dfp_elements = [
137 138 139 140 141 142
        join_paths(fontrootdir, 'misc'),
        join_paths(fontrootdir, 'TTF'),
        join_paths(fontrootdir, 'OTF'),
        join_paths(fontrootdir, 'Type1'),
        join_paths(fontrootdir, '100dpi'),
        join_paths(fontrootdir, '75dpi'),
143 144 145 146 147 148 149 150
    ]
    if host_machine.system() == 'darwin'
       dfp_elements += [
       '/Library/Fonts',
       '/System/Library/Fonts',
    ]
    endif
    default_font_path = ','.join(dfp_elements)
151 152 153 154
else
    default_font_path = dfp
endif

155 156 157 158
hal_option = get_option('hal')
glamor_option = get_option('glamor')

build_udev = get_option('udev')
159
if host_machine.system() == 'windows' or host_machine.system() == 'darwin'
160
    build_udev = false
161
    hal_option = 'false'
162 163 164
endif

if get_option('systemd_logind') == 'auto'
Jon Turney's avatar
Jon Turney committed
165
    build_systemd_logind = build_udev and dbus_dep.found()
166
else
167
    build_systemd_logind = get_option('systemd_logind') == 'true'
168 169 170 171 172 173 174 175 176
endif

build_xorg = false
if (host_machine.system() != 'darwin' and
    host_machine.system() != 'windows')
    if get_option('xorg') == 'auto'
        build_xorg = (host_machine.system() != 'darwin' and
                      host_machine.system() != 'windows')
    else
177
        build_xorg = get_option('xorg') == 'true'
178 179 180 181 182 183 184
    endif
endif
xorgsdkdir = join_paths(get_option('prefix'), get_option('includedir'), 'xorg')

build_xwayland = false
if (host_machine.system() != 'darwin' and
    host_machine.system() != 'windows')
185 186
    if get_option('xwayland') != 'false'
        xwayland_required = get_option('xwayland') == 'true'
187 188 189

        xwayland_dep = [
            dependency('wayland-client', version: '>= 1.3.0', required: xwayland_required),
190
            dependency('wayland-protocols', version: '>= 1.10', required: xwayland_required),
191
            dependency('libdrm', version: '>= 2.4.89', required: xwayland_required),
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
            dependency('epoxy', required: xwayland_required),
        ]

        build_xwayland = true
        # check for all the deps being found, to handle 'auto' mode.
        foreach d: xwayland_dep
            if not d.found()
                build_xwayland = false
            endif
        endforeach
    endif
endif

build_xnest = false
if (host_machine.system() != 'darwin' and
    host_machine.system() != 'windows')
208 209
    if get_option('xnest') != 'false'
        xnest_required = get_option('xnest') == 'true'
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226

        xnest_dep = [
            dependency('xext', version: '>= 1.0.99.4', required: xnest_required),
            dependency('x11', required: xnest_required),
            dependency('xau', required: xnest_required),
        ]

        build_xnest = true
        # check for all the deps being found, to handle 'auto' mode.
        foreach d: xnest_dep
            if not d.found()
                build_xnest = false
            endif
        endforeach
    endif
endif

227 228 229 230 231 232 233
build_xwin = false
if get_option('xwin') == 'auto'
    if (host_machine.system() == 'cygwin' or
        host_machine.system() == 'windows')
            build_xwin = true
    endif
else
234
    build_xwin = get_option('xwin') == 'true'
235 236
endif

237
build_xquartz = false
238 239 240 241 242 243 244
if get_option('xquartz') == 'auto'
    if host_machine.system() == 'darwin'
            build_xquartz = true
    endif
else
    build_xquartz = get_option('xquartz') == 'true'
endif
245

246 247 248 249 250
build_rootless = false
if build_xquartz
    build_rootless = true
endif

251 252 253
if get_option('ipv6') == 'auto'
    build_ipv6 = cc.has_function('getaddrinfo')
else
254
    build_ipv6 = get_option('ipv6') == 'true'
255 256 257 258 259 260 261 262 263 264 265 266 267
endif

int10 = get_option('int10')
if int10 == 'auto'
    int10 = 'x86emu'
    if host_machine.cpu() == 'powerpc' and host_machine.system() == 'freebsd'
        int10 = 'stub'
    endif
    if host_machine.cpu() == 'arm'
        int10 = 'stub'
    endif
endif

268
hal_dep = []
269 270 271 272 273 274 275 276
if hal_option == 'auto'
    if not build_udev
        hal_dep = dependency('hal', required: false)
        build_hal = hal_dep.found()
    else
        build_hal = false
    endif
else
277
    build_hal = hal_option == 'true'
278 279 280 281 282 283 284 285 286
    if build_hal
        hal_dep = dependency('hal')
    endif
endif

if build_udev and build_hal
    error('Hotplugging through both libudev and hal not allowed')
endif

Jon Turney's avatar
Jon Turney committed
287 288
build_dbus = build_hal or build_systemd_logind

289
udev_dep = dependency('', required:false)
290 291 292 293 294 295 296 297 298
if build_udev
    udev_dep = dependency('libudev', version: '>= 143')
endif

log_dir = get_option('log_dir')
if log_dir == ''
    log_dir = join_paths(get_option('prefix'), get_option('localstatedir'), 'log')
endif

299
module_dir = join_paths(get_option('libdir'), get_option('module_dir'))
300 301

if glamor_option == 'auto'
Adam Jackson's avatar
Adam Jackson committed
302
    build_glamor = build_xorg or build_xwayland
303
else
304
    build_glamor = get_option('glamor') == 'true'
305 306
endif

307 308
gbm_dep = dependency('', required: false)
epoxy_dep = dependency('', required: false)
309 310
if build_glamor
    gbm_dep = dependency('gbm', version: '>= 10.2', required: false)
311
    epoxy_dep = dependency('epoxy', required: false)
312 313
endif

314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
eglstream_option = get_option('xwayland_eglstream')
if build_xwayland and build_glamor
    eglstream_dep = dependency('wayland-eglstream-protocols', required:false)
    if eglstream_option == 'auto'
        build_eglstream = eglstream_dep.found()
    else
        build_eglstream = eglstream_option == 'true'
        if build_eglstream and not eglstream_dep.found()
            error('glamor EGLStream support requested, but wayland-eglstream-protocols not found')
        endif
    endif
else
    build_eglstream = false
endif

329 330 331
# XXX: Add more sha1 options, because Linux is about choice
sha1_dep = nettle_dep

332
xdmcp_dep = dependency('', required : false)
333 334 335 336
if get_option('xdmcp')
    xdmcp_dep = dependency('xdmcp')
endif

337 338 339 340 341 342
has_xdm_auth = get_option('xdm-auth-1')

if not xdmcp_dep.found()
  has_xdm_auth = false
endif

343
build_glx = get_option('glx')
344 345 346
if build_glx
    build_hashtable = true
endif
347

348 349
libdrm_dep = dependency('libdrm', version: '>= 2.4.89', required: false)

350
if get_option('dri1') == 'auto'
351
    build_dri1 = xf86driproto_dep.found() and libdrm_dep.found()
352
else
353
    build_dri1 = get_option('dri1') == 'true'
354 355 356
endif

if get_option('dri2') == 'auto'
357
    build_dri2 = dri2proto_dep.found() and libdrm_dep.found()
358
else
359
    build_dri2 = get_option('dri2') == 'true'
360 361 362
endif

if get_option('dri3') == 'auto'
363
    build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() and libdrm_dep.found()
364
else
365
    build_dri3 = get_option('dri3') == 'true'
366 367 368 369 370 371 372
    if build_dri3
       if not xshmfence_dep.found()
           error('DRI3 requested, but xshmfence not found')
       endif
    endif
endif

373 374 375 376 377
libdrm_required = build_dri1 or build_dri2 or build_dri3
if not libdrm_dep.found() and libdrm_required
    error('DRI requested, but LIBDRM not found')
endif

378
build_modesetting = libdrm_dep.found()
379

380 381 382 383 384 385 386 387
build_vbe = false
if get_option('vbe') == 'auto'
    if (host_machine.system() != 'darwin' and
        host_machine.system() != 'windows' and
        host_machine.system() != 'cygwin')
        build_vbe = true
    endif
else
388
    build_vbe = get_option('vbe') == 'true'
389 390 391 392 393 394 395 396 397 398
endif

build_vgahw = false
if get_option('vgahw') == 'auto'
    if (host_machine.system() != 'darwin' and
        host_machine.system() != 'windows' and
        host_machine.system() != 'cygwin')
        build_vgahw = true
    endif
else
399
    build_vgahw = get_option('vgahw') == 'true'
400 401
endif

402 403 404 405 406
build_dpms = get_option('dpms')
if build_xquartz
    build_dpms = false
endif

407 408 409
build_xf86bigfont = get_option('xf86bigfont')
build_screensaver = get_option('screensaver')
build_res = get_option('xres')
410 411 412 413
if build_res
    build_hashtable = true
endif

414 415 416
build_xace = get_option('xace')
build_xinerama = get_option('xinerama')

417 418 419 420 421 422 423
build_xsecurity = get_option('xcsecurity')
if build_xsecurity
    if not build_xace
        error('cannot build Security extension without X-ACE')
    endif
endif

424 425 426 427 428 429
build_xv = get_option('xv')
build_xvmc = get_option('xvmc')
if not build_xv
    build_xvmc = false
endif

430
build_dga = false
431
xf86dgaproto_dep = dependency('', required: false)
432 433 434 435 436 437 438 439 440 441
if get_option('dga') == 'auto'
    xf86dgaproto_dep = dependency('xf86dgaproto', version: '>= 2.0.99.1', required: false)
    if xf86dgaproto_dep.found()
        build_dga = true
    endif
elif get_option('dga') == 'true'
    xf86dgaproto_dep = dependency('xf86dgaproto', version: '>= 2.0.99.1', required: true)
    build_dga = true
endif

442
build_apm = false
443 444 445 446 447 448 449
if (get_option('linux_apm') == true and
   host_machine.system() == 'linux')
    if cc.has_header('linux/apm_bios.h')
        build_apm = true
    endif
endif

450
build_acpi = false
451 452 453 454 455 456 457 458 459
if (get_option('linux_acpi') == true and
   host_machine.system() == 'linux')
    if (host_machine.cpu() == 'x86' or
       host_machine.cpu() == 'x86_64' or
       host_machine.cpu() == 'ia64')
        build_acpi = true
    endif
endif

460 461 462 463 464 465 466
build_mitshm = false
if get_option('mitshm') == 'auto'
    build_mitshm = cc.has_header('sys/shm.h')
elif get_option('mitshm') == 'true'
    build_mitshm = true
endif

467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
m_dep = cc.find_library('m', required : false)
dl_dep = cc.find_library('dl', required : false)

common_dep = [
    xproto_dep,
    randrproto_dep,
    renderproto_dep,
    xextproto_dep,
    inputproto_dep,
    kbproto_dep,
    fontsproto_dep,
    fixesproto_dep,
    damageproto_dep,
    xcmiscproto_dep,
    bigreqsproto_dep,
    xtrans_dep,
483
    libsystemd_daemon_dep,
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526

    videoproto_dep,
    compositeproto_dep,
    recordproto_dep,
    scrnsaverproto_dep,
    resourceproto_dep,
    xf86driproto_dep,
    dri2proto_dep,
    dri3proto_dep,
    xineramaproto_dep,
    xf86bigfontproto_dep,
    xf86dgaproto_dep,
    xf86vidmodeproto_dep,
    applewmproto_dep,

    pixman_dep,
    libbsd_dep,
    xkbfile_dep,
    xfont2_dep,
    xdmcp_dep,
]

inc = include_directories(
    'Xext',
    'Xi',
    'composite',
    'damageext',
    'exa',
    'fb',
    'glamor',
    'mi',
    'miext/damage',
    'miext/shadow',
    'miext/sync',
    'dbe',
    'dri3',
    'include',
    'present',
    'randr',
    'render',
    'xfixes',
)

527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
build_xselinux = false
if get_option('xselinux') != 'false'
    dep_selinux = dependency('libselinux', version: '>= 2.0.86',
			     required: get_option('xselinux') == 'true')
    dep_audit = dependency('audit', required: get_option('xselinux') == 'true')
    if get_option('xselinux') == 'true'
        build_xselinux = true
    else
        build_xselinux = dep_selinux.found() and dep_audit.found()
    endif

    if build_xselinux
        common_dep += dep_selinux
        common_dep += dep_audit
    endif
endif

544 545 546 547 548 549
socket_dep = []
if host_machine.system() == 'windows'
    socket_dep = meson.get_compiler('c').find_library('ws2_32')
    common_dep += socket_dep
endif

Adam Jackson's avatar
Adam Jackson committed
550 551
glx_inc = include_directories('glx')

552
top_dir_inc = include_directories('.')
553

554
serverconfigdir = join_paths(get_option('libdir'), 'xorg')
555

Adam Jackson's avatar
Adam Jackson committed
556
manpage_config = configuration_data()
557 558
manpage_config.set('vendorversion', '"xorg-server @0@" "X Version 11"'.format(meson.project_version()))
manpage_config.set('xorgversion', '"xorg-server @0@" "X Version 11"'.format(meson.project_version()))
Adam Jackson's avatar
Adam Jackson committed
559 560 561 562 563 564 565 566 567 568 569
manpage_config.set('xservername', 'Xorg')
manpage_config.set('xconfigfile', 'xorg.conf')
manpage_config.set('projectroot', get_option('prefix'))
manpage_config.set('apploaddir', '$(appdefaultdir)')
manpage_config.set('appmansuffix', '1')
manpage_config.set('drivermansuffix', '4')
manpage_config.set('adminmansuffix', '8')
manpage_config.set('libmansuffix', '3')
manpage_config.set('miscmansuffix', '7')
manpage_config.set('filemansuffix', '5')
manpage_config.set('logdir', log_dir)
570 571 572
manpage_config.set('datadir', join_paths(get_option('prefix'), get_option('datadir')))
manpage_config.set('mandir', join_paths(get_option('prefix'), get_option('mandir')))
manpage_config.set('sysconfdir', join_paths(get_option('prefix'), get_option('sysconfdir')))
Adam Jackson's avatar
Adam Jackson committed
573 574 575 576 577 578 579 580
manpage_config.set('xconfigdir', 'xorg.conf.d')
manpage_config.set('xkbdir', xkb_dir)
manpage_config.set('XKB_DFLT_RULES', get_option('xkb_default_rules'))
manpage_config.set('XKB_DFLT_MODEL', get_option('xkb_default_model'))
manpage_config.set('XKB_DFLT_LAYOUT', get_option('xkb_default_layout'))
manpage_config.set('XKB_DFLT_VARIANT', get_option('xkb_default_variant'))
manpage_config.set('XKB_DFLT_OPTIONS', get_option('xkb_default_options'))
manpage_config.set('bundle_id_prefix', '...')
581
manpage_config.set('modulepath', module_dir)
Adam Jackson's avatar
Adam Jackson committed
582 583
# wtf doesn't this work
# manpage_config.set('suid_wrapper_dir', join_paths(get_option('prefix'), libexecdir))
Adam Jackson's avatar
Adam Jackson committed
584
manpage_config.set('suid_wrapper_dir', join_paths(get_option('prefix'), 'libexec'))
585
manpage_config.set('default_font_path', default_font_path)
Adam Jackson's avatar
Adam Jackson committed
586

587 588 589 590 591 592
# generate header containing date & time build was configued
build_date_time = configure_file(
    output: 'buildDateTime.h',
    command: ['sh', join_paths(meson.current_source_dir(), 'buildDateTime.sh'), '@OUTPUT@'],
)

593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610
# Include must come first, as it sets up dix-config.h
subdir('include')

# X server core
subdir('config')
subdir('dix')
subdir('dri3')
subdir('glx')
subdir('fb')
subdir('mi')
subdir('os')
# X extensions
subdir('composite')
subdir('damageext')
subdir('dbe')
subdir('miext/damage')
subdir('miext/shadow')
subdir('miext/sync')
611 612 613
if build_rootless
    subdir('miext/rootless')
endif
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
subdir('present')
if build_xwin or build_xquartz
    subdir('pseudoramiX')
endif
subdir('randr')
subdir('record')
subdir('render')
subdir('xfixes')
subdir('xkb')
subdir('Xext')
subdir('Xi')
# other
if build_glamor
    subdir('glamor')
endif
if build_xorg or get_option('xephyr')
    subdir('exa')
endif

# Common static libraries of all X servers
libxserver = [
    libxserver_mi,
    libxserver_dix,

    libxserver_composite,
    libxserver_damageext,
    libxserver_dbe,
    libxserver_randr,
    libxserver_miext_damage,
    libxserver_render,
    libxserver_present,
    libxserver_xext,
    libxserver_miext_sync,
    libxserver_xfixes,
    libxserver_xi,
    libxserver_xkb,
    libxserver_record,

    libxserver_os,
]

655 656
libxserver += libxserver_dri3

657
subdir('hw')
658 659 660 661

if host_machine.system() != 'windows'
    subdir('test')
endif
Adam Jackson's avatar
Adam Jackson committed
662 663 664 665 666 667

install_man(configure_file(
    input: 'man/Xserver.man',
    output: 'Xserver.1',
    configuration: manpage_config,
))
668 669 670 671 672 673

if build_xorg
    sdkconfig = configuration_data()
    awk = find_program('awk')

    sdkconfig.set('prefix', get_option('prefix'))
674 675 676 677
    sdkconfig.set('exec_prefix', '${prefix}')
    sdkconfig.set('libdir', join_paths('${exec_prefix}', get_option('libdir')))
    sdkconfig.set('includedir', join_paths('${prefix}', get_option('includedir')))
    sdkconfig.set('datarootdir', join_paths('${prefix}', get_option('datadir')))
678
    sdkconfig.set('moduledir', join_paths('${exec_prefix}', module_dir))
679 680
    sdkconfig.set('sdkdir', join_paths('${prefix}', get_option('includedir'), 'xorg'))
    sdkconfig.set('sysconfigdir', join_paths('${datarootdir}', 'X11/xorg.conf.d'))
681 682 683

    sdkconfig.set('abi_ansic',
        run_command(awk, '-F', '[(,)]',
684
                    '/^#define ABI_ANSIC.*SET/ { printf "%d.%d", $2, $3 }',
685 686 687 688 689
                    files('hw/xfree86/common/xf86Module.h')
        ).stdout()
    )
    sdkconfig.set('abi_videodrv',
        run_command(awk, '-F', '[(,)]',
690
                    '/^#define ABI_VIDEODRV.*SET/ { printf "%d.%d", $2, $3 }',
691 692 693 694 695
                    files('hw/xfree86/common/xf86Module.h')
        ).stdout()
    )
    sdkconfig.set('abi_xinput',
        run_command(awk, '-F', '[(,)]',
696
                    '/^#define ABI_XINPUT.*SET/ { printf "%d.%d", $2, $3 }',
697 698 699 700 701
                    files('hw/xfree86/common/xf86Module.h')
        ).stdout()
    )
    sdkconfig.set('abi_extension',
        run_command(awk, '-F', '[(,)]',
702
                    '/^#define ABI_EXTENSION.*SET/ { printf "%d.%d", $2, $3 }',
703 704 705 706
                    files('hw/xfree86/common/xf86Module.h')
        ).stdout()
    )

707 708 709 710
    sdk_required_modules = [
      'pixman-1 >= 0.27.2',
    ]

711 712
    # XXX this isn't trying very hard, but hard enough.
    sdkconfig.set('PACKAGE_VERSION', meson.project_version())
713
    sdkconfig.set('SDK_REQUIRED_MODULES', ' '.join(sdk_required_modules))
714 715 716 717 718 719 720 721 722 723 724 725
    sdkconfig.set('symbol_visibility', '-fvisibility=hidden')
    sdkconfig.set('XORG_DRIVER_LIBS', '')

    configure_file(
        input: 'xorg-server.pc.in',
        output: 'xorg-server.pc',
        configuration: sdkconfig,
        install_dir: join_paths(get_option('prefix'),
                                get_option('libdir'),
                                'pkgconfig'),
    )
endif
726 727 728

install_data('xorg-server.m4',
             install_dir: join_paths(get_option('datadir'), 'aclocal'))