From dbd065ad312921308add99fc4cb31457d9045e6a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 2 Jan 2008 08:47:14 -0800 Subject: [PATCH] Remove freetype requirement for build-time applications. This avoids requiring the freetype development files when cross compiling --- fc-arch/Makefile.am | 2 +- fc-case/Makefile.am | 2 +- fc-glyphname/Makefile.am | 2 +- fc-lang/Makefile.am | 2 +- src/Makefile.am | 13 +++++++--- src/fcfreetype.c | 1 + src/fcftint.h | 54 ++++++++++++++++++++++++++++++++++++++++ src/fcint.h | 18 +------------- src/fclang.c | 1 + src/fcpat.c | 1 + src/makealias | 6 +++-- 11 files changed, 76 insertions(+), 26 deletions(-) create mode 100644 src/fcftint.h diff --git a/fc-arch/Makefile.am b/fc-arch/Makefile.am index 5fedbfb..7e1dd3e 100644 --- a/fc-arch/Makefile.am +++ b/fc-arch/Makefile.am @@ -26,7 +26,7 @@ CC = @CC_FOR_BUILD@ EXEEXT = @EXEEXT_FOR_BUILD@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(FREETYPE_CFLAGS) $(WARN_CFLAGS) +INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS) TMPL=fcarch.tmpl.h STMPL=${top_srcdir}/fc-arch/fcarch.tmpl.h diff --git a/fc-case/Makefile.am b/fc-case/Makefile.am index 83ca2de..d4fa12d 100644 --- a/fc-case/Makefile.am +++ b/fc-case/Makefile.am @@ -26,7 +26,7 @@ CC = @CC_FOR_BUILD@ EXEEXT = @EXEEXT_FOR_BUILD@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(FREETYPE_CFLAGS) $(WARN_CFLAGS) +INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS) TMPL=fccase.tmpl.h STMPL=${top_srcdir}/fc-case/${TMPL} diff --git a/fc-glyphname/Makefile.am b/fc-glyphname/Makefile.am index 8aa5ead..412d663 100644 --- a/fc-glyphname/Makefile.am +++ b/fc-glyphname/Makefile.am @@ -26,7 +26,7 @@ CC = @CC_FOR_BUILD@ EXEEXT = @EXEEXT_FOR_BUILD@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(FREETYPE_CFLAGS) $(WARN_CFLAGS) +INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS) TMPL=fcglyphname.tmpl.h STMPL=${top_srcdir}/fc-glyphname/${TMPL} diff --git a/fc-lang/Makefile.am b/fc-lang/Makefile.am index f152ab5..60e4f31 100644 --- a/fc-lang/Makefile.am +++ b/fc-lang/Makefile.am @@ -26,7 +26,7 @@ CC = @CC_FOR_BUILD@ EXEEXT = @EXEEXT_FOR_BUILD@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(FREETYPE_CFLAGS) $(WARN_CFLAGS) +INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS) TMPL=fclang.tmpl.h STMPL=${top_srcdir}/fc-lang/fclang.tmpl.h diff --git a/src/Makefile.am b/src/Makefile.am index e4c203c..a7d6b92 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -81,7 +81,7 @@ EXTRA_DIST = makealias noinst_HEADERS=fcint.h fcdeprecate.h -ALIAS_FILES = fcalias.h fcaliastail.h +ALIAS_FILES = fcalias.h fcaliastail.h fcftalias.h fcftaliastail.h BUILT_SOURCES = $(ALIAS_FILES) @@ -124,14 +124,21 @@ uninstall-local: uninstall-ms-import-lib uninstall-libtool-import-lib PUBLIC_FILES = \ $(top_srcdir)/fontconfig/fontconfig.h \ - $(top_srcdir)/fontconfig/fcfreetype.h \ $(top_srcdir)/src/fcdeprecate.h \ $(top_srcdir)/fontconfig/fcprivate.h +PUBLIC_FT_FILES = \ + $(top_srcdir)/fontconfig/fcfreetype.h + fcaliastail.h: fcalias.h fcalias.h: $(top_srcdir)/src/makealias $(PUBLIC_FILES) - sh $(top_srcdir)/src/makealias "$(top_srcdir)/src" $(PUBLIC_FILES) + sh $(top_srcdir)/src/makealias "$(top_srcdir)/src" fcalias.h fcaliastail.h $(PUBLIC_FILES) + +fcftaliastail.h: fcftalias.h + +fcftalias.h: $(top_srcdir)/src/makealias $(PUBLIC_FT_FILES) + sh $(top_srcdir)/src/makealias "$(top_srcdir)/src" fcftalias.h fcftaliastail.h $(PUBLIC_FT_FILES) CLEANFILES := $(ALIAS_FILES) diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 572e7f2..53fe86b 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -45,6 +45,7 @@ */ #include "fcint.h" +#include "fcftint.h" #include #include #include diff --git a/src/fcftint.h b/src/fcftint.h new file mode 100644 index 0000000..f32d87c --- /dev/null +++ b/src/fcftint.h @@ -0,0 +1,54 @@ +/* + * Copyright © 2007 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _FCFTINT_H_ +#define _FCFTINT_H_ + +#include + +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun) +#define FcPrivate __attribute__((__visibility__("hidden"))) +#define HAVE_GNUC_ATTRIBUTE 1 +#include "fcftalias.h" +#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) +#define FcPrivate __hidden +#else /* not gcc >= 3.3 and not Sun Studio >= 8 */ +#define FcPrivate +#endif + +/* fcfreetype.c */ +FcPrivate FcBool +FcFreeTypeIsExclusiveLang (const FcChar8 *lang); + +FcPrivate FcBool +FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang); + +FcPrivate FcChar32 +FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map); + +FcPrivate FcChar32 +FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map); + +FcPrivate const FcCharMap * +FcFreeTypeGetPrivateMap (FT_Encoding encoding); + +#endif /* _FCFTINT_H_ */ diff --git a/src/fcint.h b/src/fcint.h index 922a2df..ddeb745 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -42,12 +42,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include "fcdeprecate.h" #ifndef FC_CONFIG_PATH @@ -705,22 +705,6 @@ FcDirScanConfig (FcFontSet *set, FcPrivate int FcFontDebug (void); -/* fcfreetype.c */ -FcPrivate FcBool -FcFreeTypeIsExclusiveLang (const FcChar8 *lang); - -FcPrivate FcBool -FcFreeTypeHasLang (FcPattern *pattern, const FcChar8 *lang); - -FcPrivate FcChar32 -FcFreeTypeUcs4ToPrivate (FcChar32 ucs4, const FcCharMap *map); - -FcPrivate FcChar32 -FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map); - -FcPrivate const FcCharMap * -FcFreeTypeGetPrivateMap (FT_Encoding encoding); - /* fcfs.c */ FcPrivate FcBool diff --git a/src/fclang.c b/src/fclang.c index 7aa5f3c..dc1fb36 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -23,6 +23,7 @@ */ #include "fcint.h" +#include "fcftint.h" typedef struct { const FcChar8 lang[8]; diff --git a/src/fcpat.c b/src/fcpat.c index 4179694..c8368fc 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -21,6 +21,7 @@ */ #include "fcint.h" +#include "fcftint.h" #include #include #include diff --git a/src/makealias b/src/makealias index bbc90f0..1f57742 100755 --- a/src/makealias +++ b/src/makealias @@ -1,8 +1,10 @@ #!/bin/sh SRCDIR=$1 shift -HEAD=fcalias.h -TAIL=fcaliastail.h +HEAD=$1 +shift +TAIL=$1 +shift rm -f $HEAD $TAIL echo "#if HAVE_GNUC_ATTRIBUTE" >> $TAIL cat "$@" | grep '^Fc[^ ]* *(' | sed -e 's/ *(.*$//' | -- 2.39.5