Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 How to customize the compilation of the library
2 ===============================================
4 FreeType is highly customizable to fit various needs, and this
5 document describes how it is possible to select options and
6 components at compilation time.
9 I. Configuration macros
11 The file found in `include/config/ftoption.h' contains a list of
12 commented configuration macros that can be toggled by developers to
13 indicate which features should be active while building the library.
15 These options range from debug level to availability of certain
16 features, like native TrueType hinting through a bytecode
17 interpreter.
19 We invite you to read this file for more information. You can
20 change the file's content to suit your needs, or override it with
21 one of the techniques described below.
24 II. Modules list
26 If you use GNU make please edit the top-level file `modules.cfg'.
27 It contains a list of available FreeType modules and extensions to
28 be compiled. Change it to suit your own preferences. Be aware that
29 certain modules depend on others, as described in the file. GNU
30 make uses `modules.cfg' to generate `ftmodule.h' (in the object
31 directory).
33 If you build FreeType in a directory separate from the source files,
34 put your customized `modules.cfg' in that directory; that way you
35 can keep the source files `clean'.
37 If you don't use GNU make you have to manually edit the file
38 `include/config/ftmodule.h' (which is *not* used with if compiled
39 with GNU make) to add or remove the drivers and components you want
40 to compile into the library. See `INSTALL.ANY' for more
41 information.
44 III. System interface
46 FreeType's default interface to the system (i.e., the parts that
47 deal with memory management and i/o streams) is located in
48 `src/base/ftsystem.c'.
50 The current implementation uses standard C library calls to manage
51 memory and to read font files. It is however possible to write
52 custom implementations to suit specific systems.
54 To tell the GNU Make-based build system to use a custom system
55 interface, you have to define the environment variable FTSYS_SRC to
56 point to the relevant implementation:
58 on Unix:
60 ./configure <your options>
61 export FTSYS_SRC=foo/my_ftsystem.c
62 make
63 make install
65 on Windows:
67 make setup <compiler>
68 set FTSYS_SRC=foo/my_ftsystem.c
69 make
72 IV. Overriding default configuration and module headers
74 It is possible to override the default configuration and module
75 headers without changing the original files. There are three ways
76 to do that:
79 1. With GNU make
81 [This is actually a combination of method 2 and 3.]
83 Just put your custom `ftoption.h' file into the objects directory
84 (normally `<topdir>/objs' if you build in the source tree, or the
85 directory where you invoke configure if you build in a separate
86 directory), which GNU make prefers over the standard location. No
87 action is needed for `ftmodule.h' because it is generated
88 automatically in the objects directory.
90 2. Using the C include path
92 Use the C include path to ensure that your own versions of the
93 files are used at compile time when the lines
95 #include FT_CONFIG_OPTIONS_H
96 #include FT_CONFIG_MODULES_H
98 are compiled. Their default values being <config/ftoption.h> and
99 <config/ftmodule.h>, you can do something like:
101 custom/
102 config/
103 ftoption.h => custom options header
104 ftmodule.h => custom modules list
106 include/ => normal FreeType 2 include
107 ...
109 then change the C include path to always give the path to `custom'
110 before the FreeType 2 `include'.
113 3. Redefining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
115 Another way to do the same thing is to redefine the macros used to
116 name the configuration headers. To do so, you need a custom
117 `ft2build.h' whose content can be as simple as:
119 #ifndef __FT2_BUILD_MY_PLATFORM_H__
120 #define __FT2_BUILD_MY_PLATFORM_H__
122 #define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
123 #define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
125 #include <config/ftheader.h>
127 #endif /* __FT2_BUILD_MY_PLATFORM_H__ */
129 Place those files in a separate directory, e.g.,
131 custom/
132 ft2build.h => custom version described above
133 my-ftoption.h => custom options header
134 my-ftmodule.h => custom modules list header
136 and change the C include path to ensure that `custom' is always
137 placed before the FT2 `include' during compilation.
139 ----------------------------------------------------------------------
141 Copyright 2003, 2005, 2006, 2012, 2013 by
142 David Turner, Robert Wilhelm, and Werner Lemberg.
144 This file is part of the FreeType project, and may only be used,
145 modified, and distributed under the terms of the FreeType project
146 license, LICENSE.TXT. By continuing to use, modify, or distribute
147 this file you indicate that you have read the license and understand
148 and accept it fully.
151 --- end of CUSTOMIZE ---