summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2026-03-28 12:38:00 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2026-03-28 12:38:00 -0700
commitf68e3eb3e2f799a00ea27b0161aca576dc6b9793 (patch)
tree7f92fe6bda154425e8e40b722fa1779ea3d59ac0
parent4882c32dd96a19d529d07f7485e76db714d513ba (diff)
meson: Add option to build with mesonHEADmaster
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/xcb-demo/-/merge_requests/2>
-rw-r--r--.gitlab-ci.yml97
-rw-r--r--Makefile.am2
-rw-r--r--meson.build104
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/meson.build44
5 files changed, 243 insertions, 6 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d01c8e6..c5fc934 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,7 @@
# Please see the ci-templates documentation for details:
# https://freedesktop.pages.freedesktop.org/ci-templates/
-.templates_sha: &template_sha 34f4ade99434043f88e164933f570301fd18b125 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
+.templates_sha: &template_sha baa94a8f673dd1f11f81377106310752936d3672 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
include:
@@ -30,8 +30,15 @@ variables:
# The tag should be updated each time the list of packages is updated.
# Changing a tag forces the associated image to be rebuilt.
# Note: the tag has no meaning, we use a date format purely for readability
- FDO_DISTRIBUTION_TAG: '2022-07-18.1'
- FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake make libxcb xcb-util xcb-util-image xcb-util-wm xorgproto'
+ FDO_DISTRIBUTION_TAG: '2026-03-24.0'
+ # minimal set of packages required to build and install either way
+ BASE_PACKAGES: 'git gcc clang pkgconf libxcb xcb-util xcb-util-image xcb-util-wm xorgproto'
+ # packages needed to build and install with each set of tools
+ AUTOTOOLS_PACKAGES: 'autoconf automake make xorg-util-macros'
+ MESON_PACKAGES: 'meson ninja'
+ # extra packages we need for comparing autotools & meson builds
+ EXTRA_PACKAGES: 'diffoscope diffutils findutils jq'
+ FDO_DISTRIBUTION_PACKAGES: $BASE_PACKAGES $AUTOTOOLS_PACKAGES $MESON_PACKAGES $EXTRA_PACKAGES
#
@@ -66,9 +73,9 @@ container-prep:
#
-# The default build, runs on the image built above.
+# The autotools build, runs on the image built above.
#
-build:
+autotools:
stage: build
extends:
- .fdo.distribution-image@arch
@@ -80,4 +87,84 @@ build:
- make
- make check
- make distcheck
+ - mv xcb-demo-*.tar.gz ..
- popd > /dev/null
+ artifacts:
+ paths:
+ - xcb-demo-*.tar.gz
+
+#
+# The meson build, runs on the image built above.
+#
+.meson_build:
+ stage: build
+ extends:
+ - .fdo.distribution-image@arch
+ script:
+ - CC="${CC}" meson setup _builddir --prefix="$PWD/_install"
+ - meson compile -C _builddir
+ - meson install -C _builddir
+ - meson test -C _builddir
+ artifacts:
+ when: always
+ expire_in: 1 week
+ paths:
+ - _builddir/config.h
+ - _builddir/meson-logs/meson-log.txt
+
+# Run meson build with different compilers
+meson:
+ extends:
+ - .meson_build
+ parallel:
+ matrix:
+ - CC: ["gcc", "clang"]
+
+
+meson from tarball:
+ extends:
+ - .fdo.distribution-image@arch
+ stage: test
+ script:
+ - mkdir -p _tarball_build
+ - tar xf xcb-demo-*.tar.gz -C _tarball_build
+ - cd _tarball_build/xcb-demo-*
+ - meson setup _builddir
+ - meson compile -C _builddir
+ - meson test -C _builddir
+ needs:
+ - autotools
+
+compare meson and autotools:
+ extends:
+ - .fdo.distribution-image@arch
+ stage: test
+ script:
+ - srcdir=$PWD
+ - mkdir -p $PWD/{_autotools,_meson}{_build,_inst}
+ - cd _meson_build
+ - CFLAGS="-O2"
+ meson setup $srcdir --prefix=/usr --buildtype=plain
+ - meson compile -v
+ - DESTDIR=$srcdir/_meson_inst meson install
+ - cd ../_autotools_build
+ - $srcdir/autogen.sh --prefix=/usr
+ CFLAGS="-O2 -D_FILE_OFFSET_BITS=64 -ffile-prefix-map=${srcdir}=.."
+ LDFLAGS="-Wl,--as-needed"
+ - make V=1 && make install DESTDIR=${PWD%_build}_inst
+ - cd ..
+ # get rid of expected differences between the two
+ - find $PWD/_meson_inst $PWD/_autotools_inst
+ -exec touch -h -r $PWD/_meson_inst/ {} \+
+ - diffoscope --text-color=always _autotools_inst _meson_inst
+
+check versions are in sync:
+ extends:
+ - .fdo.distribution-image@arch
+ stage: test
+ script:
+ - autoreconf -ivf
+ - ./configure --version | head -n 1 | sed -e 's/xcb-demo configure //' > autotools.version
+ - meson introspect meson.build --projectinfo | jq -r '.version' > meson.version
+ - diff -u autotools.version meson.version ||
+ (echo "ERROR - autotools and meson versions not in sync" && false)
diff --git a/Makefile.am b/Makefile.am
index 0f0f715..024435d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = tests
-EXTRA_DIST = autogen.sh README
+EXTRA_DIST = autogen.sh README meson.build
AM_CPPFLAGS = $(XCB_CFLAGS)
LDADD = $(XCB_LIBS)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..8b29a81
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,104 @@
+# 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(
+ 'xcb-demo',
+ 'c',
+ version: '0.1',
+ meson_version: '>= 0.1',
+)
+
+dep_xcb = dependency('xcb', required: true)
+dep_xcbaux = dependency('xcb-aux', required: true, version: '>= 0.3.0')
+dep_xcbimage = dependency('xcb-image', required: true, version: '>= 0.3.0')
+dep_xcbicccm = dependency('xcb-icccm', required: true, version: '>= 0.3.0')
+dep_xcbatom = dependency('xcb-atom', required: true, version: '>= 0.3.0')
+dep_xcbdpms = dependency('xcb-dpms', required: true)
+dep_xcbrender = dependency('xcb-render', required: true)
+dep_xcbrandr = dependency('xcb-randr', required: true)
+dep_xcbxf86dri = dependency('xcb-xf86dri', required: true)
+dep_xcbxv = dependency('xcb-xv', required: true)
+
+dep_threads = dependency('threads')
+
+cc = meson.get_compiler('c')
+dep_libm = cc.find_library('m', required: false)
+
+executable(
+ 'hypnomoire',
+ ['hypnomoire.c', 'reply_formats.c', 'reply_formats.h'],
+ dependencies: [dep_xcbaux, dep_xcb, dep_libm, dep_threads],
+ install: true
+)
+
+executable(
+ 'xcbdpyinfo',
+ ['xcbdpyinfo.c'],
+ dependencies: [dep_xcb],
+ install: true
+)
+
+executable(
+ 'xcb-test',
+ ['xcb-test.c', 'reply_formats.c', 'reply_formats.h'],
+ dependencies: [dep_xcbaux, dep_xcb, dep_threads],
+ install: true
+)
+
+executable(
+ 'dpms',
+ ['dpms.c'],
+ dependencies: [dep_xcbdpms, dep_xcb],
+ install: true
+)
+
+executable(
+ 'rendertest',
+ ['rendertest.c'],
+ dependencies: [dep_xcbaux, dep_xcbrender, dep_xcb],
+ install: true
+)
+
+executable(
+ 'xcbrandr',
+ ['xcbrandr.c'],
+ dependencies: [dep_xcbaux, dep_xcbrandr, dep_xcb],
+ install: true
+)
+
+executable(
+ 'xcbxf86dri',
+ ['xcbxf86dri.c'],
+ dependencies: [dep_xcbxf86dri, dep_xcb],
+ install: true
+)
+
+executable(
+ 'xcbxvinfo',
+ ['xcbxvinfo.c'],
+ dependencies: [dep_xcbxv, dep_xcb],
+ install: true
+)
+
+subdir('tests')
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 318fcd5..8519b3a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,3 +14,5 @@ lissajoux_SOURCES = lissajoux.c lissajoux.h
flames_CFLAGS = -O3
flames_LDADD = $(XCBAUX_LIBS) $(XCBIMAGE_LIBS) $(XCBICCCM_LIBS) $(XCBATOM_LIBS)
flames_SOURCES = flames.c
+
+EXTRA_DIST = meson.build
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..09a18b8
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,44 @@
+# 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.
+#
+
+executable(
+ 'julia',
+ ['julia.c', 'julia.h'],
+ dependencies: [dep_xcbaux, dep_xcbimage, dep_xcbicccm, dep_xcbatom, dep_xcb],
+ install: true
+)
+
+executable(
+ 'lissajoux',
+ ['lissajoux.c', 'lissajoux.h'],
+ dependencies: [dep_xcbaux, dep_xcbimage, dep_xcb, dep_libm],
+ install: true
+)
+
+executable(
+ 'flames',
+ ['flames.c'],
+ dependencies: [dep_xcbaux, dep_xcbimage, dep_xcbicccm, dep_xcbatom, dep_xcb],
+ install: true
+)