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