diff --git a/docs/internals/build-system.html b/docs/internals/build-system.html new file mode 100644 index 000000000..b80f2c160 --- /dev/null +++ b/docs/internals/build-system.html @@ -0,0 +1,359 @@ + + +
+ + + +
+
+ +
+
+
+
+ We strongly recommend the following article:
+
+ To understand why such a layout was chosen. +
+ +
+ You don't need a Unix-like shell on your platform. + For example, FreeType 2 already compiles on Unix, Dos, Windows + and OS/2 right "out of the box" (assuming you have GNU Make + installed). +
+ Note that we have no plans to support a different + make tool, as you'll rapidly understand by reading this + document or looking at the Makefiles themselves. +
+
+ + + The build system features some important points, which are all detailed + in the following sections:
+
+ The configuration sub-makefile can be regenerated any time + by invoking "make setup", which will re-run the + detection rules even if a config.mk is already present. +
+ + +
+ For example, on Win32 platforms:
+
make setup + | Will generate a config.mk that + can be used to compile the library with + gcc (which is the default + compiler for most supported platforms). + + |
make setup visualc + | Will generate a different config.mk + that can be used to compile the library + with the Visual C++ command-line compiler. + + |
make setup lcc + | Will generate a different config.mk + that can be used to compile the library + with the Win32-LCC compiler. + |
+ + + +
+ The list of font drivers is located in the file + "freetype2/config/system/ftmodule.h", however + it can be regenerated on-demand. Adding a new module to the + FreeType source tree is thus as easy as:
+
+ +
+
+ +
+ Otherwise, the file freetype2/config/detect.mk is included + and parsed. Its purpose is to:
+
+ +
+ This is illustrated by the following graphics :
+
+ Note that each system-specific detect.mk is in charge + of copying a valid configuration makefile to the current directory + (i.e. the one where make was invoked), depending on the + current targets. For example, the Win32 detect.mk will + be able to detect a "visualc" or "lcc" target, + as described in section I. Similarly, the OS/2 detect.mk + can detect targets like "borlandc", "watcom" + or "visualage", etc.. +
+ +
+ The latter defines a number of important variables that describe + the compilation process to the build system. Among other things:
+
+ +
+ +
+ Once these variable are defined, config.mk test for the + definition of the BUILD_FREETYPE variable. If it exists, + the makefile then includes "freetype2/config/freetype.mk" + which contains the rules required to compile the library. +
+ Note that freetype.mk also scans the subdirectories of + "freetype2/src" for a file called "rules.mk". + Each rules.mk contains, as it names suggests, the rules + required to compile a given font driver or module. +
+ Once all this parsing is done, the library can be compiled. Usually, + each font driver is compiled as a standalone object file (e.g. + sfnt.o, truetype.o and type1.o). +
+ This process can be illustrated by the following graphics:
+
+
+ +
+ However, when the function FT_Init_FreeType is invoked at + the start of an application, it must create a new FT_Library + object, and registers all known font drivers to it by + repeatly calling FT_Add_Driver. +
+ The list of known drivers is located in the file + "freetype2/config/system/ftmodule.h", and is used + exclusively by the internal function FT_Default_Drivers. The + list in ftmodule.h must be re-generated each time you add + or remove a module from freetype2/src. +
+ This is normally performed by invoking the top-level Makefile + with the modules target, as in:
+
+ This will trigger a special rule that will re-generate + ftmodule.h. To do so, the Makefile will parse all module + directories for a file called "module.mk". Each + module.mk is a tiny sub-Makefile used to add a single + module to the driver list. +
+ This is illustrated by the following graphics:
+
+ Note that the new list of modules is displayed in a very human-friendly + way after a "make modules". Here's an example with the current + source tree (on 11 Jan 2000):
+
+Regenerating the font drivers list in ./config/unix/ftmodule.h +* driver: sfnt ( pseudo-driver for TrueType & OpenType formats ) +* driver: truetype ( Windows/Mac font files with extension *.ttf or *.ttc ) +* driver: type1 ( Postscript font files with extension *.pfa or *.pfb ) +-- done -- ++ + + +
+ +
+ This section describes how the demonstration programs are compiled, + using the configuration freetype2/config.mk and their own + freetype2/demos/Makefile. +
+ To compile the demonstration programs, after the library, + simply go to freetype2/demos then invoke GNU make with no + arguments. +
+ The top-level Makefile will detect the config.mk in the + upper directory and include it. Because it doesn't define + the BUILD_FREETYPE variable, this will not force the + inclusion of freetype2/config/freetype.mk as described in + the previous section. +
+ the Makefile will then include the makefile called + "freetype2/demos/graph/rules.mk". The graphics rules.mk + defines the rules required to compile the graphics sub-system. +
+ Because the graphics syb-system is also designed modularly, it is able + to use any number of "modules" to display surfaces on the screen. + The graphics modules are located in the subdirectories of + freetype2/demos/config. Each such directory contains a file + named rules.mk which is in charge of:
+
+
+ When the graph library is built in demos/obj, the + demonstration programs executables are generated by the top-level + Makefile. +
+ This is illustrated by the following graphics:
+