meson.build (25847B)
1 project('xserver', 'c', 2 default_options: [ 3 'buildtype=debugoptimized', 4 'c_std=gnu99', 5 ], 6 version: '21.1.3', 7 meson_version: '>= 0.47.0', 8 ) 9 release_date = '2022-01-02' 10 11 add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc']) 12 cc = meson.get_compiler('c') 13 14 add_global_arguments('-fno-strict-aliasing', language : 'c') 15 add_global_arguments('-fvisibility=hidden', language : 'c') 16 17 add_global_link_arguments('-fvisibility=hidden', language : 'c') 18 19 if cc.get_id() == 'gcc' or cc.get_id() == 'clang' 20 test_wflags = [ 21 '-Wall', 22 '-Wpointer-arith', 23 '-Wmissing-declarations', 24 '-Wformat=2', 25 '-Wstrict-prototypes', 26 '-Wmissing-prototypes', 27 '-Wnested-externs', 28 '-Wbad-function-cast', 29 '-Wold-style-definition', 30 '-Wunused', 31 '-Wuninitialized', 32 '-Wshadow', 33 '-Wmissing-noreturn', 34 '-Wmissing-format-attribute', 35 '-Wredundant-decls', 36 '-Werror=implicit', 37 '-Werror=nonnull', 38 '-Werror=init-self', 39 '-Werror=main', 40 '-Werror=missing-braces', 41 '-Werror=sequence-point', 42 '-Werror=return-type', 43 '-Werror=trigraphs', 44 '-Werror=write-strings', 45 '-Werror=address', 46 '-Werror=int-to-pointer-cast', 47 '-Werror=pointer-to-int-cast', 48 ] 49 else 50 test_wflags = [] 51 endif 52 53 common_wflags = [] 54 foreach wflag: test_wflags 55 if cc.has_argument(wflag) 56 common_wflags += [ wflag ] 57 endif 58 endforeach 59 60 add_global_arguments(common_wflags, language : ['c', 'objc']) 61 62 libdrm_req = '>= 2.4.89' 63 libselinux_req = '>= 2.0.86' 64 xext_req = '>= 1.0.99.4' 65 wayland_req = '>= 1.5.0' 66 wayland_protocols_req = '>= 1.18' 67 gbm_req = '>= 10.2' 68 xf86dgaproto_req = '>= 2.0.99.1' 69 70 xproto_dep = dependency('xproto', version: '>= 7.0.31', fallback: ['xorgproto', 'ext_xorgproto']) 71 randrproto_dep = dependency('randrproto', version: '>= 1.6.0', fallback: ['xorgproto', 'ext_xorgproto']) 72 renderproto_dep = dependency('renderproto', version: '>= 0.11', fallback: ['xorgproto', 'ext_xorgproto']) 73 xextproto_dep = dependency('xextproto', version: '>= 7.2.99.901', fallback: ['xorgproto', 'ext_xorgproto']) 74 inputproto_dep = dependency('inputproto', version: '>= 2.3.99.1', fallback: ['xorgproto', 'ext_xorgproto']) 75 kbproto_dep = dependency('kbproto', version: '>= 1.0.3', fallback: ['xorgproto', 'ext_xorgproto']) 76 fontsproto_dep = dependency('fontsproto', version: '>= 2.1.3', fallback: ['xorgproto', 'ext_xorgproto']) 77 fixesproto_dep = dependency('fixesproto', version: '>= 6.0', fallback: ['xorgproto', 'ext_xorgproto']) 78 damageproto_dep = dependency('damageproto', version: '>= 1.1', fallback: ['xorgproto', 'ext_xorgproto']) 79 xcmiscproto_dep = dependency('xcmiscproto', version: '>= 1.2.0', fallback: ['xorgproto', 'ext_xorgproto']) 80 bigreqsproto_dep = dependency('bigreqsproto', version: '>= 1.1.0', fallback: ['xorgproto', 'ext_xorgproto']) 81 xtrans_dep = dependency('xtrans', version: '>= 1.3.5') 82 83 videoproto_dep = dependency('videoproto', fallback: ['xorgproto', 'ext_xorgproto']) 84 compositeproto_dep = dependency('compositeproto', version: '>= 0.4', fallback: ['xorgproto', 'ext_xorgproto']) 85 recordproto_dep = dependency('recordproto', version: '>= 1.13.99.1', fallback: ['xorgproto', 'ext_xorgproto']) 86 scrnsaverproto_dep = dependency('scrnsaverproto', version: '>= 1.1', fallback: ['xorgproto', 'ext_xorgproto']) 87 resourceproto_dep = dependency('resourceproto', version: '>= 1.2.0', fallback: ['xorgproto', 'ext_xorgproto']) 88 xf86driproto_dep = dependency('xf86driproto', version: '>= 2.1.0', fallback: ['xorgproto', 'ext_xorgproto'], required: get_option('dri1') == 'true') 89 dri2proto_dep = dependency('dri2proto', version: '>= 2.8', fallback: ['xorgproto', 'ext_xorgproto'], required: get_option('dri2') == 'true') 90 dri3proto_dep = dependency('dri3proto', version: '>= 1.2', fallback: ['xorgproto', 'ext_xorgproto'], required: get_option('dri3') == 'true') 91 xineramaproto_dep = dependency('xineramaproto', fallback: ['xorgproto', 'ext_xorgproto']) 92 xf86bigfontproto_dep = dependency('xf86bigfontproto', version: '>= 1.2.0', fallback: ['xorgproto', 'ext_xorgproto'], required: get_option('xf86bigfont')) 93 xf86vidmodeproto_dep = dependency('xf86vidmodeproto', version: '>= 2.2.99.1', fallback: ['xorgproto', 'ext_xorgproto']) 94 applewmproto_dep = dependency('applewmproto', version: '>= 1.4', fallback: ['xorgproto', 'ext_xorgproto'], required: false) 95 xshmfence_dep = dependency('xshmfence', version: '>= 1.1', required: false) 96 97 pixman_dep = dependency('pixman-1') 98 libbsd_dep = dependency('libbsd', required: false) 99 xkbcomp_dep = dependency('xkbcomp', required: false) 100 xkbfile_dep = dependency('xkbfile') 101 xfont2_dep = dependency('xfont2', version: '>= 2.0') 102 103 dbus_required = get_option('systemd_logind') == 'true' 104 dbus_dep = dependency('dbus-1', version: '>= 1.0', required: dbus_required) 105 106 # libsystemd-daemon was moved into libsystemd in version 209 107 libsystemd_daemon_dep = dependency('libsystemd', version: '>= 209', required: false) 108 if not libsystemd_daemon_dep.found() 109 libsystemd_daemon_dep = dependency('libsystemd-daemon', required: false) 110 endif 111 112 build_hashtable = false 113 114 # Resolve default values of some options 115 xkb_dir = get_option('xkb_dir') 116 if xkb_dir == '' 117 if xkbcomp_dep.found() and xkbcomp_dep.type_name() == 'pkgconfig' 118 xkb_dir = xkbcomp_dep.get_pkgconfig_variable('xkbconfigdir') 119 endif 120 if xkb_dir == '' 121 xkb_dir = join_paths(get_option('prefix'), 'share/X11/xkb') 122 endif 123 endif 124 125 xkb_output_dir = get_option('xkb_output_dir') 126 if xkb_output_dir == '' 127 xkb_output_dir = join_paths(xkb_dir, 'compiled') 128 endif 129 130 xkb_bin_dir = get_option('xkb_bin_dir') 131 if xkb_bin_dir == '' 132 if xkbcomp_dep.found() and xkbcomp_dep.type_name() == 'pkgconfig' 133 xkb_bin_dir = xkbcomp_dep.get_pkgconfig_variable('bindir') 134 endif 135 if xkb_bin_dir == '' 136 xkb_bin_dir = join_paths(get_option('prefix'), get_option('bindir')) 137 endif 138 endif 139 140 dfp = get_option('default_font_path') 141 if dfp == '' 142 fontutil_dep = dependency('fontutil') 143 fontrootdir = fontutil_dep.get_pkgconfig_variable('fontrootdir') 144 dfp_elements = [ 145 join_paths(fontrootdir, 'misc'), 146 join_paths(fontrootdir, 'TTF'), 147 join_paths(fontrootdir, 'OTF'), 148 join_paths(fontrootdir, 'Type1'), 149 join_paths(fontrootdir, '100dpi'), 150 join_paths(fontrootdir, '75dpi'), 151 ] 152 if host_machine.system() == 'darwin' 153 dfp_elements += [ 154 '/Library/Fonts', 155 '/System/Library/Fonts', 156 ] 157 endif 158 default_font_path = ','.join(dfp_elements) 159 else 160 default_font_path = dfp 161 endif 162 163 hal_option = get_option('hal') 164 glamor_option = get_option('glamor') 165 166 build_udev = get_option('udev') 167 build_udev_kms = get_option('udev_kms') 168 if ['windows', 'darwin', 'cygwin'].contains(host_machine.system()) 169 build_udev = false 170 build_udev_kms = false 171 hal_option = 'false' 172 endif 173 174 if get_option('systemd_logind') == 'auto' 175 build_systemd_logind = build_udev_kms and dbus_dep.found() 176 else 177 build_systemd_logind = get_option('systemd_logind') == 'true' 178 endif 179 180 with_dtrace = get_option('dtrace') 181 if with_dtrace 182 dtrace = find_program('dtrace', required: true) 183 endif 184 185 build_xorg = false 186 if (host_machine.system() != 'darwin' and 187 host_machine.system() != 'windows') 188 if get_option('xorg') == 'auto' 189 build_xorg = (host_machine.system() != 'darwin' and 190 host_machine.system() != 'windows') 191 else 192 build_xorg = get_option('xorg') == 'true' 193 endif 194 endif 195 xorgsdkdir = join_paths(get_option('prefix'), get_option('includedir'), 'xorg') 196 libxcvt_dep = dependency('libxcvt', required: build_xorg) 197 198 build_xnest = false 199 if (host_machine.system() != 'darwin' and 200 host_machine.system() != 'windows') 201 if get_option('xnest') != 'false' 202 xnest_required = get_option('xnest') == 'true' 203 204 xnest_dep = [ 205 dependency('xext', version: xext_req, required: xnest_required), 206 dependency('x11', required: xnest_required), 207 dependency('xau', required: xnest_required), 208 ] 209 210 build_xnest = true 211 # check for all the deps being found, to handle 'auto' mode. 212 foreach d: xnest_dep 213 if not d.found() 214 build_xnest = false 215 endif 216 endforeach 217 endif 218 endif 219 220 build_xwin = false 221 if get_option('xwin') == 'auto' 222 if (host_machine.system() == 'cygwin' or 223 host_machine.system() == 'windows') 224 build_xwin = true 225 endif 226 else 227 build_xwin = get_option('xwin') == 'true' 228 endif 229 230 build_xquartz = false 231 if get_option('xquartz') == 'auto' 232 if host_machine.system() == 'darwin' 233 build_xquartz = true 234 endif 235 else 236 build_xquartz = get_option('xquartz') == 'true' 237 endif 238 239 build_rootless = false 240 if build_xquartz 241 build_rootless = true 242 endif 243 244 if get_option('ipv6') == 'auto' 245 build_ipv6 = cc.has_function('getaddrinfo') 246 else 247 build_ipv6 = get_option('ipv6') == 'true' 248 endif 249 250 int10 = get_option('int10') 251 if int10 == 'auto' 252 int10 = 'x86emu' 253 if host_machine.cpu() == 'powerpc' and host_machine.system() == 'freebsd' 254 int10 = 'stub' 255 endif 256 if host_machine.cpu() == 'arm' 257 int10 = 'stub' 258 endif 259 endif 260 261 hal_dep = [] 262 if hal_option == 'auto' 263 if not build_udev 264 hal_dep = dependency('hal', required: false) 265 build_hal = hal_dep.found() 266 else 267 build_hal = false 268 endif 269 else 270 build_hal = hal_option == 'true' 271 if build_hal 272 hal_dep = dependency('hal') 273 endif 274 endif 275 276 if build_udev and build_hal 277 error('Hotplugging through both libudev and hal not allowed') 278 endif 279 280 build_dbus = build_hal or build_systemd_logind 281 282 udev_dep = dependency('', required:false) 283 if build_udev or build_udev_kms 284 udev_dep = dependency('libudev', version: '>= 143') 285 endif 286 287 log_dir = get_option('log_dir') 288 if log_dir == '' 289 log_dir = join_paths(get_option('prefix'), get_option('localstatedir'), 'log') 290 endif 291 292 module_dir = join_paths(get_option('libdir'), get_option('module_dir')) 293 294 if glamor_option == 'auto' 295 build_glamor = build_xorg 296 else 297 build_glamor = glamor_option == 'true' 298 endif 299 300 gbm_dep = dependency('', required: false) 301 epoxy_dep = dependency('', required: false) 302 if build_glamor 303 gbm_dep = dependency('gbm', version: gbm_req, required: false) 304 epoxy_dep = dependency('epoxy', required: false) 305 endif 306 307 # Lots of sha1 options, because Linux is about choice :) 308 309 # The idea behind the ordering here is that we should first prefer system 310 # builtin providers, and then smaller implementations of over larger ones. 311 test_sha1 = [ 312 'libc', # libmd API is in libc on some BSDs 313 'CommonCrypto', # darwin API 314 'CryptoAPI', # windows API 315 'libmd', # other BSDs & Solaris 316 'libsha1', # "a tiny library providing a SHA1 implementation, created for facilitating X server compilation on embedded devices where larger libraries containing SHA1 implementations are not needed" 317 'libnettle', 318 'libgcrypt', # in debian base system 319 'libcrypto', 320 ] 321 322 if get_option('sha1') != 'auto' 323 test_sha1 = [get_option('sha1')] 324 endif 325 326 sha1_found = false 327 foreach t : test_sha1 328 if t == 'libc' 329 if cc.has_function('SHA1Init') 330 sha1_found = true 331 sha1_dep = dependency('', required: false) 332 endif 333 elif t == 'CommonCrypto' 334 if cc.has_function('CC_SHA1_Init') 335 sha1_found = true 336 sha1_dep = dependency('', required: false) 337 endif 338 elif t == 'CryptoAPI' 339 if cc.has_header('wincrypt.h') 340 sha1_found = true 341 sha1_dep = dependency('', required: false) 342 endif 343 elif t == 'libmd' 344 md_dep = cc.find_library('md', required: false) 345 if md_dep.found() 346 sha1_found = true 347 sha1_dep = md_dep 348 endif 349 elif t == 'libsha1' 350 libsha1_dep = dependency('libsha1', required: false) 351 if libsha1_dep.found() 352 sha1_found = true 353 sha1_dep = libsha1_dep 354 endif 355 elif t == 'libnettle' 356 nettle_dep = dependency('nettle', required: false) 357 if nettle_dep.found() 358 sha1_found = true 359 sha1_dep = nettle_dep 360 endif 361 elif t == 'libgcrypt' 362 gcrypt_dep = dependency('libgcrypt', required: false) 363 if gcrypt_dep.found() 364 sha1_found = true 365 sha1_dep = gcrypt_dep 366 endif 367 elif t == 'libcrypto' 368 # we don't need all of OpenSSL, just libcrypto 369 libcrypto_dep = cc.find_library('crypto', required: false) 370 openssl_dep = dependency('openssl', required: false) 371 if libcrypto_dep.found() or openssl_dep.found() 372 sha1_found = true 373 if libcrypto_dep.found() 374 sha1_dep = libcrypto_dep 375 else 376 sha1_dep = openssl_dep 377 endif 378 endif 379 endif 380 381 if sha1_found 382 sha1 = t 383 break 384 endif 385 endforeach 386 387 if sha1_found 388 message('Using @0@ SHA1 functions'.format(sha1)) 389 else 390 if get_option('sha1') != 'auto' 391 error('@0@ SHA1 requested, but not found'.format(get_option('sha1'))) 392 else 393 error('No suitable SHA1 implementation found') 394 endif 395 endif 396 397 xdmcp_dep = dependency('', required : false) 398 if get_option('xdmcp') 399 xdmcp_dep = dependency('xdmcp') 400 endif 401 402 has_xdm_auth = get_option('xdm-auth-1') 403 404 if not xdmcp_dep.found() 405 has_xdm_auth = false 406 endif 407 408 build_glx = get_option('glx') 409 if build_glx 410 build_hashtable = true 411 endif 412 413 libdrm_dep = dependency('libdrm', version: libdrm_req, required: false) 414 415 if get_option('dri1') == 'auto' 416 build_dri1 = xf86driproto_dep.found() and libdrm_dep.found() 417 else 418 build_dri1 = get_option('dri1') == 'true' 419 endif 420 421 if get_option('dri2') == 'auto' 422 build_dri2 = dri2proto_dep.found() and libdrm_dep.found() 423 else 424 build_dri2 = get_option('dri2') == 'true' 425 endif 426 427 if get_option('dri3') == 'auto' 428 build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() and libdrm_dep.found() 429 else 430 build_dri3 = get_option('dri3') == 'true' 431 if build_dri3 432 if not xshmfence_dep.found() 433 error('DRI3 requested, but xshmfence not found') 434 endif 435 endif 436 endif 437 438 libdrm_required = (build_dri1 or build_dri2 or build_dri3) and get_option('drm') == true 439 if not libdrm_dep.found() and libdrm_required 440 error('DRI requested, but LIBDRM not found') 441 endif 442 443 build_modesetting = libdrm_dep.found() and dri2proto_dep.found() 444 445 build_vgahw = false 446 if get_option('vgahw') == 'auto' 447 if (host_machine.system() != 'darwin' and 448 host_machine.system() != 'windows' and 449 host_machine.system() != 'cygwin') 450 build_vgahw = true 451 endif 452 else 453 build_vgahw = get_option('vgahw') == 'true' 454 endif 455 456 build_dpms = get_option('dpms') 457 if build_xquartz 458 build_dpms = false 459 endif 460 461 build_xf86bigfont = get_option('xf86bigfont') 462 build_screensaver = get_option('screensaver') 463 build_res = get_option('xres') 464 if build_res 465 build_hashtable = true 466 endif 467 468 build_xace = get_option('xace') 469 build_xinerama = get_option('xinerama') 470 471 build_xsecurity = get_option('xcsecurity') 472 if build_xsecurity 473 if not build_xace 474 error('cannot build Security extension without X-ACE') 475 endif 476 endif 477 478 build_xv = get_option('xv') 479 build_xvmc = get_option('xvmc') 480 if not build_xv 481 build_xvmc = false 482 endif 483 484 build_dga = false 485 xf86dgaproto_dep = dependency('', required: false) 486 if get_option('dga') == 'auto' 487 xf86dgaproto_dep = dependency('xf86dgaproto', version: xf86dgaproto_req, required: false) 488 if xf86dgaproto_dep.found() 489 build_dga = true 490 endif 491 elif get_option('dga') == 'true' 492 xf86dgaproto_dep = dependency('xf86dgaproto', version: xf86dgaproto_req, required: true) 493 build_dga = true 494 endif 495 496 build_apm = false 497 if (get_option('linux_apm') == true and 498 host_machine.system() == 'linux') 499 if cc.has_header('linux/apm_bios.h') 500 build_apm = true 501 endif 502 endif 503 504 build_acpi = false 505 if (get_option('linux_acpi') == true and 506 host_machine.system() == 'linux') 507 if (host_machine.cpu() == 'x86' or 508 host_machine.cpu() == 'x86_64' or 509 host_machine.cpu() == 'ia64') 510 build_acpi = true 511 endif 512 endif 513 514 build_mitshm = false 515 if get_option('mitshm') == 'auto' 516 build_mitshm = cc.has_header('sys/shm.h') 517 elif get_option('mitshm') == 'true' 518 build_mitshm = true 519 endif 520 521 m_dep = cc.find_library('m', required : false) 522 dl_dep = cc.find_library('dl', required : false) 523 524 common_dep = [ 525 xproto_dep, 526 randrproto_dep, 527 renderproto_dep, 528 xextproto_dep, 529 inputproto_dep, 530 kbproto_dep, 531 fontsproto_dep, 532 fixesproto_dep, 533 damageproto_dep, 534 xcmiscproto_dep, 535 bigreqsproto_dep, 536 xtrans_dep, 537 libsystemd_daemon_dep, 538 539 videoproto_dep, 540 compositeproto_dep, 541 recordproto_dep, 542 scrnsaverproto_dep, 543 resourceproto_dep, 544 xf86driproto_dep, 545 dri2proto_dep, 546 dri3proto_dep, 547 xineramaproto_dep, 548 xf86bigfontproto_dep, 549 xf86dgaproto_dep, 550 xf86vidmodeproto_dep, 551 applewmproto_dep, 552 553 pixman_dep, 554 libbsd_dep, 555 xkbfile_dep, 556 xfont2_dep, 557 xdmcp_dep, 558 ] 559 560 inc = include_directories( 561 'Xext', 562 'Xi', 563 'composite', 564 'damageext', 565 'exa', 566 'fb', 567 'glamor', 568 'mi', 569 'miext/damage', 570 'miext/shadow', 571 'miext/sync', 572 'dbe', 573 'dri3', 574 'include', 575 'present', 576 'randr', 577 'render', 578 'xfixes', 579 ) 580 581 build_xselinux = false 582 if get_option('xselinux') != 'false' 583 dep_selinux = dependency('libselinux', version: libselinux_req, 584 required: get_option('xselinux') == 'true') 585 dep_audit = dependency('audit', required: get_option('xselinux') == 'true') 586 if get_option('xselinux') == 'true' 587 build_xselinux = true 588 else 589 build_xselinux = dep_selinux.found() and dep_audit.found() 590 endif 591 592 if build_xselinux 593 common_dep += dep_selinux 594 common_dep += dep_audit 595 endif 596 endif 597 598 socket_dep = [] 599 if host_machine.system() == 'windows' 600 socket_dep = meson.get_compiler('c').find_library('ws2_32') 601 common_dep += socket_dep 602 endif 603 604 if get_option('libunwind') 605 common_dep += dependency('libunwind', required: true) 606 endif 607 608 glx_inc = include_directories('glx') 609 610 top_dir_inc = include_directories('.') 611 612 serverconfigdir = join_paths(get_option('prefix'), get_option('libdir'), 'xorg') 613 614 manpage_config = configuration_data() 615 manpage_config.set('vendorversion', '"xorg-server @0@" "X Version 11"'.format(meson.project_version())) 616 manpage_config.set('xorgversion', '"xorg-server @0@" "X Version 11"'.format(meson.project_version())) 617 manpage_config.set('xservername', 'Xorg') 618 manpage_config.set('xconfigfile', 'xorg.conf') 619 manpage_config.set('projectroot', get_option('prefix')) 620 manpage_config.set('apploaddir', '$(appdefaultdir)') 621 manpage_config.set('appmansuffix', '1') 622 manpage_config.set('drivermansuffix', '4') 623 manpage_config.set('adminmansuffix', '8') 624 manpage_config.set('libmansuffix', '3') 625 manpage_config.set('miscmansuffix', '7') 626 manpage_config.set('filemansuffix', '5') 627 manpage_config.set('logdir', log_dir) 628 manpage_config.set('datadir', join_paths(get_option('prefix'), get_option('datadir'))) 629 manpage_config.set('mandir', join_paths(get_option('prefix'), get_option('mandir'))) 630 manpage_config.set('sysconfdir', join_paths(get_option('prefix'), get_option('sysconfdir'))) 631 manpage_config.set('xconfigdir', 'xorg.conf.d') 632 manpage_config.set('xkbdir', xkb_dir) 633 manpage_config.set('XKB_DFLT_RULES', get_option('xkb_default_rules')) 634 manpage_config.set('XKB_DFLT_MODEL', get_option('xkb_default_model')) 635 manpage_config.set('XKB_DFLT_LAYOUT', get_option('xkb_default_layout')) 636 manpage_config.set('XKB_DFLT_VARIANT', get_option('xkb_default_variant')) 637 manpage_config.set('XKB_DFLT_OPTIONS', get_option('xkb_default_options')) 638 manpage_config.set('bundle_id_prefix', '...') 639 manpage_config.set('modulepath', module_dir) 640 # wtf doesn't this work 641 # manpage_config.set('suid_wrapper_dir', join_paths(get_option('prefix'), libexecdir)) 642 manpage_config.set('suid_wrapper_dir', join_paths(get_option('prefix'), 'libexec')) 643 manpage_config.set('default_font_path', default_font_path) 644 645 require_docs = get_option('docs') == 'true' 646 require_devel_docs = get_option('devel-docs') == 'true' 647 require_docs_pdf = (require_docs or require_devel_docs) and get_option('docs-pdf') == 'true' 648 649 sgml_doctools_dep = dependency('xorg-sgml-doctools', 650 required: require_docs or require_devel_docs) 651 xmlto = find_program('xmlto', required: require_docs or require_devel_docs) 652 xsltproc = find_program('xsltproc', required: require_docs or require_devel_docs) 653 fop = find_program('fop', required: require_docs_pdf) 654 655 build_docs = (get_option('docs') != 'false' and 656 sgml_doctools_dep.found() and 657 xmlto.found()) 658 659 build_docs_devel = (get_option('devel-docs') != 'false' and 660 sgml_doctools_dep.found() and 661 xmlto.found()) 662 663 build_docs_pdf = (get_option('docs-pdf') != 'false' and 664 (build_docs or build_docs_devel) and 665 fop.found()) 666 667 if build_docs or build_docs_devel 668 doc_sgml_path = sgml_doctools_dep.get_pkgconfig_variable('sgmlrootdir') 669 doc_stylesheet_srcdir = join_paths(doc_sgml_path, 'X11') 670 671 # once we bump meson dependency to 0.56.0 we can use 672 # meson.project_build_root() instead of meson.build_root() 673 674 # Meson does not and will not support functions so we are copy-pasting 675 # documentation build code around which is unfortunate 676 # See https://mesonbuild.com/FAQ.html#why-doesnt-meson-have-user-defined-functionsmacros 677 678 docs_xmlto_search_flags = [ 679 '--searchpath', doc_stylesheet_srcdir, 680 '--searchpath', meson.build_root(), 681 ] 682 683 docs_xslt_search_flags = [ 684 '--path', doc_stylesheet_srcdir, 685 '--path', meson.build_root(), 686 ] 687 endif 688 689 # Include must come first, as it sets up dix-config.h 690 subdir('include') 691 692 # X server core 693 subdir('config') 694 subdir('dix') 695 subdir('dri3') 696 subdir('glx') 697 subdir('fb') 698 subdir('mi') 699 subdir('os') 700 # X extensions 701 subdir('composite') 702 subdir('damageext') 703 subdir('dbe') 704 subdir('miext/damage') 705 subdir('miext/shadow') 706 subdir('miext/sync') 707 if build_rootless 708 subdir('miext/rootless') 709 endif 710 subdir('present') 711 if build_xwin or build_xquartz 712 subdir('pseudoramiX') 713 endif 714 subdir('randr') 715 subdir('record') 716 subdir('render') 717 subdir('xfixes') 718 subdir('xkb') 719 subdir('Xext') 720 subdir('Xi') 721 # other 722 if build_glamor 723 subdir('glamor') 724 endif 725 if build_xorg or get_option('xephyr') 726 subdir('exa') 727 endif 728 subdir('doc') 729 730 # Common static libraries of all X servers 731 libxserver = [ 732 libxserver_mi, 733 libxserver_dix, 734 735 libxserver_composite, 736 libxserver_damageext, 737 libxserver_dbe, 738 libxserver_randr, 739 libxserver_miext_damage, 740 libxserver_render, 741 libxserver_present, 742 libxserver_xext, 743 libxserver_miext_sync, 744 libxserver_xfixes, 745 libxserver_xi, 746 libxserver_xkb, 747 libxserver_record, 748 749 libxserver_os, 750 ] 751 752 libxserver += libxserver_dri3 753 754 subdir('hw') 755 756 if host_machine.system() != 'windows' 757 subdir('test') 758 endif 759 760 install_man(configure_file( 761 input: 'man/Xserver.man', 762 output: 'Xserver.1', 763 configuration: manpage_config, 764 )) 765 766 if build_xorg 767 sdkconfig = configuration_data() 768 awk = find_program('awk') 769 770 sdkconfig.set('prefix', get_option('prefix')) 771 sdkconfig.set('exec_prefix', '${prefix}') 772 sdkconfig.set('libdir', join_paths('${exec_prefix}', get_option('libdir'))) 773 sdkconfig.set('includedir', join_paths('${prefix}', get_option('includedir'))) 774 sdkconfig.set('datarootdir', join_paths('${prefix}', get_option('datadir'))) 775 sdkconfig.set('moduledir', join_paths('${exec_prefix}', module_dir)) 776 sdkconfig.set('sdkdir', join_paths('${prefix}', get_option('includedir'), 'xorg')) 777 sdkconfig.set('sysconfigdir', join_paths('${datarootdir}', 'X11/xorg.conf.d')) 778 779 sdkconfig.set('abi_ansic', 780 run_command(awk, '-F', '[(,)]', 781 '/^#define ABI_ANSIC.*SET/ { printf "%d.%d", $2, $3 }', 782 files('hw/xfree86/common/xf86Module.h') 783 ).stdout() 784 ) 785 sdkconfig.set('abi_videodrv', 786 run_command(awk, '-F', '[(,)]', 787 '/^#define ABI_VIDEODRV.*SET/ { printf "%d.%d", $2, $3 }', 788 files('hw/xfree86/common/xf86Module.h') 789 ).stdout() 790 ) 791 sdkconfig.set('abi_xinput', 792 run_command(awk, '-F', '[(,)]', 793 '/^#define ABI_XINPUT.*SET/ { printf "%d.%d", $2, $3 }', 794 files('hw/xfree86/common/xf86Module.h') 795 ).stdout() 796 ) 797 sdkconfig.set('abi_extension', 798 run_command(awk, '-F', '[(,)]', 799 '/^#define ABI_EXTENSION.*SET/ { printf "%d.%d", $2, $3 }', 800 files('hw/xfree86/common/xf86Module.h') 801 ).stdout() 802 ) 803 804 sdk_required_modules = [ 805 'pixman-1 >= 0.27.2', 806 ] 807 808 # XXX this isn't trying very hard, but hard enough. 809 sdkconfig.set('PACKAGE_VERSION', meson.project_version()) 810 sdkconfig.set('SDK_REQUIRED_MODULES', ' '.join(sdk_required_modules)) 811 sdkconfig.set('symbol_visibility', '-fvisibility=hidden') 812 sdkconfig.set('XORG_DRIVER_LIBS', '') 813 814 configure_file( 815 input: 'xorg-server.pc.in', 816 output: 'xorg-server.pc', 817 configuration: sdkconfig, 818 install_dir: join_paths(get_option('prefix'), 819 get_option('libdir'), 820 'pkgconfig'), 821 ) 822 823 install_data('xorg-server.m4', 824 install_dir: join_paths(get_option('datadir'), 'aclocal')) 825 endif 826 827 if build_docs or build_docs_devel 828 docxmlconfig = configuration_data() 829 docxmlconfig.set('PACKAGE_VERSION', meson.project_version()) 830 docxmlconfig.set('RELEASE_DATE', release_date) 831 configure_file( 832 input: 'xserver.ent.in', 833 output: 'xserver.ent', 834 configuration: docxmlconfig 835 ) 836 endif