[Fontconfig] Building in a cross-compile environment
J. Ali Harlow
ali at juiblex.co.uk
Sat Mar 6 01:06:33 EST 2004
Hi,
I've put together a patch to allow fontconfig to build under a
cross-compile environment. Tested with linux-x-mingw and native linux.
Disclaimers:
* I'm an autoconf newbie, so I could have made a complete pig's ear.
* The patch really ought to be tested under native mingw.
* I haven't tested it beyond seeing that it builds.
* fc-lang and fc-glyphname are built without any special attention to
freetype cflags. This means that they will end up including headers
from the host version of freetype rather than the build version. This
may not be a problem; it may even be an advantage, but I haven't taken
any account of it.
* I have assumed that the output of fc-cache is shareable (portable).
Cheers,
Ali.
-------------- next part --------------
# $Product: fontconfig $ $Id$
diff -Naurd ../fontconfig-2.2.92/configure.in ./configure.in
--- ../fontconfig-2.2.92/configure.in Mon Oct 27 10:47:48 2003
+++ ./configure.in Thu Mar 4 10:56:44 2004
@@ -78,6 +78,58 @@
dnl ==========================================================================
+# Look for fc-cache in PATH if we are cross-compiling
+AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
+
+if test $cross_compiling = yes; then
+ AC_PATH_PROG(FC_CACHE, fc-cache, no)
+ if test x$FC_CACHE = xno; then
+ AC_MSG_ERROR(Could not find an fc-cache in your PATH)
+ fi
+fi
+
+dnl ==========================================================================
+
+# Setup for compiling build tools (fc-glyphname, fc-lang, edit-sgml)
+AC_MSG_CHECKING([for a C compiler for build tools])
+if test $cross_compiling = yes; then
+ AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
+else
+ CC_FOR_BUILD=$CC
+fi
+AC_MSG_RESULT([$CC_FOR_BUILD])
+AC_SUBST(CC_FOR_BUILD)
+
+AC_MSG_CHECKING([for suffix of executable build tools])
+if test $cross_compiling = yes; then
+ cat >conftest.c <<\_______EOF
+int
+main ()
+{
+ exit (0);
+}
+_______EOF
+ for i in .exe ""; do
+ compile="$CC_FOR_BUILD conftest.c -o conftest$i"
+ if AC_TRY_EVAL(compile); then
+ if (./conftest) 2>&AC_FD_CC; then
+ EXEEXT_FOR_BUILD=$i
+ break
+ fi
+ fi
+ done
+ rm -f conftest*
+ if test "${EXEEXT_FOR_BUILD+set}" != set; then
+ AC_MSG_ERROR([Cannot determine suffix of executable build tools])
+ fi
+else
+ EXEEXT_FOR_BUILD=$EXEEXT
+fi
+AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
+AC_SUBST(EXEEXT_FOR_BUILD)
+
+dnl ==========================================================================
+
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
diff -Naurd ../fontconfig-2.2.92/Makefile.am ./Makefile.am
--- ../fontconfig-2.2.92/Makefile.am Mon Oct 27 10:43:47 2003
+++ ./Makefile.am Thu Mar 4 10:56:44 2004
@@ -39,6 +39,12 @@
configdir=$(CONFDIR)
config_DATA=fonts.conf fonts.dtd
+if CROSS_COMPILING
+ fc_cache=$(FC_CACHE)
+else
+ fc_cache=fc-cache/fc-cache
+endif
+
install-data-local:
$(mkinstalldirs) $(DESTDIR)/$(configdir)
if [ -f $(DESTDIR)$(configdir)/local.conf ]; then \
@@ -50,4 +56,4 @@
echo " $(INSTALL_DATA) local.conf $(DESTDIR)$(configdir)/local.conf"; \
$(INSTALL_DATA) local.conf $(DESTDIR)$(configdir)/local.conf; \
fi; fi; fi
- if [ x$(DESTDIR) = x ]; then fc-cache/fc-cache -f -v; fi
+ if [ x$(DESTDIR) = x ]; then $(fc_cache) -f -v; fi
diff -Naurd ../fontconfig-2.2.92/fc-lang/Makefile.am ./fc-lang/Makefile.am
--- ../fontconfig-2.2.92/fc-lang/Makefile.am Mon Oct 27 06:37:13 2003
+++ ./fc-lang/Makefile.am Thu Mar 4 10:56:44 2004
@@ -22,6 +22,10 @@
# PERFORMANCE OF THIS SOFTWARE.
#
+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)
TMPL=fclang.tmpl.h
@@ -38,8 +42,8 @@
EXTRA_DIST=$(TMPL) $(ORTH)
-$(TARG):$(ORTH) fc-lang $(STMPL)
+$(TARG):$(ORTH) fc-lang$(EXEEXT) $(STMPL)
rm -f $(TARG)
- ./fc-lang -d ${srcdir} $(ORTH) < $(STMPL) > $(TARG)
+ ./fc-lang$(EXEEXT) -d ${srcdir} $(ORTH) < $(STMPL) > $(TARG)
CLEANFILES=$(TARG)
diff -Naurd ../fontconfig-2.2.92/fc-glyphname/Makefile.am ./fc-glyphname/Makefile.am
--- ../fontconfig-2.2.92/fc-glyphname/Makefile.am Mon Oct 27 06:37:36 2003
+++ ./fc-glyphname/Makefile.am Thu Mar 4 10:56:44 2004
@@ -22,6 +22,10 @@
# PERFORMANCE OF THIS SOFTWARE.
#
+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)
TMPL=fcglyphname.tmpl.h
@@ -39,9 +43,9 @@
EXTRA_DIST=$(TMPL) $(GLYPHNAME)
-$(TARG): $(STMPL) fc-glyphname $(SGLYPHNAME)
+$(TARG): $(STMPL) fc-glyphname$(EXEEXT) $(SGLYPHNAME)
rm -f $(TARG)
- ./fc-glyphname $(SGLYPHNAME) < $(STMPL) > $(TARG)
+ ./fc-glyphname$(EXEEXT) $(SGLYPHNAME) < $(STMPL) > $(TARG)
CLEANFILES=$(TARG)
diff -Naurd ../fontconfig-2.2.92/doc/Makefile.am ./doc/Makefile.am
--- ../fontconfig-2.2.92/doc/Makefile.am Mon Oct 27 10:44:08 2003
+++ ./doc/Makefile.am Thu Mar 4 10:56:44 2004
@@ -21,6 +21,10 @@
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
+CC = @CC_FOR_BUILD@
+EXEEXT = @EXEEXT_FOR_BUILD@
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+
DOC_SRC = $(srcdir)
DOC_MODULE = fontconfig
DOC2HTML = docbook2html
@@ -87,7 +91,7 @@
.fncs.sgml:
$(RM) $@
- ./edit-sgml $(FNCS_TMPL) < '$<' > $*.sgml
+ ./edit-sgml$(EXEEXT) $(FNCS_TMPL) < '$<' > $*.sgml
.sgml.txt:
$(RM) $@
@@ -104,7 +108,7 @@
local-fontconfig-devel.sgml: fontconfig-devel.sgml
$(LN_S) $< $@
-$(DOC_FUNCS_SGML): edit-sgml $(FNCS_TMPL)
+$(DOC_FUNCS_SGML): edit-sgml$(EXEEXT) $(FNCS_TMPL)
fonts-conf.5: local-fontconfig-user.sgml version.sgml confdir.sgml
$(RM) $@
diff -Naurd ../fontconfig-2.2.92/src/fontconfig.def.in ./src/fontconfig.def.in
--- ../fontconfig-2.2.92/src/fontconfig.def.in Fri Aug 15 20:45:20 2003
+++ ./src/fontconfig.def.in Thu Mar 4 11:55:33 2004
@@ -159,5 +159,5 @@
FcValueEqual
FcValuePrint
FcValueSave
-LIBRARY fontconfig
+LIBRARY libfontconfig- at LT_CURRENT_MINUS_AGE@
VERSION @LT_CURRENT at .@LT_REVISION@
More information about the Fontconfig
mailing list