CUSTOMIZE 5.4 KB

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