blob: 51d769f3877cd702bd318c151e6926cd586625b1 [file] [log] [blame]
Werner Lemberga7235262005-08-30 00:22:46 +00001How to customize the compilation of the library
2===============================================
David Turner66cbc202003-03-20 07:04:40 +00003
Werner Lemberg59939242006-01-31 20:17:42 +00004 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.
David Turner66cbc202003-03-20 07:04:40 +00007
8
Werner Lemberga16c4a72003-04-21 13:30:27 +00009I. Configuration macros
David Turner66cbc202003-03-20 07:04:40 +000010
Werner Lemberg392cf222015-06-25 13:04:57 +020011 The file `include/freetype/config/ftoption.h' contains a list of
Werner Lembergfae38202013-11-13 08:55:46 +010012 commented configuration macros that can be toggled by developers to
13 indicate which features should be active while building the library.
Werner Lemberg9b774e22007-01-16 06:11:27 +000014
Werner Lemberg59939242006-01-31 20:17:42 +000015 These options range from debug level to availability of certain
16 features, like native TrueType hinting through a bytecode
17 interpreter.
Werner Lemberg9b774e22007-01-16 06:11:27 +000018
Werner Lemberg59939242006-01-31 20:17:42 +000019 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.
David Turner66cbc202003-03-20 07:04:40 +000022
Werner Lemberg9b774e22007-01-16 06:11:27 +000023
Werner Lemberga16c4a72003-04-21 13:30:27 +000024II. Modules list
David Turner66cbc202003-03-20 07:04:40 +000025
Werner Lemberg59939242006-01-31 20:17:42 +000026 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).
David Turner66cbc202003-03-20 07:04:40 +000032
Del Merritt74e6a1f2012-11-30 15:29:33 +010033 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'.
36
Werner Lemberg59939242006-01-31 20:17:42 +000037 If you don't use GNU make you have to manually edit the file
Werner Lemberg392cf222015-06-25 13:04:57 +020038 `include/freetype/config/ftmodule.h' (which is *not* used with if
Werner Lemberg8502c982015-06-22 06:35:23 +020039 compiled with GNU make) to add or remove the drivers and components
40 you want to compile into the library. See `INSTALL.ANY' for more
Werner Lemberg59939242006-01-31 20:17:42 +000041 information.
Werner Lemberga7235262005-08-30 00:22:46 +000042
David Turner66cbc202003-03-20 07:04:40 +000043
Werner Lemberga16c4a72003-04-21 13:30:27 +000044III. System interface
David Turner66cbc202003-03-20 07:04:40 +000045
Werner Lemberg59939242006-01-31 20:17:42 +000046 FreeType's default interface to the system (i.e., the parts that
47 deal with memory management and i/o streams) is located in
Werner Lemberga7235262005-08-30 00:22:46 +000048 `src/base/ftsystem.c'.
Werner Lemberg9b774e22007-01-16 06:11:27 +000049
Werner Lemberg59939242006-01-31 20:17:42 +000050 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.
David Turner66cbc202003-03-20 07:04:40 +000053
Werner Lemberg59939242006-01-31 20:17:42 +000054 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
Werner Lemberga16c4a72003-04-21 13:30:27 +000056 point to the relevant implementation:
Werner Lemberg9b774e22007-01-16 06:11:27 +000057
Werner Lemberga16c4a72003-04-21 13:30:27 +000058 on Unix:
59
60 ./configure <your options>
61 export FTSYS_SRC=foo/my_ftsystem.c
62 make
63 make install
Werner Lemberg9b774e22007-01-16 06:11:27 +000064
Werner Lemberga16c4a72003-04-21 13:30:27 +000065 on Windows:
66
67 make setup <compiler>
68 set FTSYS_SRC=foo/my_ftsystem.c
69 make
Werner Lemberg9b774e22007-01-16 06:11:27 +000070
71
Werner Lemberga16c4a72003-04-21 13:30:27 +000072IV. Overriding default configuration and module headers
David Turner66cbc202003-03-20 07:04:40 +000073
Werner Lemberg59939242006-01-31 20:17:42 +000074 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:
David Turner66cbc202003-03-20 07:04:40 +000077
Werner Lemberga16c4a72003-04-21 13:30:27 +000078
Werner Lemberg59939242006-01-31 20:17:42 +000079 1. With GNU make
80
81 [This is actually a combination of method 2 and 3.]
82
Del Merritt74e6a1f2012-11-30 15:29:33 +010083 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.
Werner Lemberg59939242006-01-31 20:17:42 +000089
90 2. Using the C include path
Werner Lemberg9b774e22007-01-16 06:11:27 +000091
Werner Lemberg59939242006-01-31 20:17:42 +000092 Use the C include path to ensure that your own versions of the
93 files are used at compile time when the lines
Werner Lemberg9b774e22007-01-16 06:11:27 +000094
Werner Lemberga7235262005-08-30 00:22:46 +000095 #include FT_CONFIG_OPTIONS_H
96 #include FT_CONFIG_MODULES_H
David Turner66cbc202003-03-20 07:04:40 +000097
Werner Lemberg8502c982015-06-22 06:35:23 +020098 are compiled. Their default values being
Werner Lemberg392cf222015-06-25 13:04:57 +020099 <freetype/config/ftoption.h> and <freetype/config/ftmodule.h>, you
100 can do something like:
David Turner66cbc202003-03-20 07:04:40 +0000101
Werner Lemberga7235262005-08-30 00:22:46 +0000102 custom/
Werner Lembergfae38202013-11-13 08:55:46 +0100103 config/
104 ftoption.h => custom options header
105 ftmodule.h => custom modules list
Werner Lemberg9b774e22007-01-16 06:11:27 +0000106
Werner Lemberga7235262005-08-30 00:22:46 +0000107 include/ => normal FreeType 2 include
Werner Lembergfae38202013-11-13 08:55:46 +0100108 ...
David Turner66cbc202003-03-20 07:04:40 +0000109
Werner Lemberg59939242006-01-31 20:17:42 +0000110 then change the C include path to always give the path to `custom'
Werner Lemberga7235262005-08-30 00:22:46 +0000111 before the FreeType 2 `include'.
David Turner66cbc202003-03-20 07:04:40 +0000112
113
Werner Lemberg59939242006-01-31 20:17:42 +0000114 3. Redefining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
Werner Lemberg9b774e22007-01-16 06:11:27 +0000115
Werner Lemberg59939242006-01-31 20:17:42 +0000116 Another way to do the same thing is to redefine the macros used to
117 name the configuration headers. To do so, you need a custom
Werner Lemberga7235262005-08-30 00:22:46 +0000118 `ft2build.h' whose content can be as simple as:
Werner Lemberg9b774e22007-01-16 06:11:27 +0000119
Werner Lemberg37412ff2016-01-12 21:37:13 +0100120 #ifndef FT2_BUILD_MY_PLATFORM_H_
121 #define FT2_BUILD_MY_PLATFORM_H_
David Turner66cbc202003-03-20 07:04:40 +0000122
Werner Lemberge42dbce2003-11-09 08:37:14 +0000123 #define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
124 #define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
David Turner66cbc202003-03-20 07:04:40 +0000125
Werner Lemberg392cf222015-06-25 13:04:57 +0200126 #include <freetype/config/ftheader.h>
David Turner66cbc202003-03-20 07:04:40 +0000127
Werner Lemberg37412ff2016-01-12 21:37:13 +0100128 #endif /* FT2_BUILD_MY_PLATFORM_H_ */
Werner Lemberg9b774e22007-01-16 06:11:27 +0000129
Werner Lemberga7235262005-08-30 00:22:46 +0000130 Place those files in a separate directory, e.g.,
Werner Lemberg9b774e22007-01-16 06:11:27 +0000131
Werner Lemberga16c4a72003-04-21 13:30:27 +0000132 custom/
133 ft2build.h => custom version described above
134 my-ftoption.h => custom options header
135 my-ftmodule.h => custom modules list header
David Turner66cbc202003-03-20 07:04:40 +0000136
Werner Lemberg59939242006-01-31 20:17:42 +0000137 and change the C include path to ensure that `custom' is always
Werner Lemberga7235262005-08-30 00:22:46 +0000138 placed before the FT2 `include' during compilation.
David Turner66cbc202003-03-20 07:04:40 +0000139
Werner Lemberg59939242006-01-31 20:17:42 +0000140----------------------------------------------------------------------
Werner Lemberg56c368c2005-06-04 23:00:25 +0000141
Werner Lembergf57fc592015-01-17 20:41:43 +0100142Copyright 2003-2015 by
Werner Lemberg56c368c2005-06-04 23:00:25 +0000143David Turner, Robert Wilhelm, and Werner Lemberg.
144
Werner Lemberg59939242006-01-31 20:17:42 +0000145This file is part of the FreeType project, and may only be used,
146modified, and distributed under the terms of the FreeType project
147license, LICENSE.TXT. By continuing to use, modify, or distribute
148this file you indicate that you have read the license and understand
149and accept it fully.
Werner Lemberg56c368c2005-06-04 23:00:25 +0000150
Werner Lemberga16c4a72003-04-21 13:30:27 +0000151
152--- end of CUSTOMIZE ---