source: trunk/third/freetype/docs/BUILD @ 17198

Revision 17198, 9.4 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17197, which included commits to RCS files with non-trunk default branches.
Line 
1
2                    FreeType 2 compilation how-to
3                    =============================
4
5
6Introduction
7------------
8
9Welcome  to the  FreeType 2  library.   You'll find  in this  document
10instructions on how to compile the library on your favorite platform.
11
12
13I. QUICK COMMAND-LINE GUIDE
14---------------------------
15
16  THE FOLLOWING WILL  ONLY WORK WITH GNU MAKE,  IT WILL FAIL MISERABLY
17  WITH OTHER MAKE TOOLS, FOR EXAMPLE "BSD MAKE".
18
19  Install GNU Make  (version 3.78.1 or newer), then  try the following
20  on Unix or any system with gcc:
21
22      make    // this will setup the build
23      make    // this will build the library
24
25  On Win32 + Visual C++:
26
27      make setup visualc    // setup the build for VisualC++ on Win32
28      make                  // build the library
29
30  Then, go to the `demos' directory and type
31
32      make
33
34
35  Note that on Unix, the  first `make' invocation will run a configure
36  script (which is located  in `freetype2/builds/unix/'.  You can also
37  pass parameters to this script with the CFG variable, as in:
38
39      make CFG="--prefix=/usr/local"
40      make
41
42
43  If this doesn't work, read the following.
44
45
46II. COMMAND-LINE COMPILATION
47----------------------------
48
49  Note that  if you do not want  to compile FreeType 2  from a command
50  line shell, please skip to section III below (DETAILED COMPILATION).
51
52  FreeType 2 includes a powerful and flexible build system that allows
53  you to  easily compile it on  a great variety of  platforms from the
54  command line.  To do so, just follow these simple instructions:
55
56  a. Install GNU Make
57
58    Because  GNU Make  is  the  only Make  tool  supported to  compile
59    FreeType 2, you should install it on your machine.
60
61    The FreeType 2 build system relies on many features special to GNU
62    Make -- trying to build the  library with any other Make tool will
63    *fail*.
64
65    NEARLY ALL OTHER MAKE TOOLS WILL FAIL, INCLUDING "BSD MAKE", SO
66    REALLY INSTALL A RECENT VERSION OF GNU MAKE ON YOUR SYSTEM!
67
68    Make sure that you are invoking GNU Make from the command line, by
69    typing something like:
70
71        make -v
72
73    to display its version number.
74
75    VERSION 3.78.1 OR NEWER IS NEEDED!
76
77  b. Invoke `make'
78
79    Go to  the root  directory of FreeType  2, then simply  invoke GNU
80    Make from the command line.   This will launch the FreeType 2 host
81    platform  detection routines.   A summary  will be  displayed, for
82    example, on Win32:
83
84
85        ==============================================================
86        FreeType build system -- automatic system detection
87
88        The following settings are used:
89
90          platform                     win32
91          compiler                     gcc
92          configuration directory      ./builds/win32
93          configuration rules          ./builds/win32/w32-gcc.mk
94
95        If this does not correspond to your system or settings please
96        remove the file 'config.mk' from this directory then read the
97        INSTALL file for help.
98
99        Otherwise, simply type 'make' again to build the library.
100        =============================================================
101
102
103    If the detected settings correspond to your platform and compiler,
104    skip to step e.  Note that if your platform is completely alien to
105    the build system, the detected platform will be `ansi'.
106
107  c. Configure the build system for a different compiler
108
109    If the build system correctly detected your platform, but you want
110    to use a different compiler  than the one specified in the summary
111    (for most platforms, gcc is  the defaut compiler), invoke GNU Make
112    with
113
114         make setup <compiler>
115
116    For example:
117
118        to use Visual C++ on Win32, type: "make setup visualc"
119        to use LCC-Win32 on Win32, type:  "make setup lcc"
120
121    The  <compiler> name to  use is  platform-dependent.  The  list of
122    available  compilers for  your  system is  available  in the  file
123    `builds/<system>/detect.mk' (note  that we  hope to make  the list
124    displayed at user demand in the final release).
125
126    If you  are satisfied  by the new  configuration summary,  skip to
127    step e.
128
129  d. Configure the build system for an unknown platform/compiler
130
131    The auto-detection/setup  phase of the build system  copies a file
132    to the current directory under the name `config.mk'.
133
134    For    example,    on    OS/2+gcc,    it   would    simply    copy
135    `builds/os2/os2-gcc.mk' to `./config.mk'.
136
137    If for  some reason your  platform isn't correctly  detected, copy
138    manually the configuration sub-makefile to `./config.mk' and go to
139    step e.
140
141    Note  that  this file  is  a  sub-Makefile  used to  specify  Make
142    variables  for compiler  and linker  invocation during  the build.
143    You can  easily create your own  version from one  of the existing
144    configuration files,  then copy it to the  current directory under
145    the name `./config.mk'.
146
147  e. Build the library
148
149    The auto-detection/setup  phase should have  copied a file  in the
150    current  directory,  called   `./config.mk'.  This  file  contains
151    definitions of various Make  variables used to invoke the compiler
152    and linker during the build.
153
154    To  launch  the build,  simply  invoke  GNU  Make again:  The  top
155    Makefile will detect the configuration file and run the build with
156    it.
157
158  f. Build the demonstration programs
159
160
161III. DETAILED COMPILATION PROCEDURE
162-----------------------------------
163
164  If you don't  want to compile FreeType 2  from the command-line (for
165  example if  you use a graphical IDE  on a Mac or  Windows), you will
166  need to understand how the FreeType files are organized.
167
168  FreeType 2  has a  very modular  design, and it  is made  of several
169  components.  Each component must be compiled as a stand-alone object
170  file, even  if it  is really  made of several  C source  files.  For
171  example,  the `base  layer' component  is  made of  the following  C
172  files:
173
174    src/
175      base/
176        ftcalc.c    - computations
177        ftextend.c  - extensions support
178        ftlist.c    - simple list management
179        ftobjs.c    - object management
180        ftoutln.c   - simple outline processing
181        ftstream.c  - stream input
182
183  However, you can  create a single object file  by compiling the file
184  `src/base/ftbase.c', which basically contains
185
186      #include "ftcalc.c"
187      #include "ftobjs.c"
188      #include "ftstream.c"
189      #include "ftlist.c"
190      #include "ftoutln.c"
191      #include "ftextend.c"
192
193  Similarly, each component has a single `englobing' C file to compile
194  it as a stand-alone object:
195
196    src/autohint/autohint.c   - the autohinting module
197    src/base/ftbase.c         - the base layer, high-level interface
198    src/cache/ftcache.c       - a glyph and image caching system
199                                (still experimental)
200    src/cff/cff.c             - the OpenType font driver
201    src/cid/type1cid.c        - the CID-keyed font driver
202    src/psaux/psaux.c         - the PS support module
203    src/psnames/psnames.c     - a support module to handle PS glyph
204                                names
205    src/raster1/raster1.c     - the monochrome raster module
206    src/sfnt/sfnt.c           - the `sfnt' module
207    src/smooth/smooth.c       - the anti-aliasing raster module
208    src/truetype/truetype.c   - the TrueType font driver
209    src/type1/type1.c         - the Type 1 font driver
210
211  The last module of  FreeType 2, `winfonts' (implementing support for
212  Windows FNT format), is a single file.
213
214  To compile one component, do the following:
215
216    - Add  the  top-level  `include'  directory  to  your  compilation
217      include path
218
219    - Add the `src/<component>'  directory to your compilation include
220      path, or simply `cd' to the component's source directory.
221
222    - Compile the component `source'  file (see list below); you don't
223      need  to   be  in  the   component's  directory  if   you  added
224      `src/<component>' to your include path.
225
226  For example, the following line  can be used to compile the truetype
227  driver on Unix:
228
229     cd freetype2/
230     cc -c -Iinclude -Isrc/truetype src/truetype/truetype.c
231
232  Alternatively:
233
234     cd freetype2/src/truetype
235     cc -c -I../../include truetype.c
236
237  Finally, FreeType 2 contains some other components:
238
239     src/base/ftsystem.c  - system-specific memory and i/o support
240     src/base/ftinit.c    - initialization layer
241     src/base/ftdebug.c   - debugging component (empty in release
242                            build)
243     src/base/ftglyph.c   - optional convenience functions
244
245  All font  drivers are optional.  The `sfnt',  `psaux', and `psnames'
246  modules are mandatory for certain drivers.  However, you may need to
247  update  the  list of  drivers  that  are  statically linked  to  the
248  library,    which   is   located    in   the    configuration   file
249  `include/freetype/config/ftmodule.h'.
250
251
252IV. Support for flat-directory compilation
253------------------------------------------
254
255  It is  possible to  put all  FreeType 2 source  files into  a single
256  directory, with the exception of the `include' hierarchy.
257
258    1. Copy all files in current directory:
259
260        cp freetype2/src/base/*.[hc] .
261        cp freetype2/src/raster1/*.[hc] .
262        cp freetype2/src/smooth/*.[hc] .
263        etc.
264
265    2. Compile sources:
266
267        cc -c -Ifreetype2/include ftsystem.c
268        cc -c -Ifreetype2/include ftinit.c
269        cc -c -Ifreetype2/include ftdebug.c
270        cc -c -Ifreetype2/include ftbase.c
271        etc.
272
273   You don't need to define the FT_FLAT_COMPILATION macro (as this was
274   required in previous releases of FreeType 2).
275
276End of file
Note: See TracBrowser for help on using the repository browser.