|
Packit |
cf904d |
How to customize the compilation of the library
|
|
Packit |
cf904d |
===============================================
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
FreeType is highly customizable to fit various needs, and this
|
|
Packit |
cf904d |
document describes how it is possible to select options and
|
|
Packit |
cf904d |
components at compilation time.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
I. Configuration macros
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
The file `include/freetype/config/ftoption.h' contains a list of
|
|
Packit |
cf904d |
commented configuration macros that can be toggled by developers to
|
|
Packit |
cf904d |
indicate which features should be active while building the library.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
These options range from debug level to availability of certain
|
|
Packit |
cf904d |
features, like native TrueType hinting through a bytecode
|
|
Packit |
cf904d |
interpreter.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
We invite you to read this file for more information. You can
|
|
Packit |
cf904d |
change the file's content to suit your needs, or override it with
|
|
Packit |
cf904d |
one of the techniques described below.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
II. Modules list
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
If you use GNU make please edit the top-level file `modules.cfg'.
|
|
Packit |
cf904d |
It contains a list of available FreeType modules and extensions to
|
|
Packit |
cf904d |
be compiled. Change it to suit your own preferences. Be aware that
|
|
Packit |
cf904d |
certain modules depend on others, as described in the file. GNU
|
|
Packit |
cf904d |
make uses `modules.cfg' to generate `ftmodule.h' (in the object
|
|
Packit |
cf904d |
directory).
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
If you build FreeType in a directory separate from the source files,
|
|
Packit |
cf904d |
put your customized `modules.cfg' in that directory; that way you
|
|
Packit |
cf904d |
can keep the source files `clean'.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
If you don't use GNU make you have to manually edit the file
|
|
Packit |
cf904d |
`include/freetype/config/ftmodule.h' (which is *not* used with if
|
|
Packit |
cf904d |
compiled with GNU make) to add or remove the drivers and components
|
|
Packit |
cf904d |
you want to compile into the library. See `INSTALL.ANY' for more
|
|
Packit |
cf904d |
information.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
III. System interface
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
FreeType's default interface to the system (i.e., the parts that
|
|
Packit |
cf904d |
deal with memory management and i/o streams) is located in
|
|
Packit |
cf904d |
`src/base/ftsystem.c'.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
The current implementation uses standard C library calls to manage
|
|
Packit |
cf904d |
memory and to read font files. It is however possible to write
|
|
Packit |
cf904d |
custom implementations to suit specific systems.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
To tell the GNU Make-based build system to use a custom system
|
|
Packit |
cf904d |
interface, you have to define the environment variable FTSYS_SRC to
|
|
Packit |
cf904d |
point to the relevant implementation:
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
on Unix:
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
./configure <your options>
|
|
Packit |
cf904d |
export FTSYS_SRC=foo/my_ftsystem.c
|
|
Packit |
cf904d |
make
|
|
Packit |
cf904d |
make install
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
on Windows:
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
make setup <compiler>
|
|
Packit |
cf904d |
set FTSYS_SRC=foo/my_ftsystem.c
|
|
Packit |
cf904d |
make
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
IV. Overriding default configuration and module headers
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
It is possible to override the default configuration and module
|
|
Packit |
cf904d |
headers without changing the original files. There are three ways
|
|
Packit |
cf904d |
to do that:
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
1. With GNU make
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
[This is actually a combination of method 2 and 3.]
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
Just put your custom `ftoption.h' file into the objects directory
|
|
Packit |
cf904d |
(normally `<topdir>/objs' if you build in the source tree, or the
|
|
Packit |
cf904d |
directory where you invoke configure if you build in a separate
|
|
Packit |
cf904d |
directory), which GNU make prefers over the standard location. No
|
|
Packit |
cf904d |
action is needed for `ftmodule.h' because it is generated
|
|
Packit |
cf904d |
automatically in the objects directory.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
2. Using the C include path
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
Use the C include path to ensure that your own versions of the
|
|
Packit |
cf904d |
files are used at compile time when the lines
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
#include FT_CONFIG_OPTIONS_H
|
|
Packit |
cf904d |
#include FT_CONFIG_MODULES_H
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
are compiled. Their default values being
|
|
Packit |
cf904d |
<freetype/config/ftoption.h> and <freetype/config/ftmodule.h>, you
|
|
Packit |
cf904d |
can do something like:
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
custom/
|
|
Packit |
cf904d |
config/
|
|
Packit |
cf904d |
ftoption.h => custom options header
|
|
Packit |
cf904d |
ftmodule.h => custom modules list
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
include/ => normal FreeType 2 include
|
|
Packit |
cf904d |
...
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
then change the C include path to always give the path to `custom'
|
|
Packit |
cf904d |
before the FreeType 2 `include'.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
3. Redefining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
Another way to do the same thing is to redefine the macros used to
|
|
Packit |
cf904d |
name the configuration headers. To do so, you need a custom
|
|
Packit |
cf904d |
`ft2build.h' whose content can be as simple as:
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
#ifndef FT2_BUILD_MY_PLATFORM_H_
|
|
Packit |
cf904d |
#define FT2_BUILD_MY_PLATFORM_H_
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
#define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
|
|
Packit |
cf904d |
#define FT_CONFIG_MODULES_H <custom/my-ftmodule.h>
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
#include <freetype/config/ftheader.h>
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
#endif /* FT2_BUILD_MY_PLATFORM_H_ */
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
Place those files in a separate directory, e.g.,
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
custom/
|
|
Packit |
cf904d |
ft2build.h => custom version described above
|
|
Packit |
cf904d |
my-ftoption.h => custom options header
|
|
Packit |
cf904d |
my-ftmodule.h => custom modules list header
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
and change the C include path to ensure that `custom' is always
|
|
Packit |
cf904d |
placed before the FT2 `include' during compilation.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
----------------------------------------------------------------------
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
Copyright 2003-2017 by
|
|
Packit |
cf904d |
David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
This file is part of the FreeType project, and may only be used,
|
|
Packit |
cf904d |
modified, and distributed under the terms of the FreeType project
|
|
Packit |
cf904d |
license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
Packit |
cf904d |
this file you indicate that you have read the license and understand
|
|
Packit |
cf904d |
and accept it fully.
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
|
|
Packit |
cf904d |
--- end of CUSTOMIZE ---
|