Home | History | Annotate | Line # | Download | only in dist
      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   'xgamma',
     27   'c',
     28   version: '1.0.8',
     29   license: 'X11',
     30   license_files: 'COPYING',
     31   meson_version: '>= 1.1.0',
     32 )
     33 
     34 package_string = ' '.join(meson.project_name(), meson.project_version())
     35 conf = configuration_data()
     36 conf.set_quoted('PACKAGE_STRING', package_string)
     37 
     38 cc = meson.get_compiler('c')
     39 
     40 # Replacement for XORG_DEFAULT_OPTIONS
     41 if cc.has_argument('-fno-strict-aliasing')
     42   add_project_arguments('-fno-strict-aliasing', language: 'c')
     43 endif
     44 
     45 conf.set('HAVE_STRTOF', cc.has_function('strtof') ? '1' : false)
     46 
     47 # Checks for pkg-config packages
     48 dep_libx11     = dependency('x11', required: true)
     49 dep_libxxf86vm = dependency('xxf86vm', required: true)
     50 dep_xproto     = dependency('xproto', required: true, version: '>= 7.0.17')
     51 deps = [dep_libx11, dep_libxxf86vm, dep_xproto]
     52 
     53 config_h = configure_file(output: 'config.h', configuration: conf)
     54 add_project_arguments('-DHAVE_CONFIG_H', language: ['c'])
     55 
     56 executable(
     57   'xgamma',
     58   [config_h, 'xgamma.c'],
     59   dependencies: deps,
     60   install: true
     61 )
     62 
     63 # Man page
     64 prog_sed = find_program('sed')
     65 
     66 custom_target(
     67   'xgamma.man',
     68   input: 'man/xgamma.man',
     69   output: 'xgamma.1',
     70   command: [
     71     prog_sed,
     72     '-e', 's/__vendorversion__/"@0@" "X Version 11"/'.format(package_string),
     73     '-e', 's/__appmansuffix__/1/g',
     74     '-e', 's/__libmansuffix__/3/g',
     75     '-e', 's/__filemansuffix__/5/g',
     76     '-e', 's/__miscmansuffix__/7/g',
     77     '@INPUT@',
     78   ],
     79   capture: true,
     80   install: true,
     81   install_dir: get_option('mandir') / 'man1',
     82 )
     83