Makefile.am | 36 ++++++++++--------- conf.d/Makefile.am | 99 +++++++++++++++++++++++++---------------------------- configure.in | 72 +++++++++++++++++++++++++++++++------- fonts.conf.in | 2 - src/Makefile.am | 2 - 5 files changed, 129 insertions(+), 82 deletions(-) New commits: commit e181ab4de5d20fe1f70e68f66ef8332553eba206 Author: Akira TAGOH <akira at tagoh.org> Date: Wed Apr 4 16:49:30 2012 +0900 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 diff --git a/Makefile.am b/Makefile.am index 1b94367..1738c33 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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, at FC_CACHEDIR\@,$(FC_CACHEDIR),g'' \ -e ''s, at FC_DEFAULT_FONTS\@,$(FC_DEFAULT_FONTS),g'' \ -e ''s, at FC_FONTPATH\@,$(FC_FONTPATH),g'' \ + -e ''s, at CONFIGDIR\@,$(CONFIGDIR),g'' \ -e ''s, at PACKAGE\@,$(PACKAGE),g'' \ -e ''s, at 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 diff --git a/conf.d/Makefile.am b/conf.d/Makefile.am index 13f243b..93bf8d3 100644 --- a/conf.d/Makefile.am +++ b/conf.d/Makefile.am @@ -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) diff --git a/configure.in b/configure.in index 7637c02..ea44c14 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/fonts.conf.in b/fonts.conf.in index a17c01e..533381b 100644 --- a/fonts.conf.in +++ b/fonts.conf.in @@ -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 --> diff --git a/src/Makefile.am b/src/Makefile.am index fb30cd5..591fc16 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -75,7 +75,7 @@ INCLUDES = \ $(EXPAT_CFLAGS) \ $(WARN_CFLAGS) \ -DFC_CACHEDIR=''"$(FC_CACHEDIR)"'' \ - -DFONTCONFIG_PATH=''"$(CONFDIR)"'' + -DFONTCONFIG_PATH=''"$(BASECONFIGDIR)"'' EXTRA_DIST = makealias