Bug 29341 - Make some fontconfig paths configurable

Add configure options to set the directory to be installed:
  --with-templatedir for the configuration files a.k.a.
    /etc/fonts/conf.avail
  --with-baseconfigdir for fonts.conf etc a.k.a. /etc/fonts
  --with-configdir for the active configuration files a.k.a.
    /etc/fonts/conf.d
  --with-xmldir for fonts.dtd etc

and the default path for templatedir is changed to
${datadir}/fontconfig/conf.avail
This commit is contained in:
Akira TAGOH 2012-04-04 16:49:30 +09:00
parent bb02899d9f
commit e181ab4de5
5 changed files with 129 additions and 82 deletions

View File

@ -54,8 +54,11 @@ MAINTAINERCLEANFILES = \
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA = fontconfig.pc
configdir=$(CONFDIR)
config_DATA=fonts.dtd
baseconfigdir = $(BASECONFIGDIR)
configdir = $(CONFIGDIR)
xmldir = $(XMLDIR)
xml_DATA = fonts.dtd
if CROSS_COMPILING
RUN_FC_CACHE_TEST=false
@ -88,23 +91,24 @@ fonts.conf: fonts.conf.in Makefile
-e 's,@FC_CACHEDIR\@,$(FC_CACHEDIR),g' \
-e 's,@FC_DEFAULT_FONTS\@,$(FC_DEFAULT_FONTS),g' \
-e 's,@FC_FONTPATH\@,$(FC_FONTPATH),g' \
-e 's,@CONFIGDIR\@,$(CONFIGDIR),g' \
-e 's,@PACKAGE\@,$(PACKAGE),g' \
-e 's,@VERSION\@,$(VERSION),g' \
$(srcdir)/$@.in > $@.tmp && \
mv $@.tmp $@
install-data-local: fonts.conf
$(mkinstalldirs) $(DESTDIR)$(configdir) $(DESTDIR)$(fc_cachedir)
if [ -f $(DESTDIR)$(configdir)/fonts.conf ]; then \
echo "backing up existing $(DESTDIR)$(configdir)/fonts.conf"; \
mv $(DESTDIR)$(configdir)/fonts.conf $(DESTDIR)$(configdir)/fonts.conf.bak; \
$(mkinstalldirs) $(DESTDIR)$(baseconfigdir) $(DESTDIR)$(fc_cachedir)
if [ -f $(DESTDIR)$(baseconfigdir)/fonts.conf ]; then \
echo "backing up existing $(DESTDIR)$(baseconfigdir)/fonts.conf"; \
mv $(DESTDIR)$(baseconfigdir)/fonts.conf $(DESTDIR)$(baseconfigdir)/fonts.conf.bak; \
fi
if [ -f $(srcdir)/fonts.conf ]; then \
echo " $(INSTALL_DATA) $(srcdir)/fonts.conf $(DESTDIR)$(configdir)/fonts.conf"; \
$(INSTALL_DATA) $(srcdir)/fonts.conf $(DESTDIR)$(configdir)/fonts.conf; \
echo " $(INSTALL_DATA) $(srcdir)/fonts.conf $(DESTDIR)$(baseconfigdir)/fonts.conf"; \
$(INSTALL_DATA) $(srcdir)/fonts.conf $(DESTDIR)$(baseconfigdir)/fonts.conf; \
else if [ -f fonts.conf ]; then \
echo " $(INSTALL_DATA) fonts.conf $(DESTDIR)$(configdir)/fonts.conf"; \
$(INSTALL_DATA) fonts.conf $(DESTDIR)$(configdir)/fonts.conf; \
echo " $(INSTALL_DATA) fonts.conf $(DESTDIR)$(baseconfigdir)/fonts.conf"; \
$(INSTALL_DATA) fonts.conf $(DESTDIR)$(baseconfigdir)/fonts.conf; \
fi; fi
@(if $(RUN_FC_CACHE_TEST); then \
echo "fc-cache$(EXEEXT) -s -f -v"; \
@ -119,14 +123,14 @@ install-data-local: fonts.conf
uninstall-local:
if [ -f $(srcdir)/fonts.conf ]; then \
if cmp -s $(srcdir)/fonts.conf $(DESTDIR)$(configdir)/fonts.conf; then \
echo " uninstall standard $(DESTDIR)$(configdir)/fonts.conf"; \
$(RM) $(DESTDIR)$(configdir)/fonts.conf; \
if cmp -s $(srcdir)/fonts.conf $(DESTDIR)$(baseconfigdir)/fonts.conf; then \
echo " uninstall standard $(DESTDIR)$(baseconfigdir)/fonts.conf"; \
$(RM) $(DESTDIR)$(baseconfigdir)/fonts.conf; \
fi; \
else if [ -f fonts.conf ]; then \
if cmp -s fonts.conf $(DESTDIR)$(configdir)/fonts.conf; then \
echo " uninstall standard $(DESTDIR)$(configdir)/fonts.conf"; \
$(RM) $(DESTDIR)$(configdir)/fonts.conf; \
if cmp -s fonts.conf $(DESTDIR)$(baseconfigdir)/fonts.conf; then \
echo " uninstall standard $(DESTDIR)$(baseconfigdir)/fonts.conf"; \
$(RM) $(DESTDIR)$(baseconfigdir)/fonts.conf; \
fi; \
fi; fi

View File

@ -24,37 +24,6 @@
DOC_FILES= \
README
CONF_FILES = \
10-autohint.conf \
10-no-sub-pixel.conf \
10-sub-pixel-bgr.conf \
10-sub-pixel-rgb.conf \
10-sub-pixel-vbgr.conf \
10-sub-pixel-vrgb.conf \
10-unhinted.conf \
11-lcdfilter-default.conf \
11-lcdfilter-legacy.conf \
11-lcdfilter-light.conf \
20-fix-globaladvance.conf \
20-unhint-small-vera.conf \
25-unhint-nonlatin.conf \
30-urw-aliases.conf \
30-metric-aliases.conf \
40-nonlatin.conf \
45-latin.conf \
49-sansserif.conf \
50-user.conf \
51-local.conf \
60-latin.conf \
65-fonts-persian.conf \
65-khmer.conf \
65-nonlatin.conf \
69-unifont.conf \
70-no-bitmaps.conf \
70-yes-bitmaps.conf \
80-delicious.conf \
90-synthetic.conf
CONF_LINKS = \
20-fix-globaladvance.conf \
20-unhint-small-vera.conf \
@ -72,28 +41,56 @@ CONF_LINKS = \
80-delicious.conf \
90-synthetic.conf
EXTRA_DIST = $(CONF_FILES) $(DOC_FILES)
EXTRA_DIST = $(template_DATA) $(DOC_FILES)
configdir=$(CONFDIR)
confavaildir=$(configdir)/conf.avail
confddir=$(configdir)/conf.d
configdir=$(CONFIGDIR)
config_DATA = $(DOC_FILES)
confavail_DATA=$(CONF_FILES)
confd_DATA=$(DOC_FILES)
templatedir = $(TEMPLATEDIR)
template_DATA = \
10-autohint.conf \
10-no-sub-pixel.conf \
10-sub-pixel-bgr.conf \
10-sub-pixel-rgb.conf \
10-sub-pixel-vbgr.conf \
10-sub-pixel-vrgb.conf \
10-unhinted.conf \
11-lcdfilter-default.conf \
11-lcdfilter-legacy.conf \
11-lcdfilter-light.conf \
20-fix-globaladvance.conf \
20-unhint-small-vera.conf \
25-unhint-nonlatin.conf \
30-urw-aliases.conf \
30-metric-aliases.conf \
40-nonlatin.conf \
45-latin.conf \
49-sansserif.conf \
50-user.conf \
51-local.conf \
60-latin.conf \
65-fonts-persian.conf \
65-khmer.conf \
65-nonlatin.conf \
69-unifont.conf \
70-no-bitmaps.conf \
70-yes-bitmaps.conf \
80-delicious.conf \
90-synthetic.conf
install-data-local:
mkdir -p ${DESTDIR}${confddir}
@(echo cd ${DESTDIR}${confddir}; \
cd ${DESTDIR}${confddir}; \
for i in ${CONF_LINKS}; do \
$(RM) $$i; \
echo $(RM) $$i";" ln -s ../conf.avail/$$i .; \
ln -s ../conf.avail/$$i .; \
done)
mkdir -p $(DESTDIR)$(configdir)
@(echo cd $(DESTDIR)$(configdir); \
cd $(DESTDIR)$(configdir); \
for i in $(CONF_LINKS); do \
echo $(RM) $$i";" ln -s $(templatedir)/$$i .; \
$(RM) $$i; \
ln -s $(templatedir)/$$i .; \
done)
uninstall-local:
@(echo cd ${DESTDIR}${confddir}; \
cd ${DESTDIR}${confddir}; \
for i in ${CONF_LINKS}; do \
echo $(RM) $$i; \
$(RM) $$i; \
done)
@(echo cd $(DESTDIR)$(configdir); \
cd $(DESTDIR)$(configdir); \
for i in $(CONF_LINKS); do \
echo $(RM) $$i; \
$(RM) $$i; \
done)

View File

@ -334,7 +334,7 @@ AC_SUBST(FC_FONTPATH)
#
AC_ARG_WITH(cache-dir,
[AC_HELP_STRING([--with-cache-dir=DIR],
[Use DIR to store cache files (default LOCALSTATEDIR/cache/fontconfig)])],
[Use DIR to store cache files [default=LOCALSTATEDIR/cache/fontconfig]])],
fc_cachedir="$withval", fc_cachedir=yes)
case $fc_cachedir in
@ -356,26 +356,72 @@ FC_FONTDATE=`LC_ALL=C date`
AC_SUBST(FC_FONTDATE)
AC_ARG_WITH(confdir,
[AC_HELP_STRING([--with-confdir=DIR],
[Use DIR to store configuration files (default SYSCONFDIR/fonts)])],
confdir="$withval", confdir=yes)
#
# Set CONFDIR and FONTCONFIG_PATH
# Set configuration paths
#
case "$confdir" in
AC_ARG_WITH(templatedir,
[AC_HELP_STRING([--with-templatedir=DIR],
[Use DIR to store the configuration template files [default=DATADIR/fontconfig/conf.avail]])],
[templatedir="$withval"],
[templatedir=yes])
AC_ARG_WITH(baseconfigdir,
[AC_HELP_STRING([--with-baseconfigdir=DIR],
[Use DIR to store the base configuration files [default=SYSCONFDIR/fonts]])],
[baseconfigdir="$withval"],
[baseconfigdir=yes])
AC_ARG_WITH(configdir,
[AC_HELP_STRING([--with-configdir=DIR],
[Use DIR to store active configuration files [default=BASECONFIGDIR/conf.d]])],
[configdir="$withval"],
[configdir=yes])
AC_ARG_WITH(xmldir,
[AC_HELP_STRING([--with-xmldir=DIR],
[Use DIR to store XML schema files [default=DATADIR/xml/fontconfig]])],
[xmldir="$withval"],
[xmldir=yes])
case "$templatedir" in
no|yes)
confdir='${sysconfdir}'/fonts
templatedir='${datadir}'/fontconfig/conf.avail
;;
*)
;;
esac
AC_SUBST(confdir)
CONFDIR=${confdir}
AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR",[Font configuration directory])
AC_SUBST(CONFDIR)
case "$baseconfigdir" in
no|yes)
baseconfigdir='${sysconfdir}'/fonts
;;
*)
;;
esac
case "$configdir" in
no|yes)
configdir='${baseconfigdir}'/conf.d
;;
*)
;;
esac
case "$xmldir" in
no|yes)
xmldir='${datadir}'/xml/fontconfig
;;
*)
;;
esac
TEMPLATEDIR=${templatedir}
BASECONFIGDIR=${baseconfigdir}
CONFIGDIR=${configdir}
XMLDIR=${xmldir}
AC_SUBST(templatedir)
AC_SUBST(TEMPLATEDIR)
AC_SUBST(baseconfigdir)
AC_SUBST(BASECONFIGDIR)
AC_SUBST(configdir)
AC_SUBST(CONFIGDIR)
AC_SUBST(xmldir)
AC_SUBST(XMLDIR)
#
# Let people not build/install docs if they don't have docbook

View File

@ -66,7 +66,7 @@
<!--
Load local system customization file
-->
<include ignore_missing="yes">conf.d</include>
<include ignore_missing="yes">@CONFIGDIR@</include>
<!-- Font cache directory list -->

View File

@ -75,7 +75,7 @@ INCLUDES = \
$(EXPAT_CFLAGS) \
$(WARN_CFLAGS) \
-DFC_CACHEDIR='"$(FC_CACHEDIR)"' \
-DFONTCONFIG_PATH='"$(CONFDIR)"'
-DFONTCONFIG_PATH='"$(BASECONFIGDIR)"'
EXTRA_DIST = makealias