Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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