Bug 13791 - fontconfig's code generators unnecessarily depend on freetype
Summary: fontconfig's code generators unnecessarily depend on freetype
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.5
Hardware: All All
: medium major
Assignee: Keith Packard
QA Contact:
URL:
Whiteboard:
Keywords: janitor, patch
Depends on:
Blocks:
 
Reported: 2007-12-22 13:45 UTC by Volker Grabsch
Modified: 2010-10-08 15:50 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
enable cross compiling by removing freetype dependencies from the code generators (6.42 KB, patch)
2007-12-22 13:47 UTC, Volker Grabsch
Details | Splinter Review
Split out the Freetype dependent internal functions to fcftint.h (5.64 KB, patch)
2007-12-23 14:09 UTC, Keith Packard
Details | Splinter Review
Extension to the second patch to work properly (2.26 KB, patch)
2008-01-02 08:26 UTC, Volker Grabsch
Details | Splinter Review

Description Volker Grabsch 2007-12-22 13:45:15 UTC
I maintain a MinGW cross compiling environment (http://www.profv.de/mingw_cross_env/) and it works with versions up to fontconfig-2.4.2 like a charm. However, the versions 2.4.9x and 2.5.0 break.

When cross compiling fontconfig 2.5.0, the code generators of fontconfig depend on freetype. This is a big problem, because the FREETYPE_* variables (as determined by ./configure) point to the cross-compiled freetype instead of the native freetype. Luckily, the code generators don't really have this dependency. It is merely introduced as a side effect by "fcint.h".

The simplest solution is not to include FREETYPE_CFLAGS in the Makefile.am/in of fc-case, fc-arch, etc. and to define a symbol NOFREETYPE instead. Then "fcint.h" just needs to exclude any freetype dependent code if NOFREETYPE is defined.

This patch for fontconfig-2.5.0 does exactly that:

http://www.profv.de/fontconfig-crosscompile-patch/
Comment 1 Volker Grabsch 2007-12-22 13:47:09 UTC
Created attachment 13316 [details] [review]
enable cross compiling by removing freetype dependencies from the code generators

When cross compiling fontconfig 2.5.0, the code generators of fontconfig depend on freetype. This is a big problem, because the FREETYPE_* variables (as determined by ./configure) point to the cross-compiled freetype instead of the native freetype. Luckily, the code generators don't really have this dependency. It is merely introduced as a side effect by "fcint.h".

The simplest solution is not to include FREETYPE_CFLAGS in the Makefile.am/in of fc-case, fc-arch, etc. and to define a symbol NOFREETYPE instead. Then "fcint.h" just needs to exclude any freetype dependent code if NOFREETYPE is defined.

This patch for fontconfig-2.5.0 does exactly that.
Comment 2 Keith Packard 2007-12-23 14:07:03 UTC
I think a better solution is to eliminate fcfreetype.h from fcint.h and instead create a new fcftint.h file that provides the freetype-specific internal functions for use by the library. I'll attach a patch that does that, please test and verify that it provides the necessary separation.
Comment 3 Keith Packard 2007-12-23 14:09:38 UTC
Created attachment 13334 [details] [review]
Split out the Freetype dependent internal functions to fcftint.h

This patch creates fcftint.h, which defines the internal freetype-specific APIs used within the fontconfig library. Portions of fontconfig which do not touch freetype APIs need not use this file.
Comment 4 Volker Grabsch 2008-01-02 08:23:46 UTC
(Sorry for replying so late.)

(In reply to comment #2)
> please test and verify that it provides the necessary separation.

Your patch doesn't work because you forgot to remove '$(FREETYPE_CFLAGS)' from the fc-*/Makefile.am files. I created an additional patch which solves that problem. Both patches in combination seem to work properly.
Comment 5 Volker Grabsch 2008-01-02 08:26:13 UTC
Created attachment 13459 [details] [review]
Extension to the second patch to work properly
Comment 6 Volker Grabsch 2008-01-09 07:35:50 UTC
The current fontconfig git master works fine. Thank you for including my patch.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.