fontconfig: Branch 'main' - 3 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 30 11:13:44 UTC 2025


 autogen.sh                 |    2 -
 configure.ac               |    6 ++++
 doc/Makefile.am            |    4 ++-
 doc/cache-version.sgml.in  |   24 ++++++++++++++++++
 doc/check-missing-doc      |   25 +++----------------
 doc/check-missing-doc.py   |   58 +++++++++++++++++++++++++++++++++++++++++++++
 doc/fontconfig-user.sgml   |    3 +-
 doc/meson.build            |   10 ++++++-
 fc-fontations/meson.build  |    4 +--
 fontconfig/fontconfig.h.in |    2 -
 fontconfig/meson.build     |    5 +++
 meson.build                |    6 +++-
 src/Makefile.am            |    5 ++-
 13 files changed, 121 insertions(+), 33 deletions(-)

New commits:
commit 685f2ec4a7e3204c1afd0a76e4cfe76b67c31fd9
Merge: 78e0166 d46ff1e
Author: Akira TAGOH <akira at tagoh.org>
Date:   Fri May 30 11:13:40 2025 +0000

    Merge branch 'issues/473' into 'main'
    
    Do not hardcode a cache version
    
    Closes #473
    
    See merge request fontconfig/fontconfig!417

commit d46ff1e6f09627431fe9afd23c9cd54ccb72851d
Author: Akira TAGOH <akira at tagoh.org>
Date:   Fri May 30 19:25:28 2025 +0900

    Do not hardcode a cache version
    
    This change aims to avoid a human-error that
    forget an update of the cache version when bumping.
    
    Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/473

diff --git a/autogen.sh b/autogen.sh
index 1d31465..d45f679 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -39,7 +39,7 @@ ORIGDIR=`pwd`
 cd $srcdir
 PROJECT=Fontconfig
 TEST_TYPE=-f
-FILE=fontconfig/fontconfig.h
+FILE=fontconfig/fontconfig.h.in
 LIBTOOLIZE=${LIBTOOLIZE-libtoolize}
 AUTOPOINT=${AUTOPOINT-autopoint}
 AUTORECONF=${AUTORECONF-autoreconf}
diff --git a/configure.ac b/configure.ac
index 215537f..ea6382f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,10 @@ dnl Initialize libtool
 LT_PREREQ([2.2])
 LT_INIT([disable-static win32-dll])
 
+dnl cache version
+CACHE_VERSION=9
+AC_SUBST(CACHE_VERSION)
+
 dnl libtool versioning
 
 dnl bump revision when fixing bugs
@@ -850,7 +854,9 @@ fc-pattern/Makefile
 fc-query/Makefile
 fc-scan/Makefile
 fc-validate/Makefile
+fontconfig/fontconfig.h
 doc/Makefile
+doc/cache-version.sgml
 doc/version.sgml
 its/Makefile
 po/Makefile.in
diff --git a/doc/Makefile.am b/doc/Makefile.am
index aac0f05..26af0a1 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -122,6 +122,7 @@ BUILT_DOCS =		\
 	$(NULL)
 DOCS_DEPS =			\
 	$(DOC_FUNCS_SGML)	\
+	cache-version.sgml	\
 	confdir.sgml		\
 	version.sgml		\
 	$(NULL)
@@ -178,7 +179,7 @@ BUILT_SOURCES +=		\
 	$(AM_V_GEN) $(RM) $@; \
 	$(DOC2HTML) -u $*.sgml > $@
 ##
-fonts-conf.5: local-fontconfig-user.sgml version.sgml confdir.sgml
+fonts-conf.5: local-fontconfig-user.sgml cache-version.sgml version.sgml confdir.sgml
 	$(AM_V_GEN) $(RM) $@; \
 	$(DOC2MAN) local-fontconfig-user.sgml && \
 	$(RM) manpage.*
diff --git a/doc/cache-version.sgml.in b/doc/cache-version.sgml.in
new file mode 100644
index 0000000..53eb6e3
--- /dev/null
+++ b/doc/cache-version.sgml.in
@@ -0,0 +1,24 @@
+<!--  
+   fontconfig/doc/version.sgml.in
+  
+   Copyright © 2003 Keith Packard
+  
+   Permission to use, copy, modify, distribute, and sell this software and its
+   documentation for any purpose is hereby granted without fee, provided that
+   the above copyright notice appear in all copies and that both that
+   copyright notice and this permission notice appear in supporting
+   documentation, and that the name of the author(s) not be used in
+   advertising or publicity pertaining to distribution of the software without
+   specific, written prior permission.  The authors make no
+   representations about the suitability of this software for any purpose.  It
+   is provided "as is" without express or implied warranty.
+  
+   THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+   INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+   EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+   DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+   TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+   PERFORMANCE OF THIS SOFTWARE.
+-->
+ at CACHE_VERSION@
diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml
index e253dc4..b473a1f 100644
--- a/doc/fontconfig-user.sgml
+++ b/doc/fontconfig-user.sgml
@@ -1,4 +1,5 @@
 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
+<!ENTITY cacheversion SYSTEM "cache-version.sgml">
 <!ENTITY version SYSTEM "version.sgml">
 <!ENTITY confdir SYSTEM "confdir.sgml">
 ]>
@@ -338,7 +339,7 @@ a directory in the users home directory.  If 'prefix' is set to "xdg", the value
 The default directory is ``$XDG_CACHE_HOME/fontconfig'' and it contains the cache files
 named ``<literal><hash value></literal>-<literal><architecture></literal>.cache-<literal><version></literal>'',
 where <literal><version></literal> is the fontconfig cache file
-version number (currently 8).
+version number (currently &cacheversion;).
   </para></refsect2>
   <refsect2><title><literal><include ignore_missing="no" prefix="default"></literal></title><para>
 This element contains the name of an additional configuration file or
diff --git a/doc/meson.build b/doc/meson.build
index c127bb0..2093551 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -66,6 +66,12 @@ edit_sgml = find_program('edit-sgml.py')
 fontconfig_devel_sgml = fs.copyfile('fontconfig-devel.sgml')
 fontconfig_user_sgml = fs.copyfile('fontconfig-user.sgml')
 
+cacheversion_conf = configuration_data()
+cacheversion_conf.set('CACHE_VERSION', cacheversion)
+configure_file(output: 'cache-version.sgml',
+  input: 'cache-version.sgml.in',
+  configuration: cacheversion_conf)
+
 version_conf = configuration_data()
 version_conf.set('VERSION', meson.project_version())
 
diff --git a/fc-fontations/meson.build b/fc-fontations/meson.build
index 72651f3..2d7af87 100644
--- a/fc-fontations/meson.build
+++ b/fc-fontations/meson.build
@@ -4,7 +4,7 @@ if (fontations.enabled())
   rust = import('rust')
 
   generated_fontconfig = rust.bindgen(
-    input : '../fontconfig/fontconfig.h',
+    input : fontconfig_h,
     output : 'fontconfig.rs',
     include_directories : [ '../' ],
     args : [
@@ -59,4 +59,4 @@ if (fontations.enabled())
 
   )
 
-endif
\ No newline at end of file
+endif
diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h.in
similarity index 99%
rename from fontconfig/fontconfig.h
rename to fontconfig/fontconfig.h.in
index 891b6d4..8de558d 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h.in
@@ -69,7 +69,7 @@ typedef int            FcBool;
  * it means multiple copies of the font information.
  */
 
-#define FC_CACHE_VERSION_NUMBER 9
+#define FC_CACHE_VERSION_NUMBER @CACHE_VERSION@
 #define _FC_STRINGIFY_(s)       #s
 #define _FC_STRINGIFY(s)        _FC_STRINGIFY_ (s)
 #define FC_CACHE_VERSION        _FC_STRINGIFY (FC_CACHE_VERSION_NUMBER)
diff --git a/fontconfig/meson.build b/fontconfig/meson.build
new file mode 100644
index 0000000..1ad1e58
--- /dev/null
+++ b/fontconfig/meson.build
@@ -0,0 +1,5 @@
+fontconfig_h_conf = configuration_data()
+fontconfig_h_conf.set('CACHE_VERSION', cacheversion)
+fontconfig_h = configure_file(output: 'fontconfig.h',
+                              input: 'fontconfig.h.in',
+                              configuration: fontconfig_h_conf)
diff --git a/meson.build b/meson.build
index bdbb440..9001c25 100644
--- a/meson.build
+++ b/meson.build
@@ -25,6 +25,7 @@ curversion = fc_version_minor - 1
 libversion = '@0 at .@1 at .0'.format(soversion, curversion)
 defversion = '@0 at .@1@'.format(curversion, fc_version_micro)
 osxversion = curversion + 1
+cacheversion = '9'
 
 freetype_req = '>= 21.0.15'
 freetype_req_cmake = '>= 2.8.1'
@@ -481,9 +482,10 @@ fcstdint_h = fs.copyfile('src/fcstdint.h.in', 'fcstdint.h')
 makealias = files('src/makealias.py')[0]
 
 
+subdir('fontconfig')
 
 
-alias_input_headers = ['fontconfig/fontconfig.h', 'src/fcdeprecate.h', 'fontconfig/fcprivate.h']
+alias_input_headers = [fontconfig_h, 'src/fcdeprecate.h', 'fontconfig/fcprivate.h']
 if get_option('fontations').enabled()
   alias_input_headers += ['fontconfig/fcfontations.h']
 endif
@@ -595,7 +597,7 @@ install_data('fonts.dtd',
              install_tag: 'runtime')
 
 fc_headers = [
-  'fontconfig/fontconfig.h',
+  fontconfig_h,
   'fontconfig/fcfreetype.h',
   'fontconfig/fcprivate.h',
 ]
diff --git a/src/Makefile.am b/src/Makefile.am
index 390ca82..1811e56 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -71,6 +71,7 @@ uninstall-ms-import-lib:
 endif
 
 AM_CPPFLAGS = 						\
+	-I$(top_builddir)				\
 	-I$(top_srcdir)					\
 	-I$(top_srcdir)/src				\
 	$(FREETYPE_CFLAGS)				\
@@ -109,7 +110,7 @@ fcobjshash.gperf: Makefile stamp-fcobjshash.gperf
 	@$(MAKE) stamp-fcobjshash.gperf
 	@touch -r stamp-fcobjshash.gperf $@
 stamp-fcobjshash.gperf: fcobjshash.gperf.h fcobjs.h
-	$(AM_V_GEN) $(CPP) -I$(top_srcdir) $(CPPFLAGS) $< | \
+	$(AM_V_GEN) $(CPP) -I$(top_builddir) -I$(top_srcdir) $(CPPFLAGS) $< | \
 	$(SED) 's/^ *//;s/ *, */,/' | \
 	awk ' \
 		/CUT_OUT_BEGIN/ { no_write=1; next; }; \
@@ -178,7 +179,7 @@ uninstall-local: uninstall-ms-import-lib uninstall-libtool-import-lib
 endif
 
 PUBLIC_FILES = \
-	$(top_srcdir)/fontconfig/fontconfig.h \
+	$(top_builddir)/fontconfig/fontconfig.h \
 	$(top_srcdir)/src/fcdeprecate.h \
 	$(top_srcdir)/fontconfig/fcprivate.h
 
commit b480986ea5e13d9fe5f0a4cc20aa451e3a226cfe
Author: Akira TAGOH <akira at tagoh.org>
Date:   Fri May 30 19:22:31 2025 +0900

    doc: rewrite check-missing-doc in Python

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 389c64d..aac0f05 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -141,6 +141,7 @@ noinst_SCRIPTS =		\
 ##
 check_SCRIPTS =			\
 	check-missing-doc	\
+	check-missing-doc.py	\
 	check-whitespace-in-args	\
 	check-whitespace-in-args.py	\
 	$(NULL)
diff --git a/doc/check-missing-doc b/doc/check-missing-doc
index 195ec00..7bb0043 100644
--- a/doc/check-missing-doc
+++ b/doc/check-missing-doc
@@ -1,24 +1,7 @@
 #!/bin/sh
-header=fontconfig-header
-doc=fontconfig-doc
-trap "rm $header $doc"  0 1 15
-top_srcdir=${top_srcdir-".."}
-(
-cat $top_srcdir/fontconfig/*.h  | grep '^Fc' | 
- grep -v FcPublic | sed 's/[^a-zA-Z0-9].*//';
- cat $top_srcdir/fontconfig/*.h  | 
- sed -n 's/#define \(Fc[a-zA-Z]*\)(.*$/\1/p') |
- sort -u > $header
 
-grep '@FUNC[+]*@' $top_srcdir/doc/*.fncs |
-awk '{print $2}' |
-sort -u > $doc
+set -e
 
-if cmp $doc $header > /dev/null; then
-	exit 0
-fi
-
-echo \
-'Library Export							Documentation'
-diff -y $header $doc | grep '[<>]'
-exit 1
+top_srcdir=${top_srcdir:-..}
+top_builddir=${top_builddir:-..}
+${top_srcdir}/doc/check-missing-doc.py ${top_srcdir} ${top_builddir}
diff --git a/doc/check-missing-doc.py b/doc/check-missing-doc.py
new file mode 100755
index 0000000..1d5e0a5
--- /dev/null
+++ b/doc/check-missing-doc.py
@@ -0,0 +1,58 @@
+#! /usr/bin/env python3
+# Copyright (C) 2025 fontconfig Authors
+# SPDX-License-Identifier: HPND
+
+import argparse
+import glob
+import re
+import sys
+from pathlib import Path
+
+parser = argparse.ArgumentParser()
+parser.add_argument('srcdir')
+parser.add_argument('builddir')
+
+args = parser.parse_args()
+h_apis = []
+d_apis = []
+
+header_files = glob.glob(str(Path(args.builddir) / 'fontconfig' / '*.h')) + glob.glob(str(Path(args.srcdir) / 'fontconfig' / '*.h'))
+
+for fn in header_files:
+    with open(fn) as f:
+        for s in f:
+            if re.search(r'^Fc', s) and not re.search('FcPublic', s):
+                res = re.sub(r'[^a-zA-Z0-9].*', '', s)
+                h_apis += [res]
+            m = re.search(r'#\s*define\s+(Fc[a-zA-Z]+)\s*\(.*$', s)
+            if m:
+                h_apis += [m.group(1)]
+
+h_apis.sort()
+
+doc_files = glob.glob(str(Path(args.srcdir) / 'doc' / '*.fncs'))
+for fn in doc_files:
+    with open(fn) as f:
+        for s in f:
+            if re.search(r'@FUNC[+]*@', s):
+                d_apis += [s.split()[1]]
+
+d_apis.sort()
+
+missing_in_doc = list(set(h_apis) - set(d_apis))
+missing_in_header = list(set(d_apis) - set(h_apis))
+if len(missing_in_doc) == 0 and len(missing_in_header) == 0:
+    sys.exit(0)
+
+if len(missing_in_doc) > 0:
+    print('Missing API documentation:')
+    for s in missing_in_doc:
+        print(f'\t{s}')
+    print('')
+if len(missing_in_header) > 0:
+    print('API available in documentation only:')
+    for s in missing_in_header:
+        print(f'\t{s}')
+    print('')
+
+sys.exit(1)
diff --git a/doc/meson.build b/doc/meson.build
index f2d46c7..c127bb0 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -3,7 +3,7 @@ tests = []
 
 if host_machine.system() != 'windows'
   tests += [
-    'check-missing-doc',
+    'check-missing-doc.py',
     #    'check-whitespace-in-args'
   ]
   meson.add_dist_script(find_program('check-whitespace-in-args.py'), '@SOURCE_ROOT@/doc')
@@ -193,5 +193,5 @@ endif
 
 foreach script : tests
   py = find_program(script)
-  test(script, py)
+  test(script, py, args: [meson.project_source_root(), meson.project_build_root()])
 endforeach


More information about the Fontconfig mailing list