summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml93
-rw-r--r--Makefile.am2
-rw-r--r--fontenc.pc.in7
-rw-r--r--meson.build117
-rw-r--r--meson.options27
5 files changed, 237 insertions, 9 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0bd5913..a557209 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -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-05-08.0'
- FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool make xorg-util-macros xorg-font-util zlib xorgproto'
+ 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 xorg-font-util zlib'
+ # 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
#
@@ -81,9 +88,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
@@ -91,8 +98,84 @@ build:
- autoreconf -ivf
- mkdir _builddir
- pushd _builddir > /dev/null
- - ../configure --disable-silent-rules --enable-unit-tests
+ - ../configure --disable-silent-rules
- make
- make check
- make distcheck
+ - mv libfontenc*.tar.gz ..
- popd > /dev/null
+ artifacts:
+ paths:
+ - libfontenc*.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 libfontenc-*.tar.gz -C _tarball_build
+ - cd _tarball_build/libfontenc-*
+ - 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/libfontenc.so
+ - ln -s libfontenc.so.1 $PWD/_autotools_inst/usr/lib/libfontenc.so
+ - sed -i -e 's/{exec_prefix}/{prefix}/' -e '/exec_prefix/d'
+ -e 's/\(Requires\.private:\)/\1 xproto >= 1.0.0,/'
+ _autotools_inst/usr/lib/pkgconfig/fontenc.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/libfontenc 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 28145c8..1633d48 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,4 +41,4 @@ lint:
(cd src && $(MAKE) $(MFLAGS) lint)
endif LINT
-EXTRA_DIST = README.md
+EXTRA_DIST = README.md meson.build meson.options
diff --git a/fontenc.pc.in b/fontenc.pc.in
index 7f70b59..74d479d 100644
--- a/fontenc.pc.in
+++ b/fontenc.pc.in
@@ -1,11 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
-libdir=@libdir@
includedir=@includedir@
+libdir=@libdir@
Name: fontenc
Description: The fontenc Library
+URL: https://gitlab.freedesktop.org/xorg/lib/libfontenc/
Version: @PACKAGE_VERSION@
-Cflags: -I${includedir}
-Libs: -L${libdir} -lfontenc
Requires.private: @Z_REQUIRES@
+Libs: -L${libdir} -lfontenc
+Cflags: -I${includedir}
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..d8f81a4
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,117 @@
+# 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(
+ 'libfontenc',
+ 'c',
+ version: '1.1.8',
+ license: 'MIT',
+ license_files: 'COPYING',
+ meson_version: '>= 1.1.0',
+)
+
+cc = meson.get_compiler('c')
+conf = configuration_data()
+
+# Replaces AC_USE_SYSTEM_EXTENSIONS
+if host_machine.system() == 'sunos'
+ system_extensions = '__EXTENSIONS__'
+elif host_machine.system() == 'netbsd'
+ system_extensions = '_OPENBSD_SOURCE'
+else
+ system_extensions = '_GNU_SOURCE'
+endif
+conf.set(system_extensions, 1,
+ description: 'Enable non-standardized system API extensions')
+
+# Replacement for XORG_DEFAULT_OPTIONS
+if cc.has_argument('-fno-strict-aliasing')
+ add_project_arguments('-fno-strict-aliasing', language: 'c')
+endif
+
+# Replaces XORG_FONTROOTDIR from xorg/font/util/fontutil.m4
+fontrootdir = get_option('with-fontrootdir')
+if fontrootdir == ''
+ fontutil_dep = dependency('fontutil', required: false)
+ if fontutil_dep.found() and fontutil_dep.type_name() == 'pkgconfig'
+ fontrootdir = fontutil_dep.get_variable(pkgconfig: 'fontrootdir')
+ endif
+ if fontrootdir == ''
+ fontrootdir = get_option('prefix') / get_option('datadir') / '/fonts/X11'
+ endif
+endif
+
+# Replaces XORG_FONTSUBDIR([ENCODINGSDIR],[encodingsdir],[encodings])
+encodingsdir = get_option('with-encodingsdir')
+if encodingsdir == ''
+ encodingsdir = fontrootdir / 'encodings'
+endif
+
+dep_zlib = dependency('zlib', required: true)
+dep_xproto = dependency('xproto', required: true, version: '>=1.0.0')
+
+libfontenc_sources = [
+ 'src/encparse.c',
+ 'src/fontenc.c'
+]
+
+# Replaces AC_REPLACE_FUNCS([reallocarray])
+has_reallocarray = cc.has_function(
+ 'reallocarray',
+ args: '-D' + system_extensions,
+ prefix: '#include <stdlib.h>'
+)
+if has_reallocarray
+ conf.set('HAVE_REALLOCARRAY', 1)
+else
+ libfontenc_sources += 'src/reallocarray.c'
+endif
+
+configure_file(configuration: conf, output: 'config.h')
+add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
+
+lib = library(
+ 'fontenc',
+ libfontenc_sources,
+ c_args: [
+ '-DFONT_ENCODINGS_DIRECTORY="' + encodingsdir + '/encodings.dir"',
+ ],
+ include_directories: 'include',
+ dependencies: [dep_xproto, dep_zlib],
+ version: '1.0.0',
+ install: true,
+)
+
+install_headers(
+ 'include/X11/fonts/fontenc.h',
+ subdir: 'X11/fonts',
+)
+
+pkg = import('pkgconfig')
+pkg.generate(
+ lib,
+ description: 'The fontenc Library',
+ filebase: 'fontenc',
+ url: 'https://gitlab.freedesktop.org/xorg/lib/libfontenc/'
+)
diff --git a/meson.options b/meson.options
new file mode 100644
index 0000000..900bec2
--- /dev/null
+++ b/meson.options
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+option('with-fontrootdir', type : 'string',
+ description : 'Path to root directory for font files')
+option('with-encodingsdir', type : 'string',
+ description : 'Path to encodings files')