Commit ff3f1f98 authored by Keith Packard's avatar Keith Packard

Switch back to -version-info for fontconfig as its at minor 0. Add

    --system-only to fc-cache. Fix FC_VERSION to match product version
    rather than .so version
parent bf0093b7
......@@ -24,7 +24,6 @@
SUBDIRS=fontconfig fc-lang src fc-cache fc-list doc test
EXTRA_DIST = \
ltmain.sh \
fontconfig.pc.in \
fonts.conf.in \
fonts.dtd \
......
......@@ -29,23 +29,20 @@ dnl ==========================================================================
dnl Versioning
dnl ==========================================================================
dnl This is the package version number, not the shared library version number
dnl The shared library version lives in fontconfig/fontconfig.h
dnl This is the package version number, not the shared library
dnl version. This same version number must appear in fontconfig/fontconfig.h
dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's
dnl not possible to extract the version number here from fontconfig.h
AM_INIT_AUTOMAKE(fontconfig, 2.1.90)
FONTCONFIG_HEADER=fontconfig/fontconfig.h
FONTCONFIG_MAJOR=`awk '/^#define FC_MAJOR/ { print $3 }' $FONTCONFIG_HEADER`
FONTCONFIG_MINOR=`awk '/^#define FC_MINOR/ { print $3 }' $FONTCONFIG_HEADER`
FONTCONFIG_REVISION=`awk '/^#define FC_REVISION/ { print $3 }' $FONTCONFIG_HEADER`
AC_SUBST(FONTCONFIG_MAJOR)
AC_SUBST(FONTCONFIG_MINOR)
AC_SUBST(FONTCONFIG_REVISION)
dnl libtool versioning
LT_VERSION_NUMBER="$FONTCONFIG_MAJOR:$FONTCONFIG_MINOR:$FONTCONFIG_REVISION"
AC_SUBST(LT_VERSION_NUMBER)
LT_CURRENT=1
LT_REVISION=4
LT_AGE=0
LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(LT_VERSION_INFO)
dnl ==========================================================================
......
......@@ -51,6 +51,7 @@
#include <getopt.h>
const struct option longopts[] = {
{"force", 0, 0, 'f'},
{"system-only", 0, 0, 's'},
{"version", 0, 0, 'V'},
{"verbose", 0, 0, 'v'},
{"help", 0, 0, '?'},
......@@ -72,6 +73,7 @@ usage (char *program)
"(all directories in font configuration by default).\n");
fprintf (stderr, "\n");
fprintf (stderr, " -f, --force scan directories with apparently valid caches\n");
fprintf (stderr, " -s, --system-only scan system-wide directories only\n");
fprintf (stderr, " -v, --verbose display status information while busy\n");
fprintf (stderr, " -V, --version display font config version and exit\n");
fprintf (stderr, " -?, --help display this help and exit\n");
......@@ -206,6 +208,7 @@ main (int argc, char **argv)
FcStrList *list;
FcBool verbose = FcFalse;
FcBool force = FcFalse;
FcBool systemOnly = FcFalse;
FcConfig *config;
int i;
int ret;
......@@ -222,6 +225,9 @@ main (int argc, char **argv)
case 'f':
force = FcTrue;
break;
case 's':
systemOnly = FcTrue;
break;
case 'V':
fprintf (stderr, "fontconfig version %d.%d.%d\n",
FC_MAJOR, FC_MINOR, FC_REVISION);
......@@ -238,6 +244,8 @@ main (int argc, char **argv)
i = 1;
#endif
if (systemOnly)
FcConfigEnableHome (FcFalse);
config = FcInitLoadConfig ();
if (!config)
{
......
......@@ -47,6 +47,12 @@ FcMemFree (int kind, int size)
{
}
FcChar8 *
FcConfigHome (void)
{
return getenv ("HOME");
}
static void
fatal (char *file, int lineno, char *msg)
{
......
......@@ -33,12 +33,14 @@ typedef unsigned int FcChar32;
typedef int FcBool;
/*
* Current Fontconfig version number
* Current Fontconfig version number. This same number
* must appear in the fontconfig configure.in file. Yes,
* it'a a pain to synchronize version numbers like this.
*/
#define FC_MAJOR 1
#define FC_MINOR 0
#define FC_REVISION 3
#define FC_MAJOR 2
#define FC_MINOR 1
#define FC_REVISION 90
#define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))
......@@ -242,6 +244,12 @@ FcBool
FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
/* fccfg.c */
FcChar8 *
FcConfigHome (void);
FcBool
FcConfigEnableHome (FcBool enable);
FcChar8 *
FcConfigFilename (const FcChar8 *url);
......
This diff is collapsed.
......@@ -30,7 +30,7 @@ libfontconfig_la_SOURCES = \
lib_LTLIBRARIES = libfontconfig.la
libfontconfig_la_LDFLAGS = \
-version-number @LT_VERSION_NUMBER@
-version-info @LT_VERSION_INFO@
libfontconfig_la_LIBADD = $(FREETYPE_LIBS) $(EXPAT_LIBS)
......@@ -50,8 +50,9 @@ FcConfigCreate (void)
goto bail3;
config->cache = 0;
if (!FcConfigSetCache (config, (FcChar8 *) ("~/" FC_USER_CACHE_FILE)))
goto bail4;
if (FcConfigHome())
if (!FcConfigSetCache (config, (FcChar8 *) ("~/" FC_USER_CACHE_FILE)))
goto bail4;
config->blanks = 0;
......@@ -1367,6 +1368,24 @@ FcConfigFreePath (FcChar8 **path)
free (path);
}
static FcBool _FcConfigHomeEnabled = FcTrue;
FcChar8 *
FcConfigHome (void)
{
if (_FcConfigHomeEnabled)
return getenv ("HOME");
return 0;
}
FcBool
FcConfigEnableHome (FcBool enable)
{
FcBool prev = _FcConfigHomeEnabled;
_FcConfigHomeEnabled = enable;
return prev;
}
FcChar8 *
FcConfigFilename (const FcChar8 *url)
{
......@@ -1381,7 +1400,7 @@ FcConfigFilename (const FcChar8 *url)
file = 0;
switch (*url) {
case '~':
dir = (FcChar8 *) getenv ("HOME");
dir = FcConfigHome ();
if (dir)
file = FcConfigFileExists (dir, url + 1);
else
......
......@@ -643,4 +643,7 @@ FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
int
FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
FcBool
FcStrUsesHome (const FcChar8 *s);
#endif /* _FC_INT_H_ */
......@@ -423,6 +423,12 @@ FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len)
return FcTrue;
}
FcBool
FcStrUsesHome (const FcChar8 *s)
{
return *s == '~';
}
FcChar8 *
FcStrCopyFilename (const FcChar8 *s)
{
......@@ -430,7 +436,7 @@ FcStrCopyFilename (const FcChar8 *s)
if (*s == '~')
{
FcChar8 *home = (FcChar8 *) getenv ("HOME");
FcChar8 *home = FcConfigHome ();
int size;
if (!home)
return 0;
......
......@@ -1600,8 +1600,11 @@ FcEndElement(void *userData, const XML_Char *name)
FcConfigMessage (parse, FcSevereError, "out of memory");
break;
}
if (!FcConfigAddDir (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory");
if (!FcStrUsesHome (data) || FcConfigHome ())
{
if (!FcConfigAddDir (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory");
}
FcStrFree (data);
break;
case FcElementCache:
......@@ -1611,8 +1614,11 @@ FcEndElement(void *userData, const XML_Char *name)
FcConfigMessage (parse, FcSevereError, "out of memory");
break;
}
if (!FcConfigSetCache (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory");
if (!FcStrUsesHome (data) || FcConfigHome ())
{
if (!FcConfigSetCache (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory");
}
FcStrFree (data);
break;
case FcElementInclude:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment