1 # SPDX-License-Identifier: MIT 2 # 3 # Copyright (c) 2025, 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 'libXinerama', 27 'c', 28 version: '1.1.6', 29 license: 'MIT AND MIT-open-group AND X11', 30 license_files: 'COPYING', 31 meson_version: '>= 1.1.0', 32 ) 33 34 # Replacement for XORG_DEFAULT_OPTIONS 35 cc = meson.get_compiler('c') 36 if cc.has_argument('-fno-strict-aliasing') 37 add_project_arguments('-fno-strict-aliasing', language: 'c') 38 endif 39 40 # Replacement for XORG_CHECK_MALLOC_ZERO 41 add_project_arguments('-DMALLOC_0_RETURNS_NULL', language: 'c') 42 43 # Obtain compiler/linker options for dependencies 44 dep_libx11 = dependency('x11', required: true, version: '>= 1.6') 45 dep_libxext = dependency('xext', required: true) 46 dep_xextproto = dependency('xextproto', required: true) 47 dep_xineramaproto = dependency('xineramaproto', required: true, 48 version: '>= 1.1.99.1') 49 50 lib = library( 51 'Xinerama', 52 'src/Xinerama.c', 53 include_directories: 'include', 54 dependencies: [dep_libx11, dep_libxext, dep_xextproto, dep_xineramaproto], 55 version: '1.0.0', 56 install: true, 57 ) 58 59 install_headers( 60 ['include/X11/extensions/Xinerama.h', 61 'include/X11/extensions/panoramiXext.h'], 62 subdir: 'X11/extensions', 63 ) 64 65 pkg = import('pkgconfig') 66 pkg.generate( 67 lib, 68 description: 'The Xinerama Library', 69 filebase: 'xinerama', 70 requires: 'xineramaproto', 71 url: 'https://gitlab.freedesktop.org/xorg/lib/libxinerama/' 72 ) 73 74 prog_sed = find_program('sed') 75 76 lib_man_suffix = get_option('lib_man_suffix') 77 foreach man : ['Xinerama', 'XineramaQueryExtension', 'XineramaQueryVersion', 78 'XineramaIsActive', 'XineramaQueryScreens', ] 79 custom_target( 80 f'@man@.man', 81 input : f'man/@man@.man', 82 output : f'@man@.@lib_man_suffix@', 83 command : [ 84 prog_sed, 85 '-e', 's/__vendorversion__/"libXinerama @0@" "X Version 11"/'.format(meson.project_version()), 86 '-e', f's/__libmansuffix__/@lib_man_suffix@/g', 87 '@INPUT@', 88 ], 89 capture : true, 90 install : true, 91 install_dir : get_option('prefix') / get_option('mandir') / f'man@lib_man_suffix@', 92 ) 93 endforeach 94