Replace UUID file mechanism with per-directory 'map' attribute [v2]
The UUID files would be placed in each font directory to provide the
unique cache name, independent of path, for that directory. The UUID
files are undesireable for a couple of reasons:
1) They must be placed in the font directories to be useful. This
requires modifying the font directories themselves, introducing
potential visible timestamp changes when running multiple
applications, and makes the cache processing inconsistent between
applications with permission to write to the font directories and
applications without such permission.
2) The UUID contents were generated randomly, which makes the font
cache not reproducible across multiple runs.
One proposed fix for 2) is to make the UUID dependent on the font
directory path, but once we do that, we can simply use the font
directory path itself as the key as the original MD5-based font cache
naming mechanism did.
The goal of the UUID file mechanism was to fix startup time of
flatpaks; as the font path names inside the flatpak did not match the
font path names in the base system, the font cache would need to be
reconstructed the first time the flatpak was launched.
The new mechanism for doing this is to allow each '<dir>' element in
the configuration include a 'map' attribute. When looking for a cache
file for a particular directory, if the directory name starts with the
contents of the <dir> element, that portion of the name will be
replaced with the value of the 'map' attribute.
Outside of the flatpak, nothing need change -- fontconfig will build
cache files using real directory names.
Inside the flatpak, the custom fonts.conf file will now include
mappings such as this:
<dir map="/usr/share/fonts">/run/host/fonts</dir>
When scanning the directory /run/host/fonts/ttf, fontconfig will
use the name /usr/share/fonts/ttf as the source for building the cache
file name.
The existing FC_FILE replacement code used for the UUID-based
implementation continues to correctly adapt font path names seen by
applications.
v2:
Leave FcDirCacheCreateUUID stub around to avoid removing
public API function.
Document 'map' attribute of <dir> element in
fontconfig-user.sgml
Suggested-by: Akira TAGOH <akira@tagoh.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-10-30 00:39:05 +01:00
|
|
|
check_SCRIPTS=run-test.sh run-test-map.sh
|
2013-02-02 17:01:07 +01:00
|
|
|
TEST_EXTENSIONS = \
|
|
|
|
.sh \
|
|
|
|
$(NULL)
|
|
|
|
|
|
|
|
AM_TESTS_ENVIRONMENT= \
|
|
|
|
src=${srcdir}; export src; \
|
|
|
|
EXEEXT=${EXEEXT}; export EXEEXT; \
|
|
|
|
$(NULL)
|
|
|
|
|
2018-03-28 11:53:52 +02:00
|
|
|
BUILT_SOURCES = $(builddir)/out.expected
|
2017-11-20 12:50:34 +01:00
|
|
|
|
2013-02-02 17:01:07 +01:00
|
|
|
SH_LOG_COMPILER = sh
|
2019-03-22 08:45:09 +01:00
|
|
|
LOG_COMPILER = ${srcdir}/wrapper-script.sh
|
2003-03-01 06:55:17 +01:00
|
|
|
TESTS=run-test.sh
|
|
|
|
|
2018-05-11 15:15:39 +02:00
|
|
|
TESTDATA = \
|
|
|
|
4x6.pcf \
|
|
|
|
8x16.pcf \
|
|
|
|
fonts.conf.in \
|
2018-11-27 09:50:18 +01:00
|
|
|
test-60-generic.json \
|
2018-05-11 15:15:39 +02:00
|
|
|
test-90-synthetic.json \
|
|
|
|
$(NULL)
|
2003-03-02 08:28:24 +01:00
|
|
|
|
2017-11-20 12:50:34 +01:00
|
|
|
if FREETYPE_PCF_LONG_FAMILY_NAMES
|
2018-03-28 11:53:52 +02:00
|
|
|
$(builddir)/out.expected: $(srcdir)/out.expected-long-family-names Makefile
|
|
|
|
cp $(srcdir)/out.expected-long-family-names $(builddir)/out.expected
|
2017-11-20 12:50:34 +01:00
|
|
|
else
|
2018-03-28 11:53:52 +02:00
|
|
|
$(builddir)/out.expected: $(srcdir)/out.expected-no-long-family-names Makefile
|
|
|
|
cp $(srcdir)/out.expected-no-long-family-names $(builddir)/out.expected
|
2017-11-20 12:50:34 +01:00
|
|
|
endif
|
|
|
|
|
2013-01-10 16:01:52 +01:00
|
|
|
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
|
|
|
|
|
2013-10-11 12:31:22 +02:00
|
|
|
check_PROGRAMS =
|
2013-01-08 21:51:00 +01:00
|
|
|
if HAVE_PTHREAD
|
2013-09-02 13:52:20 +02:00
|
|
|
check_PROGRAMS += test-pthread
|
2013-01-08 21:51:00 +01:00
|
|
|
test_pthread_LDADD = $(top_builddir)/src/libfontconfig.la
|
|
|
|
# We don't enable this test by default because it will require config and fonts
|
|
|
|
# to meaningfully test anything, and we are not installed yet.
|
|
|
|
#TESTS += test-pthread
|
|
|
|
endif
|
2015-03-23 05:30:59 +01:00
|
|
|
check_PROGRAMS += test-bz89617
|
|
|
|
test_bz89617_CFLAGS = \
|
|
|
|
-DSRCDIR="\"$(abs_srcdir)\""
|
|
|
|
|
|
|
|
test_bz89617_LDADD = $(top_builddir)/src/libfontconfig.la
|
|
|
|
TESTS += test-bz89617
|
|
|
|
|
2017-06-12 06:36:56 +02:00
|
|
|
check_PROGRAMS += test-bz131804
|
|
|
|
test_bz131804_LDADD = $(top_builddir)/src/libfontconfig.la
|
|
|
|
TESTS += test-bz131804
|
|
|
|
|
2013-09-02 13:52:20 +02:00
|
|
|
noinst_PROGRAMS = $(check_PROGRAMS)
|
|
|
|
|
2013-10-11 12:31:22 +02:00
|
|
|
if !OS_WIN32
|
|
|
|
check_PROGRAMS += test-migration
|
2013-09-02 13:52:20 +02:00
|
|
|
test_migration_LDADD = $(top_builddir)/src/libfontconfig.la
|
2013-10-11 12:31:22 +02:00
|
|
|
endif
|
2013-01-08 21:51:00 +01:00
|
|
|
|
2016-07-08 07:16:49 +02:00
|
|
|
check_PROGRAMS += test-bz96676
|
|
|
|
test_bz96676_LDADD = $(top_builddir)/src/libfontconfig.la
|
|
|
|
TESTS += test-bz96676
|
|
|
|
|
2018-03-14 13:42:11 +01:00
|
|
|
check_PROGRAMS += test-name-parse
|
|
|
|
test_name_parse_LDADD = $(top_builddir)/src/libfontconfig.la
|
|
|
|
TESTS += test-name-parse
|
|
|
|
|
2018-05-11 14:39:50 +02:00
|
|
|
if ENABLE_JSONC
|
|
|
|
check_PROGRAMS += test-conf
|
|
|
|
test_conf_CFLAGS = $(JSONC_CFLAGS)
|
|
|
|
test_conf_LDADD = $(top_builddir)/src/libfontconfig.la $(JSONC_LIBS)
|
2018-05-11 15:15:39 +02:00
|
|
|
TESTS += run-test-conf.sh
|
2018-05-11 14:39:50 +02:00
|
|
|
endif
|
|
|
|
|
2018-05-25 08:24:44 +02:00
|
|
|
check_PROGRAMS += test-bz106618
|
|
|
|
test_bz106618_LDADD = $(top_builddir)/src/libfontconfig.la
|
|
|
|
|
2018-06-11 10:03:17 +02:00
|
|
|
check_PROGRAMS += test-bz106632
|
|
|
|
test_bz106632_CFLAGS = \
|
|
|
|
-I$(top_builddir) \
|
|
|
|
-I$(top_builddir)/src \
|
|
|
|
-I$(top_srcdir) \
|
|
|
|
-I$(top_srcdir)/src \
|
|
|
|
-DFONTFILE='"$(abs_top_srcdir)/test/4x6.pcf"' \
|
|
|
|
-DHAVE_CONFIG_H \
|
|
|
|
$(NULL)
|
|
|
|
test_bz106632_LDADD = $(top_builddir)/src/libfontconfig.la
|
|
|
|
TESTS += test-bz106632
|
2019-03-22 08:45:09 +01:00
|
|
|
endif
|
2018-06-11 10:03:17 +02:00
|
|
|
|
2018-09-28 11:08:52 +02:00
|
|
|
check_PROGRAMS += test-issue107
|
|
|
|
test_issue107_LDADD = \
|
|
|
|
$(top_builddir)/src/libfontconfig.la \
|
|
|
|
$(NULL)
|
|
|
|
TESTS += test-issue107
|
|
|
|
|
2018-09-04 11:08:37 +02:00
|
|
|
if !ENABLE_SHARED
|
2019-03-22 08:45:09 +01:00
|
|
|
if !OS_WIN32
|
2018-09-04 11:08:37 +02:00
|
|
|
check_PROGRAMS += test-issue110
|
|
|
|
test_issue110_CFLAGS = \
|
|
|
|
-I$(top_builddir) \
|
|
|
|
-I$(top_builddir)/src \
|
|
|
|
-I$(top_srcdir) \
|
|
|
|
-I$(top_srcdir)/src \
|
|
|
|
-DHAVE_CONFIG_H \
|
|
|
|
-DFONTCONFIG_PATH='"$(BASECONFIGDIR)"' \
|
|
|
|
$(NULL)
|
|
|
|
test_issue110_LDADD = \
|
|
|
|
$(top_builddir)/src/libfontconfig.la \
|
|
|
|
$(NULL)
|
|
|
|
TESTS += test-issue110
|
2018-09-05 14:08:52 +02:00
|
|
|
|
|
|
|
check_PROGRAMS += test-d1f48f11
|
|
|
|
test_d1f48f11_CFLAGS = \
|
|
|
|
-I$(top_builddir) \
|
|
|
|
-I$(top_builddir)/src \
|
|
|
|
-I$(top_srcdir) \
|
|
|
|
-I$(top_srcdir)/src \
|
|
|
|
-DHAVE_CONFIG_H \
|
|
|
|
-DFONTCONFIG_PATH='"$(BASECONFIGDIR)"' \
|
|
|
|
$(NULL)
|
|
|
|
test_d1f48f11_LDADD = \
|
|
|
|
$(top_builddir)/src/libfontconfig.la \
|
|
|
|
$(NULL)
|
|
|
|
TESTS += test-d1f48f11
|
2018-09-04 11:08:37 +02:00
|
|
|
endif
|
2019-03-22 08:45:09 +01:00
|
|
|
endif
|
2018-09-04 11:08:37 +02:00
|
|
|
|
2019-03-23 07:27:39 +01:00
|
|
|
EXTRA_DIST=run-test.sh run-test-conf.sh $(LOG_COMPILER) $(TESTDATA) out.expected-long-family-names out.expected-no-long-family-names
|
2003-10-27 11:44:13 +01:00
|
|
|
|
2018-08-29 12:01:45 +02:00
|
|
|
CLEANFILES=out out1 out2 fonts.conf out.expected
|
2012-10-06 23:52:39 +02:00
|
|
|
|
|
|
|
-include $(top_srcdir)/git.mk
|