summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2026-05-03 16:21:51 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2026-05-03 16:21:51 -0700
commita5e82d175ad068e28161f1d08f14aa8637b4d989 (patch)
treeb2fe676c32d1609900392d6e5095f1ba89dd512e /meson.build
parent3be29dd8249e2266963b0719d272670a67c9b465 (diff)
meson: Add option to build with meson
Also updates the gitlab CI config to test both build types and compare the generated output/installed files. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/app/xvinfo/-/merge_requests/6>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build79
1 files changed, 79 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..3216378
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,79 @@
+# SPDX-License-Identifier: MIT
+#
+# Copyright (c) 2026, Oracle and/or its affiliates.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+#
+
+project(
+ 'xvinfo',
+ 'c',
+ version: '1.1.5',
+ license: 'X11',
+ license_files: 'COPYING',
+ meson_version: '>= 1.1.0',
+)
+
+conf = configuration_data()
+package_string = ' '.join(meson.project_name(), meson.project_version())
+conf.set_quoted('PACKAGE_STRING', package_string)
+
+cc = meson.get_compiler('c')
+
+# Replacement for XORG_DEFAULT_OPTIONS
+if cc.has_argument('-fno-strict-aliasing')
+ add_project_arguments('-fno-strict-aliasing', language: 'c')
+endif
+
+# Checks for pkg-config packages
+dep_libxv = dependency('xv', required: true)
+dep_libx11 = dependency('x11', required: true)
+dep_xproto = dependency('xproto', required: true, version: '>= 7.0.25')
+deps = [dep_libxv, dep_libx11, dep_xproto]
+
+config_h = configure_file(output: 'config.h', configuration: conf)
+add_project_arguments('-DHAVE_CONFIG_H', language: ['c'])
+
+executable(
+ 'xvinfo',
+ [config_h, 'xvinfo.c'],
+ dependencies: deps,
+ install: true
+)
+
+# Man page
+prog_sed = find_program('sed')
+
+custom_target(
+ 'xvinfo.man',
+ input: 'man/xvinfo.man',
+ output: 'xvinfo.1',
+ command: [
+ prog_sed,
+ '-e', f's/__vendorversion__/"@package_string@" "X Version 11"/',
+ '-e', 's/__appmansuffix__/1/g',
+ '-e', 's/__miscmansuffix__/7/g',
+ '@INPUT@',
+ ],
+ capture: true,
+ install: true,
+ install_dir: get_option('mandir') / 'man1',
+ install_tag: 'man',
+)