Home | History | Annotate | Line # | Download | only in dist
      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   'xrefresh',
     27  1.1  mrg   'c',
     28  1.1  mrg   version: '1.1.1',
     29  1.1  mrg   license: 'MIT-open-group AND SMLNJ',
     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     system_extensions = '-D__EXTENSIONS__'
     41  1.1  mrg elif host_machine.system() == 'netbsd'
     42  1.1  mrg     system_extensions = '-D_OPENBSD_SOURCE'
     43  1.1  mrg else
     44  1.1  mrg     system_extensions = '-D_GNU_SOURCE'
     45  1.1  mrg endif
     46  1.1  mrg add_project_arguments(system_extensions, language: ['c'])
     47  1.1  mrg 
     48  1.1  mrg cc = meson.get_compiler('c')
     49  1.1  mrg 
     50  1.1  mrg # Replacement for XORG_DEFAULT_OPTIONS
     51  1.1  mrg if cc.has_argument('-fno-strict-aliasing')
     52  1.1  mrg   add_project_arguments('-fno-strict-aliasing', language: 'c')
     53  1.1  mrg endif
     54  1.1  mrg 
     55  1.1  mrg # Checks for pkg-config packages
     56  1.1  mrg dep_libx11 = dependency('x11', required: true)
     57  1.1  mrg dep_xproto = dependency('xproto', required: true, version: '>= 7.0.25')
     58  1.1  mrg deps = [dep_libx11, dep_xproto]
     59  1.1  mrg 
     60  1.1  mrg config_h = configure_file(output: 'config.h', configuration: conf)
     61  1.1  mrg add_project_arguments('-DHAVE_CONFIG_H', language: ['c'])
     62  1.1  mrg 
     63  1.1  mrg executable(
     64  1.1  mrg   'xrefresh',
     65  1.1  mrg   [config_h, 'xrefresh.c'],
     66  1.1  mrg   dependencies: deps,
     67  1.1  mrg   install: true
     68  1.1  mrg )
     69  1.1  mrg 
     70  1.1  mrg # Man page
     71  1.1  mrg prog_sed = find_program('sed')
     72  1.1  mrg 
     73  1.1  mrg custom_target(
     74  1.1  mrg   'xrefresh.man',
     75  1.1  mrg   input: 'man/xrefresh.man',
     76  1.1  mrg   output: 'xrefresh.1',
     77  1.1  mrg   command: [
     78  1.1  mrg     prog_sed,
     79  1.1  mrg     '-e', f's/__xorgversion__/"@package_string@" "X Version 11"/',
     80  1.1  mrg     '-e', 's/__libmansuffix__/3/g',
     81  1.1  mrg     '-e', 's/__miscmansuffix__/7/g',
     82  1.1  mrg     '@INPUT@',
     83  1.1  mrg   ],
     84  1.1  mrg   capture: true,
     85  1.1  mrg   install: true,
     86  1.1  mrg   install_dir: get_option('mandir') / 'man1',
     87  1.1  mrg   install_tag: 'man',
     88  1.1  mrg )
     89