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
This commit is contained in:
Keith Packard 2003-03-02 19:12:23 +00:00
parent bf0093b724
commit ff3f1f98ed
11 changed files with 79 additions and 6219 deletions

View File

@ -24,7 +24,6 @@
SUBDIRS=fontconfig fc-lang src fc-cache fc-list doc test SUBDIRS=fontconfig fc-lang src fc-cache fc-list doc test
EXTRA_DIST = \ EXTRA_DIST = \
ltmain.sh \
fontconfig.pc.in \ fontconfig.pc.in \
fonts.conf.in \ fonts.conf.in \
fonts.dtd \ fonts.dtd \

View File

@ -29,23 +29,20 @@ dnl ==========================================================================
dnl Versioning dnl Versioning
dnl ========================================================================== dnl ==========================================================================
dnl This is the package version number, not the shared library version number dnl This is the package version number, not the shared library
dnl The shared library version lives in fontconfig/fontconfig.h 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) 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 dnl libtool versioning
LT_VERSION_NUMBER="$FONTCONFIG_MAJOR:$FONTCONFIG_MINOR:$FONTCONFIG_REVISION" LT_CURRENT=1
AC_SUBST(LT_VERSION_NUMBER) LT_REVISION=4
LT_AGE=0
LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE"
AC_SUBST(LT_VERSION_INFO)
dnl ========================================================================== dnl ==========================================================================

View File

@ -51,6 +51,7 @@
#include <getopt.h> #include <getopt.h>
const struct option longopts[] = { const struct option longopts[] = {
{"force", 0, 0, 'f'}, {"force", 0, 0, 'f'},
{"system-only", 0, 0, 's'},
{"version", 0, 0, 'V'}, {"version", 0, 0, 'V'},
{"verbose", 0, 0, 'v'}, {"verbose", 0, 0, 'v'},
{"help", 0, 0, '?'}, {"help", 0, 0, '?'},
@ -72,6 +73,7 @@ usage (char *program)
"(all directories in font configuration by default).\n"); "(all directories in font configuration by default).\n");
fprintf (stderr, "\n"); fprintf (stderr, "\n");
fprintf (stderr, " -f, --force scan directories with apparently valid caches\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, --verbose display status information while busy\n");
fprintf (stderr, " -V, --version display font config version and exit\n"); fprintf (stderr, " -V, --version display font config version and exit\n");
fprintf (stderr, " -?, --help display this help and exit\n"); fprintf (stderr, " -?, --help display this help and exit\n");
@ -206,6 +208,7 @@ main (int argc, char **argv)
FcStrList *list; FcStrList *list;
FcBool verbose = FcFalse; FcBool verbose = FcFalse;
FcBool force = FcFalse; FcBool force = FcFalse;
FcBool systemOnly = FcFalse;
FcConfig *config; FcConfig *config;
int i; int i;
int ret; int ret;
@ -222,6 +225,9 @@ main (int argc, char **argv)
case 'f': case 'f':
force = FcTrue; force = FcTrue;
break; break;
case 's':
systemOnly = FcTrue;
break;
case 'V': case 'V':
fprintf (stderr, "fontconfig version %d.%d.%d\n", fprintf (stderr, "fontconfig version %d.%d.%d\n",
FC_MAJOR, FC_MINOR, FC_REVISION); FC_MAJOR, FC_MINOR, FC_REVISION);
@ -238,6 +244,8 @@ main (int argc, char **argv)
i = 1; i = 1;
#endif #endif
if (systemOnly)
FcConfigEnableHome (FcFalse);
config = FcInitLoadConfig (); config = FcInitLoadConfig ();
if (!config) if (!config)
{ {

View File

@ -47,6 +47,12 @@ FcMemFree (int kind, int size)
{ {
} }
FcChar8 *
FcConfigHome (void)
{
return getenv ("HOME");
}
static void static void
fatal (char *file, int lineno, char *msg) fatal (char *file, int lineno, char *msg)
{ {

View File

@ -33,12 +33,14 @@ typedef unsigned int FcChar32;
typedef int FcBool; 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_MAJOR 2
#define FC_MINOR 0 #define FC_MINOR 1
#define FC_REVISION 3 #define FC_REVISION 90
#define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION)) #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))
@ -242,6 +244,12 @@ FcBool
FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4); FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
/* fccfg.c */ /* fccfg.c */
FcChar8 *
FcConfigHome (void);
FcBool
FcConfigEnableHome (FcBool enable);
FcChar8 * FcChar8 *
FcConfigFilename (const FcChar8 *url); FcConfigFilename (const FcChar8 *url);

6192
ltmain.sh

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ libfontconfig_la_SOURCES = \
lib_LTLIBRARIES = libfontconfig.la lib_LTLIBRARIES = libfontconfig.la
libfontconfig_la_LDFLAGS = \ libfontconfig_la_LDFLAGS = \
-version-number @LT_VERSION_NUMBER@ -version-info @LT_VERSION_INFO@
libfontconfig_la_LIBADD = $(FREETYPE_LIBS) $(EXPAT_LIBS) libfontconfig_la_LIBADD = $(FREETYPE_LIBS) $(EXPAT_LIBS)

View File

@ -50,6 +50,7 @@ FcConfigCreate (void)
goto bail3; goto bail3;
config->cache = 0; config->cache = 0;
if (FcConfigHome())
if (!FcConfigSetCache (config, (FcChar8 *) ("~/" FC_USER_CACHE_FILE))) if (!FcConfigSetCache (config, (FcChar8 *) ("~/" FC_USER_CACHE_FILE)))
goto bail4; goto bail4;
@ -1367,6 +1368,24 @@ FcConfigFreePath (FcChar8 **path)
free (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 * FcChar8 *
FcConfigFilename (const FcChar8 *url) FcConfigFilename (const FcChar8 *url)
{ {
@ -1381,7 +1400,7 @@ FcConfigFilename (const FcChar8 *url)
file = 0; file = 0;
switch (*url) { switch (*url) {
case '~': case '~':
dir = (FcChar8 *) getenv ("HOME"); dir = FcConfigHome ();
if (dir) if (dir)
file = FcConfigFileExists (dir, url + 1); file = FcConfigFileExists (dir, url + 1);
else else

View File

@ -643,4 +643,7 @@ FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len);
int int
FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2); FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
FcBool
FcStrUsesHome (const FcChar8 *s);
#endif /* _FC_INT_H_ */ #endif /* _FC_INT_H_ */

View File

@ -423,6 +423,12 @@ FcStrBufData (FcStrBuf *buf, const FcChar8 *s, int len)
return FcTrue; return FcTrue;
} }
FcBool
FcStrUsesHome (const FcChar8 *s)
{
return *s == '~';
}
FcChar8 * FcChar8 *
FcStrCopyFilename (const FcChar8 *s) FcStrCopyFilename (const FcChar8 *s)
{ {
@ -430,7 +436,7 @@ FcStrCopyFilename (const FcChar8 *s)
if (*s == '~') if (*s == '~')
{ {
FcChar8 *home = (FcChar8 *) getenv ("HOME"); FcChar8 *home = FcConfigHome ();
int size; int size;
if (!home) if (!home)
return 0; return 0;

View File

@ -1600,8 +1600,11 @@ FcEndElement(void *userData, const XML_Char *name)
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
break; break;
} }
if (!FcStrUsesHome (data) || FcConfigHome ())
{
if (!FcConfigAddDir (parse->config, data)) if (!FcConfigAddDir (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
}
FcStrFree (data); FcStrFree (data);
break; break;
case FcElementCache: case FcElementCache:
@ -1611,8 +1614,11 @@ FcEndElement(void *userData, const XML_Char *name)
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
break; break;
} }
if (!FcStrUsesHome (data) || FcConfigHome ())
{
if (!FcConfigSetCache (parse->config, data)) if (!FcConfigSetCache (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory"); FcConfigMessage (parse, FcSevereError, "out of memory");
}
FcStrFree (data); FcStrFree (data);
break; break;
case FcElementInclude: case FcElementInclude: