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   'libXxf86dga',
     27   'c',
     28   version: '1.1.7',
     29   license: '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_xproto       = dependency('xproto', required: true)
     45 dep_libx11       = dependency('x11', required: true, version: '>= 1.6')
     46 dep_xextproto    = dependency('xextproto', required: true)
     47 dep_libxext      = dependency('xext', required: true)
     48 dep_xf86dgaproto = dependency('xf86dgaproto', required: true,
     49                               version: '>= 2.0.99.2')
     50 
     51 lib = library(
     52   'Xxf86dga',
     53   ['src/XF86DGA.c', 'src/XF86DGA2.c'],
     54   include_directories: 'include',
     55   dependencies: [dep_xproto, dep_libx11, dep_xextproto, dep_libxext, dep_xf86dgaproto],
     56   version: '1.0.0',
     57   install: true,
     58 )
     59 
     60 install_headers(
     61   'include/X11/extensions/Xxf86dga.h',
     62   'include/X11/extensions/xf86dga1.h',
     63   subdir: 'X11/extensions',
     64 )
     65 
     66 pkg = import('pkgconfig')
     67 pkg.generate(
     68   name: 'Xxf86dga',
     69   description: 'XFree86 Direct Graphics Access Extension Library',
     70   filebase: 'xxf86dga',
     71   libraries: '-L${libdir} -lXxf86dga',
     72   requires: ['xf86dgaproto'],
     73   requires_private: [dep_libx11, dep_libxext],
     74   url: 'https://gitlab.freedesktop.org/xorg/lib/libxxf86dga/'
     75 )
     76 
     77 prog_sed = find_program('sed')
     78 
     79 libXxf86dga_manpages = [
     80   'XDGA',
     81   'XF86DGA',
     82   'XFree86-DGA',
     83   'XDGAQueryExtension',
     84   'XDGAQueryVersion',
     85   'XDGAQueryModes',
     86   'XDGASetMode',
     87   'XDGAOpenFramebuffer',
     88   'XDGACloseFramebuffer',
     89   'XDGASetViewport',
     90   'XDGAInstallColormap',
     91   'XDGACreateColormap',
     92   'XDGASelectInput',
     93   'XDGAFillRectangle',
     94   'XDGACopyArea',
     95   'XDGACopyTransparentArea',
     96   'XDGAGetViewportStatus',
     97   'XDGASync',
     98   'XDGASetClientVersion',
     99   'XDGAChangePixmapMode',
    100   'XDGAKeyEventToXKeyEvent'
    101 ]
    102 
    103 lib_man_suffix = get_option('lib_man_suffix')
    104 foreach man: libXxf86dga_manpages
    105   custom_target(
    106     f'@man@.man',
    107     input: f'man/@man@.man',
    108     output: f'@man@.@lib_man_suffix@',
    109     command: [
    110       prog_sed,
    111       '-e', 's/__vendorversion__/"libXxf86dga @0@" "X Version 11"/'.format(meson.project_version()),
    112       '-e', 's/__appmansuffix__/1/g',
    113       '-e', 's/__filemansuffix__/5/g',
    114       '-e', f's/__libmansuffix__/@lib_man_suffix@/g',
    115       '-e', 's/__xservername__/Xorg/g',
    116       '-e', 's/__xconfigfile__/xorg.conf/g',
    117       '@INPUT@',
    118     ],
    119     capture: true,
    120     install: true,
    121     install_dir: get_option('prefix') / get_option('mandir') / f'man@lib_man_suffix@',
    122   )
    123 endforeach
    124