diff options
-rw-r--r-- | .gitlab-ci.yml | 91 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | meson.build | 123 | ||||
-rw-r--r-- | meson.options | 2 | ||||
-rw-r--r-- | xxf86dga.pc.in | 7 |
5 files changed, 216 insertions, 9 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff7d188..7053e24 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,9 +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-17.0' - FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool make xorg-util-macros xorgproto libx11 libxext' - + FDO_DISTRIBUTION_TAG: '2025-02-15.0' + # minimal set of packages required to build and install either way + BASE_PACKAGES: 'git gcc clang pkgconf xorgproto libx11 libxext' + # packages needed to build and install with each set of tools + AUTOTOOLS_PACKAGES: 'autoconf automake libtool 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 # # Verify that commit messages are as expected @@ -81,9 +87,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 @@ -95,4 +101,79 @@ build: - make - make check - make distcheck + - mv libXxf86dga*.tar.gz .. - popd > /dev/null + artifacts: + paths: + - libXxf86dga*.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 test -C _builddir + - meson install -C _builddir + +# 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 libXxf86dga-*.tar.gz -C _tarball_build + - cd _tarball_build/libXxf86dga-* + - 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: + - mkdir -p $PWD/_meson_inst $PWD/_autotools_inst + - CFLAGS="-O2" + meson setup builddir --prefix=/usr --buildtype=plain + -Ddefault_library=shared + - meson compile -C builddir -v + - DESTDIR=$PWD/_meson_inst meson install -C builddir + - ./autogen.sh --prefix=/usr --enable-shared --disable-static + CFLAGS="-O2 -D_FILE_OFFSET_BITS=64" + - make V=1 && make install DESTDIR=$PWD/_autotools_inst + # get rid of expected differences between the two + - rm -f $PWD/_autotools_inst/usr/lib/lib*.la + - rm -f $PWD/_autotools_inst/usr/lib/libXxf86dga.so + - ln -s libXxf86dga.so.1 $PWD/_autotools_inst/usr/lib/libXxf86dga.so + - sed -i -e 's/{exec_prefix}/{prefix}/' -e '/exec_prefix/d' + _autotools_inst/usr/lib/pkgconfig/xxf86dga.pc + - 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/libXxf86dga 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 d8de3e6..15922ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,4 +15,4 @@ ChangeLog: dist-hook: ChangeLog INSTALL -EXTRA_DIST = README.md +EXTRA_DIST = README.md meson.build meson.options diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..1982ec9 --- /dev/null +++ b/meson.build @@ -0,0 +1,123 @@ +# SPDX-License-Identifier: MIT +# +# Copyright (c) 2025, 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( + 'libXxf86dga', + 'c', + version: '1.1.6', + license: 'X11', + license_files: 'COPYING', + meson_version: '>= 1.1.0', +) + +# Replacement for XORG_DEFAULT_OPTIONS +cc = meson.get_compiler('c') +if cc.has_argument('-fno-strict-aliasing') + add_project_arguments('-fno-strict-aliasing', language: 'c') +endif + +# Replacement for XORG_CHECK_MALLOC_ZERO +add_project_arguments('-DMALLOC_0_RETURNS_NULL', language: 'c') + +# Obtain compiler/linker options for dependencies +dep_xproto = dependency('xproto', required: true) +dep_libx11 = dependency('x11', required: true, version: '>= 1.6') +dep_xextproto = dependency('xextproto', required: true) +dep_libxext = dependency('xext', required: true) +dep_xf86dgaproto = dependency('xf86dgaproto', required: true, + version: '>= 2.0.99.2') + +lib = library( + 'Xxf86dga', + ['src/XF86DGA.c', 'src/XF86DGA2.c'], + include_directories: 'include', + dependencies: [dep_xproto, dep_libx11, dep_xextproto, dep_libxext, dep_xf86dgaproto], + version: '1.0.0', + install: true, +) + +install_headers( + 'include/X11/extensions/Xxf86dga.h', + 'include/X11/extensions/xf86dga1.h', + subdir: 'X11/extensions', +) + +pkg = import('pkgconfig') +pkg.generate( + name: 'Xxf86dga', + description: 'XFree86 Direct Graphics Access Extension Library', + filebase: 'xxf86dga', + libraries: '-L${libdir} -lXxf86dga', + requires: ['xf86dgaproto'], + requires_private: [dep_libx11, dep_libxext], + url: 'https://gitlab.freedesktop.org/xorg/lib/libxxf86dga/' +) + +prog_sed = find_program('sed') + +libXxf86dga_manpages = [ + 'XDGA', + 'XF86DGA', + 'XFree86-DGA', + 'XDGAQueryExtension', + 'XDGAQueryVersion', + 'XDGAQueryModes', + 'XDGASetMode', + 'XDGAOpenFramebuffer', + 'XDGACloseFramebuffer', + 'XDGASetViewport', + 'XDGAInstallColormap', + 'XDGACreateColormap', + 'XDGASelectInput', + 'XDGAFillRectangle', + 'XDGACopyArea', + 'XDGACopyTransparentArea', + 'XDGAGetViewportStatus', + 'XDGASync', + 'XDGASetClientVersion', + 'XDGAChangePixmapMode', + 'XDGAKeyEventToXKeyEvent' +] + +lib_man_suffix = get_option('lib_man_suffix') +foreach man: libXxf86dga_manpages + custom_target( + f'@man@.man', + input: f'man/@man@.man', + output: f'@man@.@lib_man_suffix@', + command: [ + prog_sed, + '-e', 's/__vendorversion__/"libXxf86dga @0@" "X Version 11"/'.format(meson.project_version()), + '-e', 's/__appmansuffix__/1/g', + '-e', 's/__filemansuffix__/5/g', + '-e', f's/__libmansuffix__/@lib_man_suffix@/g', + '-e', 's/__xservername__/Xorg/g', + '-e', 's/__xconfigfile__/xorg.conf/g', + '@INPUT@', + ], + capture: true, + install: true, + install_dir: get_option('prefix') / get_option('mandir') / f'man@lib_man_suffix@', + ) +endforeach diff --git a/meson.options b/meson.options new file mode 100644 index 0000000..d33ae43 --- /dev/null +++ b/meson.options @@ -0,0 +1,2 @@ +option('lib_man_suffix', type : 'string', value : '3', + description : 'Suffix for library man pages') diff --git a/xxf86dga.pc.in b/xxf86dga.pc.in index 30d2912..71cf8d3 100644 --- a/xxf86dga.pc.in +++ b/xxf86dga.pc.in @@ -1,12 +1,13 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ -libdir=@libdir@ includedir=@includedir@ +libdir=@libdir@ Name: Xxf86dga Description: XFree86 Direct Graphics Access Extension Library +URL: https://gitlab.freedesktop.org/xorg/lib/libxxf86dga/ Version: @VERSION@ Requires: xf86dgaproto -Requires.private: x11 xext -Cflags: -I${includedir} +Requires.private: x11 >= 1.6, xext Libs: -L${libdir} -lXxf86dga +Cflags: -I${includedir} |