summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-11-04 15:40:40 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-11-08 11:49:50 -0800
commitc0888158e30bfcd0ae6881b9d78c8122ce2d5f4e (patch)
treeea790d63960d82b68ae3013c074d007fd78b9907
parent752d9cbc0efc51bdef2ea25fba2b92974327f6a6 (diff)
Add a meson build system
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--.gitlab-ci.yml91
-rw-r--r--Makefile.am2
-rw-r--r--meson.build31
-rw-r--r--src/Makefile.am2
-rw-r--r--src/meson.build46
5 files changed, 159 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c88f6cd..eb5cbbf 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 185ede0e9b9b1924b92306ab8b882a6294e92613 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
include:
@@ -30,8 +30,8 @@ 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'
+ FDO_DISTRIBUTION_TAG: '2023-11-04.0'
+ FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool make meson ninja jq xorg-util-macros xorgproto libx11'
#
@@ -79,20 +79,89 @@ container-prep:
variables:
GIT_STRATEGY: none
-
#
-# The default build, runs on the image built above.
+# Builds run on the image built above.
#
-build:
+
+meson:
+ extends:
+ - .fdo.distribution-image@arch
stage: build
+ script:
+ - mkdir -p ../_inst
+ - meson setup builddir --prefix="$PWD/../_inst" -Dwarning_level=3
+ - meson configure builddir
+ - ninja -C builddir test
+ - ninja -C builddir install
+
+autotools:
extends:
- .fdo.distribution-image@arch
+ stage: build
script:
+ - mkdir -p ../_inst _build
- autoreconf -ivf
- - mkdir _builddir
- - pushd _builddir > /dev/null
- - ../configure --disable-silent-rules
- - make
+ - pushd _build
+ - ../configure --prefix="$PWD/../_inst"
- make check
+ - make install
- make distcheck
- - popd > /dev/null
+ - mv libxkbfile*.tar.gz ..
+ - popd
+ artifacts:
+ paths:
+ - libxkbfile*.tar.gz
+
+meson from tarball:
+ extends:
+ - .fdo.distribution-image@arch
+ stage: test
+ script:
+ - mkdir -p _tarball_build
+ - tar xf libxkbfile-*.tar.gz -C _tarball_build
+ - pushd _tarball_build/libxkbfile-*
+ - meson setup builddir
+ - meson configure builddir
+ - ninja -C builddir test
+ needs:
+ - autotools
+ variables:
+ GIT_STRATEGY: none
+
+#
+# Unlike the xproto version this was copied from, this just compares
+# the ls output to make sure the same files were installed, since
+# comparing file contents lists mismatches with the ELF binaries and
+# in the generated pkg-config files that are not issues here.
+#
+compare meson and autotools:
+ extends:
+ - .fdo.distribution-image@arch
+ stage: test
+ script:
+ - mkdir -p $PWD/_meson_inst
+ - mkdir -p $PWD/_autotools_inst
+ # the prefix ends up in the pkgconfig files, so we use a symlink
+ # to use the same --prefix for meson and autotools
+ - ln -sf $PWD/_meson_inst $PWD/_inst
+ - meson setup builddir --prefix=$PWD/_inst
+ - ninja -C builddir install
+ - ls -R _inst > _meson_inst.ls
+ - rm $PWD/_inst
+ - ln -sf $PWD/_autotools_inst $PWD/_inst
+ - autoreconf -ivf
+ - ./configure --prefix=$PWD/_inst --enable-shared --disable-static
+ - make && make install
+ - rm -f $PWD/_inst/lib/lib*.la
+ - ls -R _inst > _autotools_inst.ls
+ - diff -u $PWD/_meson_inst.ls $PWD/_autotools_inst.ls
+
+check versions are in sync:
+ extends:
+ - .fdo.distribution-image@arch
+ stage: test
+ script:
+ - autoreconf -ivf
+ - ./configure --version | head -n 1 | sed -e 's/libxkbfile 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 f9a6071..f97c31b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,4 +36,4 @@ ChangeLog:
dist-hook: ChangeLog INSTALL
-EXTRA_DIST = README.md
+EXTRA_DIST = README.md meson.build
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..d5011dc
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,31 @@
+project('libxkbfile', 'c',
+ version: '1.1.2',
+ meson_version: '>= 0.57.0',
+ license: 'MIT'
+)
+
+cc = meson.get_compiler('c')
+
+cc_conf = configuration_data({
+ 'HAVE_STRCASECMP': cc.has_function('strcasecmp') ? '1' : false,
+ 'HAVE_STRNDUP': cc.has_function('strndup') and
+ cc.has_header_symbol('string.h', 'strndup') ? '1' : false,
+ 'HAVE_UNLOCKED_STDIO': cc.has_function('getc_unlocked') ? '1' : false
+})
+configure_file(output: 'config.h',
+ configuration: cc_conf)
+
+pc_conf = configuration_data({
+ 'prefix': get_option('prefix'),
+ 'exec_prefix': '${prefix}',
+ 'libdir': '${exec_prefix}' / get_option('libdir'),
+ 'includedir': '${prefix}' / get_option('includedir'),
+ 'PACKAGE_VERSION': meson.project_version()
+})
+configure_file(output: 'xkbfile.pc',
+ input: 'xkbfile.pc.in',
+ install: true,
+ install_dir: get_option('libdir') / 'pkgconfig',
+ configuration: pc_conf)
+
+subdir('src')
diff --git a/src/Makefile.am b/src/Makefile.am
index 647359b..bd22c54 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,4 +31,4 @@ libxkbfileinclude_HEADERS = \
$(top_srcdir)/include/X11/extensions/XKMformat.h\
$(top_srcdir)/include/X11/extensions/XKBfile.h
-EXTRA_DIST = magic
+EXTRA_DIST = magic meson.build
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..30f405f
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,46 @@
+libxkbfile_sources = [
+ 'cout.c',
+ 'maprules.c',
+ 'srvmisc.c',
+ 'xkbatom.c',
+ 'xkbbells.c',
+ 'xkbconfig.c',
+ 'xkbdraw.c',
+ 'xkberrs.c',
+ 'XKBfileInt.h',
+ 'xkbmisc.c',
+ 'xkbout.c',
+ 'xkbtext.c',
+ 'xkmout.c',
+ 'xkmread.c'
+]
+
+deps = [
+ dependency('kbproto'),
+ dependency('x11')
+]
+
+includes = include_directories(
+ '../include/',
+ '../include/X11/extensions/'
+)
+
+library('xkbfile',
+ dependencies: deps,
+ include_directories: includes,
+ install: true,
+ sources: libxkbfile_sources,
+ version: '1.0.2'
+)
+
+libxkbfile_headers = [
+ '../include/X11/extensions/XKM.h',
+ '../include/X11/extensions/XKBrules.h',
+ '../include/X11/extensions/XKBbells.h',
+ '../include/X11/extensions/XKBconfig.h',
+ '../include/X11/extensions/XKMformat.h',
+ '../include/X11/extensions/XKBfile.h'
+]
+install_headers(libxkbfile_headers,
+ subdir: 'X11' / 'extensions')
+