Werner Lemberg | 6a7df62 | 2013-07-20 10:48:37 +0200 | [diff] [blame] | 1 | This document contains instructions how to build the FreeType library |
| 2 | on non-Unix systems with the help of GNU Make. Note that if you are |
| 3 | running Cygwin or MinGW/MSYS in Windows, you should follow the |
| 4 | instructions in the file `INSTALL.UNIX' instead. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 5 | |
| 6 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 7 | FreeType 2 includes a powerful and flexible build system that allows |
| 8 | you to easily compile it on a great variety of platforms from the |
| 9 | command line. To do so, just follow these simple instructions. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 10 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 11 | 1. Install GNU Make |
| 12 | ------------------- |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 13 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 14 | The FreeType 2 build system relies on many features special to GNU |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 15 | Make. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 16 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 17 | NEARLY ALL OTHER MAKE TOOLS FAIL, INCLUDING `BSD MAKE', SO REALLY |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 18 | INSTALL A RECENT VERSION OF GNU MAKE ON YOUR SYSTEM! |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 19 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 20 | Note that make++, a make tool written in Perl, supports enough |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 21 | features of GNU make to compile FreeType. See |
Werner Lemberg | 9b774e2 | 2007-01-16 06:11:27 +0000 | [diff] [blame] | 22 | |
Werner Lemberg | afa043d | 2018-12-25 22:44:05 +0100 | [diff] [blame] | 23 | https://makepp.sourceforge.net |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 24 | |
Alexei Podtelezhnikov | 843193b | 2018-04-15 16:27:10 -0400 | [diff] [blame] | 25 | for more information; you need version 2.0 or newer, and you must |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 26 | pass option `--norc-substitution'. |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 27 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 28 | Make sure that you are invoking GNU Make from the command line, by |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 29 | typing something like: |
| 30 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 31 | make -v |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 32 | |
| 33 | to display its version number. |
| 34 | |
Alexei Podtelezhnikov | 843193b | 2018-04-15 16:27:10 -0400 | [diff] [blame] | 35 | VERSION 3.81 OR NEWER IS NEEDED! |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 36 | |
| 37 | |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 38 | 2. Invoke `make' |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 39 | ---------------- |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 40 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 41 | Go to the root directory of FreeType 2, then simply invoke GNU |
| 42 | Make from the command line. This will launch the FreeType 2 host |
| 43 | platform detection routines. A summary will be displayed, for |
| 44 | example, on Win32. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 45 | |
| 46 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 47 | ============================================================== |
| 48 | FreeType build system -- automatic system detection |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 49 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 50 | The following settings are used: |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 51 | |
Werner Lemberg | ab98c5e | 2014-02-08 11:34:33 +0100 | [diff] [blame] | 52 | platform windows |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 53 | compiler gcc |
Kenneth Miller | 4d87ac8 | 2013-10-23 20:10:56 +0200 | [diff] [blame] | 54 | configuration directory .\builds\windows |
| 55 | configuration rules .\builds\windows\w32-gcc.mk |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 56 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 57 | If this does not correspond to your system or settings please |
| 58 | remove the file 'config.mk' from this directory then read the |
| 59 | INSTALL file for help. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 60 | |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 61 | Otherwise, simply type 'make' again to build the library |
| 62 | or 'make refdoc' to build the API reference (the latter needs |
Nikhil Ramakrishnan | 1fd3148 | 2020-03-21 20:17:17 +0530 | [diff] [blame] | 63 | Python >= 3.5). |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 64 | ============================================================= |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 65 | |
| 66 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 67 | If the detected settings correspond to your platform and compiler, |
| 68 | skip to step 5. Note that if your platform is completely alien to |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 69 | the build system, the detected platform will be `ansi'. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 70 | |
| 71 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 72 | 3. Configure the build system for a different compiler |
| 73 | ------------------------------------------------------ |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 74 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 75 | If the build system correctly detected your platform, but you want |
| 76 | to use a different compiler than the one specified in the summary |
Werner Lemberg | b4142d5 | 2007-01-17 12:45:26 +0000 | [diff] [blame] | 77 | (for most platforms, gcc is the default compiler), invoke GNU Make |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 78 | with |
| 79 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 80 | make setup <compiler> |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 81 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 82 | Examples: |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 83 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 84 | to use Visual C++ on Win32, type: `make setup visualc' |
| 85 | to use Borland C++ on Win32, type `make setup bcc32' |
| 86 | to use Watcom C++ on Win32, type `make setup watcom' |
| 87 | to use Intel C++ on Win32, type `make setup intelc' |
| 88 | to use LCC-Win32 on Win32, type: `make setup lcc' |
| 89 | to use Watcom C++ on OS/2, type `make setup watcom' |
| 90 | to use VisualAge C++ on OS/2, type `make setup visualage' |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 91 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 92 | The <compiler> name to use is platform-dependent. The list of |
| 93 | available compilers for your system is available in the file |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 94 | `builds/<system>/detect.mk'. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 95 | |
Werner Lemberg | a723526 | 2005-08-30 00:22:46 +0000 | [diff] [blame] | 96 | If you are satisfied by the new configuration summary, skip to |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 97 | step 5. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 98 | |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 99 | |
Werner Lemberg | d586927 | 2021-06-08 17:44:34 +0200 | [diff] [blame] | 100 | 3a. Use clang instead of gcc |
| 101 | ---------------------------- |
| 102 | |
| 103 | The `clang' compiler can use FreeType's setup for `gcc'; it is |
| 104 | sufficient to set the `CC' variable, for example |
| 105 | |
| 106 | make CC=clang |
| 107 | |
| 108 | |
| 109 | 3b. Compiling with a C++ compiler |
| 110 | --------------------------------- |
| 111 | |
| 112 | FreeType can be built with a C++ compiler, for example |
| 113 | |
| 114 | make CC="g++" |
| 115 | |
| 116 | If `clang++' should be used it is necessary to also override the |
| 117 | `ANSIFLAGS' variable: |
| 118 | |
| 119 | make CC="clang++" ANSIFLAGS="" |
| 120 | |
| 121 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 122 | 4. Configure the build system for an unknown platform/compiler |
| 123 | -------------------------------------------------------------- |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 124 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 125 | The auto-detection/setup phase of the build system copies a file |
| 126 | to the current directory under the name `config.mk'. |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 127 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 128 | For example, on OS/2+gcc, it would simply copy |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 129 | `builds/os2/os2-gcc.mk' to `./config.mk'. |
| 130 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 131 | If for some reason your platform isn't correctly detected, copy |
| 132 | manually the configuration sub-makefile to `./config.mk' and go to |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 133 | step 5. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 134 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 135 | Note that this file is a sub-Makefile used to specify Make |
| 136 | variables for compiler and linker invocation during the build. |
| 137 | You can easily create your own version from one of the existing |
| 138 | configuration files, then copy it to the current directory under |
| 139 | the name `./config.mk'. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 140 | |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 141 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 142 | 5. Build the library |
| 143 | -------------------- |
| 144 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 145 | The auto-detection/setup phase should have copied a file in the |
| 146 | current directory, called `./config.mk'. This file contains |
| 147 | definitions of various Make variables used to invoke the compiler |
| 148 | and linker during the build. [It has also generated a file called |
| 149 | `ftmodule.h' in the objects directory (which is normally |
| 150 | `<toplevel>/objs/'); please read the file `docs/CUSTOMIZE' for |
| 151 | customization of FreeType.] |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 152 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 153 | To launch the build, simply invoke GNU Make again: The top |
| 154 | Makefile will detect the configuration file and run the build with |
Werner Lemberg | 801cd84 | 2021-07-18 07:53:57 +0200 | [diff] [blame] | 155 | it. If you have used variables in step 3, you must use the same |
Werner Lemberg | d586927 | 2021-06-08 17:44:34 +0200 | [diff] [blame] | 156 | variables here, too. |
David Turner | 66cbc20 | 2003-03-20 07:04:40 +0000 | [diff] [blame] | 157 | |
| 158 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 159 | Final note |
Werner Lemberg | 9b774e2 | 2007-01-16 06:11:27 +0000 | [diff] [blame] | 160 | |
Werner Lemberg | 6a7df62 | 2013-07-20 10:48:37 +0200 | [diff] [blame] | 161 | The above instructions build a _statically_ linked library of the |
| 162 | font engine in the `objs' directory. On Windows, you can build a |
| 163 | DLL either with MinGW (within an MSYS shell, following the |
| 164 | instructions in `INSTALL.UNIX'), or you use one of the Visual C++ |
Kenneth Miller | 4d87ac8 | 2013-10-23 20:10:56 +0200 | [diff] [blame] | 165 | project files; see the subdirectories of `builds/windows'. For |
Werner Lemberg | 6a7df62 | 2013-07-20 10:48:37 +0200 | [diff] [blame] | 166 | everything else, you are on your own, and you might follow the |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 167 | instructions in `INSTALL.ANY' to create your own Makefiles. |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 168 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 169 | ---------------------------------------------------------------------- |
Werner Lemberg | 56c368c | 2005-06-04 23:00:25 +0000 | [diff] [blame] | 170 | |
Werner Lemberg | d0cfb4e | 2022-01-11 10:54:10 +0100 | [diff] [blame] | 171 | Copyright (C) 2003-2022 by |
Werner Lemberg | 56c368c | 2005-06-04 23:00:25 +0000 | [diff] [blame] | 172 | David Turner, Robert Wilhelm, and Werner Lemberg. |
| 173 | |
Werner Lemberg | 5993924 | 2006-01-31 20:17:42 +0000 | [diff] [blame] | 174 | This file is part of the FreeType project, and may only be used, |
| 175 | modified, and distributed under the terms of the FreeType project |
| 176 | license, LICENSE.TXT. By continuing to use, modify, or distribute |
| 177 | this file you indicate that you have read the license and understand |
| 178 | and accept it fully. |
Werner Lemberg | 56c368c | 2005-06-04 23:00:25 +0000 | [diff] [blame] | 179 | |
Werner Lemberg | a16c4a7 | 2003-04-21 13:30:27 +0000 | [diff] [blame] | 180 | |
| 181 | --- end of INSTALL.GNU --- |