:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / subsys / win32k / freetype / docs / build
1 FreeType 2 compilation how-to
2
3
4 Introduction:
5
6 Welcome to this new beta of the FreeType 2 library. You'll find in this
7 document instructions on how to compile the library on your favorite
8 platform.
9
10   *** UNIX USERS : Even though the FT2 build system doesn't
11   ************** : use the Autoconf/Automake tools, these will
12   ************** : be introduced in the Unix-specific parts of
13   ************** : the build in our final release..
14
15
16 I. QUICK COMMAND-LINE GUIDE:
17 ----------------------------
18
19   Install GNU Make, then try the following on Unix or any system with gcc:
20
21      make    // this will setup the build
22      make    // this will build the library
23
24   On Win32+Visual C++:
25
26      make setup visualc    // setup the build for VisualC++ on Win32
27      make                  // build the library
28
29   Then, go to the "demos" directory and type
30
31      make
32
33   To compile the demo programs..
34
35   If this doesn't work, read the following..
36
37
38
39 II. COMMAND-LINE COMPILATION:
40 -----------------------------
41
42   Note that if you do not want to compile FreeType 2 from a command line
43   shell, please skip to section III below (DETAILED COMPILATION)
44
45   FreeType 2 includes a powerful and flexible build system that allows you
46   to easily compile it on a great variety of platforms from the command
47   line. To do so, just follow these simple instructions:
48
49   a/ Install GNU Make:
50
51      Because GNU Make is the only Make tool supported to compile FreeType 2,
52      you should install it on your machine.
53
54      Because the FT2 build system relies on many important features of GNU
55      Make, trying to build the library with any other Make tool will *fail*.
56
57
58   b/ Invoke "make":
59
60      Go to the root FT2 directory, then simply invoke GNU Make from the
61      command line, this will launch the FreeType 2 Host Platform detection
62      routines. A summary will be displayed, for example, on Win32:
63
64      ========================================================================
65         FreeType build system -- automatic system detection
66
67         The following settings are used:
68
69           platform                     win32
70           compiler                     gcc
71           configuration directory      ./builds/win32
72           configuration rules          ./builds/win32/w32-gcc.mk
73
74         If this does not correspond to your system or settings please remove
75         the file 'config.mk' from this directory then read the INSTALL file
76         for help.
77
78         Otherwise, simply type 'make' again to build the library.
79      =========================================================================
80
81      If the detected settings correspond to your platform and compiler,
82      skip to step e/. Note that if your platform is completely alien to
83      the build system, the detected platform will be "ansi".
84
85
86   c/ Configure the build system for a different compiler:
87
88      If the build system correctly detected your platform, but you want to
89      use a different compiler than the one specified in the summary (for
90      most platforms, gcc is the defaut compiler), simply invoke GNU Make
91      like :
92
93          make setup <compiler>
94
95      For example:
96
97             to use Visual C++ on Win32, type:  "make setup visualc"
98             to use LCC-Win32 on Win32, type:   "make setup lcc"
99
100      The <compiler> name to use is platform-dependent. The list of available
101      compilers for your system is available in the file
102      "builds/<system>/detect.mk" (note that we hope to make the list
103      displayed at user demand in the final release)..
104
105      If you're satisfying by the new configuration summary, skip to step e/
106
107
108   d/ Configure the build system for an unknown platform/compiler:
109
110      What the auto-detection/setup phase of the build system does is simply
111      copy a file to the current directory under the name "config.mk".
112
113      For example, on OS/2+gcc, it would simply copy "builds/os2/os2-gcc.mk"
114      to "./config.mk"
115
116      If for some reason your platform isn't correctly detected, simply copy
117      manually the configuration sub-makefile to "./config.mk" and go to
118      step e/.
119
120      Note that this file is a sub-Makefile used to specify Make variables
121      used to invoke the compiler and linker during the build, you can easily
122      create your own version from one of the existing configuration files,
123      then copy it to the current directory under the name "./config.mk".
124
125
126   e/ Build the library:
127
128      The auto-detection/setup phase should have copied a file in the current
129      directory, called "./config.mk". This file contains definitions of various
130      Make variables used to invoke the compiler and linker during the build.
131
132      To launch the build, simply invoke GNU Make again: the top Makefile will
133      detect the configuration file and run the build with it..
134
135
136   f/ Build the demonstration programs:
137
138      Once the library is compiled, go to "demos", then invoke GNU Make.
139
140      Note that the demonstration programs include a tiny graphics sub-system
141      that includes "drivers" to display Windows on Win32, X11 and OS/2. The
142      build system should automatically detect which driver to use based on
143      the current platform.
144
145      UNIX USERS TAKE NOTE: XXXXXX
146
147      When building the demos, the build system tries to detect your X11 path
148      by looking for the patterns "X11R5/bin", "X11R6/bin" or "X11/bin" in
149      your current path. If no X11 path is found, the demo programs will not
150      be able to display graphics and will fail. Change your current path
151      if you encounter this problem.
152
153      Note that the release version will use Autoconf to detect everything
154      on Unix, so this will not be necessary !!
155
156
157 II. DETAILED COMPILATION PROCEDURE:
158 -----------------------------------
159
160   If you don't want to compile FreeType 2 from the command-line (for example
161   from a graphical IDE on a Mac or Windows), you'll need to understand how the
162   FreeType files are organized.
163
164   FreeType 2 has a very module design, and it is made of several components.
165   Each component must be compiled as a stand-alone object file, even when it
166   is really made of several C source files. For example, the "base layer"
167   component is made of the following C files:
168
169     src/
170       base/
171         ftcalc.c    - computations
172         ftobjs.c    - object management
173         ftstream.c  - stream input
174         ftlist.c    - simple list management
175         ftoutln.c   - simple outline processing
176         ftextend.c  - extensions support
177
178   However, you can create a single object file by compiling the file
179   "src/base/ftbase.c", whose content is basically:
180
181         #include <base/ftcalc.c>
182         #include <base/ftobjs.c>
183         #include <base/ftstream.c>
184         #include <base/ftlist.c>
185         #include <base/ftoutln.c>
186         #include <base/ftextend.c>
187
188   Similarly, each component has a single "englobing" C file to compile it
189   as a stand-alone object, i.e. :
190
191      src/base/ftbase.c         - the base layer, high-level interface
192      src/sfnt/sfnt.c           - the "sfnt" module
193      src/psnames/psnames.c     - the Postscript Names module
194      src/truetype/truetype.c   - the TrueType font driver
195      src/type1/type1.c         - the Type 1 font driver
196
197
198   To compile one component, do the following:
199
200    - add the top-level "include" directory to your compilation include path
201
202    - add the "src" directory to your compilation include path.
203
204    - compile the component "source" file (see list below), you don't need
205      to be in the component's directory..
206
207   For example, the following line can be used to compile the truetype driver
208   on Unix:
209
210      cd freetype2/
211      cc -c -Iinclude -Isrc  src/truetype/truetype.c
212
213   Alternatively:
214
215      cd freetype2/src/truetype
216      cc -c -I../../include -I.. truetype.c
217
218   The complete list of files to compile for a feature-complete build of
219   FreeType 2 is:
220
221      src/base/ftsystem.c         - system-specific memory and i/o support
222      src/base/ftinit.c           - initialisation layer
223      src/base/ftdebug.c          - debugging component (empty in release build)
224      src/base/ftbase.c           - the "base layer" component
225      src/base/ftglyph.c          - optional convenience functions
226      src/raster1/raster1.c       - the monochrome bitmap renderer
227      src/smooth/smooth.c         - the anti-aliased bitmap renderer
228      src/sfnt/sfnt.c             - the "sfnt" module
229      src/psnames/psnames.c       - the "psnames" module
230      src/truetype/truetype.c     - the TrueType font driver
231      src/type1/type1.c           - the Type 1 font driver (incl. Multiple Masters)
232      src/cid/type1cid.c          - the Type 1 CID-keyed font driver
233      src/cff/cff.c               - the OpenType/CFF/CEF font driver
234      src/winfonts/winfnt.c       - the Windows FNT/FON font driver
235
236   All font drivers are optional. the "sfnt" and "psnames" modules are
237   mandatory for certain drivers.
238
239
240 III. Support for flat-directory compilation:
241 ----------------------------------------
242
243   It is now possible to put all FreeType 2 source files into a single
244   directory, with the exception of the "include" hierarchy.
245
246   Note that you'll still need to only compile the 'wrapper' sources described
247   above. Define the "FT_FLAT_COMPILE" macro when compiling. Here's an
248   example:
249   
250    1/ Copy all files in current directory:
251    
252      cp freetype2/src/base/*.[hc] .
253      cp freetype2/src/raster1/*.[hc] .
254      cp freetype2/src/smooth/*.[hc] .
255      etc...
256
257    2/ Compile sources:
258         
259      cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftsystem.c
260      cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftinit.c
261      cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftdebug.c
262      cc -c -DFT_FLAT_COMPILE -Ifreetype/include ftbase.c
263      etc...
264