1 # SPDX-License-Identifier: MIT 2 # 3 # Copyright (c) 2026, Oracle and/or its affiliates. 4 # 5 # Permission is hereby granted, free of charge, to any person obtaining a 6 # copy of this software and associated documentation files (the "Software"), 7 # to deal in the Software without restriction, including without limitation 8 # the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 # and/or sell copies of the Software, and to permit persons to whom the 10 # Software is furnished to do so, subject to the following conditions: 11 # 12 # The above copyright notice and this permission notice (including the next 13 # paragraph) shall be included in all copies or substantial portions of the 14 # Software. 15 # 16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 # DEALINGS IN THE SOFTWARE. 23 # 24 25 project( 26 'xlsclients', 27 'c', 28 version: '1.1.6', 29 license: 'MIT AND MIT-open-group', 30 license_files: 'COPYING', 31 meson_version: '>= 1.1.0', 32 ) 33 34 conf = configuration_data() 35 package_string = ' '.join(meson.project_name(), meson.project_version()) 36 conf.set_quoted('PACKAGE_STRING', package_string) 37 38 # Replaces AC_USE_SYSTEM_EXTENSIONS 39 if host_machine.system() == 'sunos' 40 add_project_arguments('-D__EXTENSIONS__', language: ['c']) 41 elif host_machine.system() == 'netbsd' 42 add_project_arguments('-D_OPENBSD_SOURCE', language: ['c']) 43 else 44 add_project_arguments('-D_GNU_SOURCE', language: ['c']) 45 endif 46 47 cc = meson.get_compiler('c') 48 49 # Replacement for XORG_DEFAULT_OPTIONS 50 if cc.has_argument('-fno-strict-aliasing') 51 add_project_arguments('-fno-strict-aliasing', language: 'c') 52 endif 53 54 extra_sources = [] 55 56 # Use POSIX strnlen or the implementation supplied in this module 57 have_strnlen = cc.has_function('strnlen') 58 conf.set('HAVE_STRNLEN', have_strnlen ? '1' : false, 59 description: 'Define to 1 if you have a working strnlen function.') 60 if not have_strnlen 61 extra_sources += ['strnlen.h', 'strnlen.c'] 62 endif 63 64 # Obtain compiler/linker options for xlsclients dependencies 65 dep_libxcb = dependency('xcb', required: true, version: '>= 1.6') 66 deps = [dep_libxcb] 67 68 config_h = configure_file(output: 'config.h', configuration: conf) 69 add_project_arguments('-DHAVE_CONFIG_H', language: ['c']) 70 71 executable( 72 'xlsclients', 73 [config_h, 'xlsclients.c', extra_sources], 74 dependencies: deps, 75 install: true 76 ) 77 78 # Man page 79 prog_sed = find_program('sed') 80 81 custom_target( 82 'xlsclients.man', 83 input: 'man/xlsclients.man', 84 output: 'xlsclients.1', 85 command: [ 86 prog_sed, 87 '-e', f's/__xorgversion__/"@package_string@" "X Version 11"/', 88 '-e', 's/__appmansuffix__/1/g', 89 '-e', 's/__miscmansuffix__/7/g', 90 '@INPUT@', 91 ], 92 capture: true, 93 install: true, 94 install_dir: get_option('mandir') / 'man1', 95 install_tag: 'man', 96 ) 97