Home | History | Annotate | Line # | Download | only in dist
      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   'editres',
     27   'c',
     28   version: '1.1.1',
     29   license: '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 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 # Required dependencies
     46 dep_libxaw = dependency('xaw7', required: true)
     47 dep_libx11 = dependency('x11', required: true)
     48 dep_libxt  = dependency('xt', required: true, version: '>= 1.0.99.1')
     49 dep_libxmu = dependency('xmu', required: true, version: '>= 1.3.0')
     50 dep_xproto = dependency('xproto', required: true, version: '>= 7.0.17')
     51 deps = [dep_libxaw, dep_libx11, dep_libxt, dep_libxmu, dep_xproto]
     52 
     53 # Optional dependencies
     54 if get_option('xkb').enabled()
     55   dep_libxkbfile = dependency('xkbfile', required: true)
     56   deps += dep_libxkbfile
     57 endif
     58 conf.set('XKB', get_option('xkb').enabled() ? 1 : false,
     59          description: 'Define to use XkbStdBell')
     60 summary('xkb', get_option('xkb').enabled())
     61 
     62 config_h = configure_file(output: 'config.h', configuration: conf)
     63 add_project_arguments('-DHAVE_CONFIG_H', language: ['c'])
     64 
     65 add_project_arguments('-D_CONST_X_STRING', language: ['c'])
     66 
     67 editres_sources = [
     68   config_h,
     69   'actions.c',
     70   'comm.c',
     71   'editres.c',
     72   'editresP.h',
     73   'geometry.c',
     74   'handler.c',
     75   'setvalues.c',
     76   'svpopup.c',
     77   'utils.c',
     78   'widgets.c',
     79   'wtree.c',
     80 ]
     81 
     82 executable(
     83   'editres',
     84   editres_sources,
     85   dependencies: deps,
     86   install: true
     87 )
     88 
     89 # Find directory for installing app-defaults files
     90 appdefaultdir = get_option('appdefaultdir')
     91 if appdefaultdir == ''
     92   dep_libxt  = dependency('xt', required: true)
     93   appdefaultdir = dep_libxt.get_variable('appdefaultdir')
     94 endif
     95 summary('appdefaultdir', appdefaultdir)
     96 
     97 # App default files  (*.ad)
     98 install_data(
     99  ['app-defaults/Editres', 'app-defaults/Editres-color'],
    100  install_dir: appdefaultdir,
    101  install_tag: 'runtime',
    102 )
    103 
    104 # Man page
    105 prog_sed = find_program('sed')
    106 
    107 custom_target(
    108   'editres.man',
    109   input: 'man/editres.man',
    110   output: 'editres.1',
    111   command: [
    112     prog_sed,
    113     '-e', f's/__xorgversion__/"@package_string@" "X Version 11"/',
    114     '-e', 's/__appmansuffix__/1/g',
    115     '-e', 's/__miscmansuffix__/7/g',
    116     '-e', f's|__apploaddir__|@appdefaultdir@|g',
    117     '@INPUT@',
    118   ],
    119   capture: true,
    120   install: true,
    121   install_dir: get_option('mandir') / 'man1',
    122   install_tag: 'man',
    123 )
    124