2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
4 <!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
5 <!ENTITY version SYSTEM "version.xml">
7 <chapter id="install-harfbuzz">
8 <title>Installing HarfBuzz</title>
10 <section id="download">
11 <title id="download.title">Downloading HarfBuzz</title>
13 The HarfBuzz source code is hosted at <ulink
14 url="https://github.com/harfbuzz/harfbuzz">github.com/harfbuzz/harfbuzz</ulink>.
17 Tarball releases and Win32 binary bundles (which include the
18 libharfbuzz DLL, hb-view.exe, hb-shape.exe, and all
19 dependencies) of HarfBuzz can be downloaded from <ulink
20 url="https://github.com/harfbuzz/harfbuzz/releases">github.com/harfbuzz/harfbuzz/releases</ulink>.
23 Release notes are posted with each new release to provide an
24 overview of the changes. The project <ulink url="https://github.com/harfbuzz/harfbuzz/issues">tracks bug
25 reports and other issues</ulink> on GitHub. Discussion and
26 questions are welcome on <ulink
27 url="https://github.com/harfbuzz/harfbuzz/discussions">GitHub</ulink> as well.
30 The API included in the <filename
31 class='headerfile'>hb.h</filename> file will not change in a
32 compatibility-breaking way in any release. However, other,
33 peripheral headers are more likely to go through minor
34 modifications. We will do our best to never change APIs in an
35 incompatible way. We will <emphasis>never</emphasis> break the ABI.
39 <section id="building">
40 <title>Building HarfBuzz</title>
42 <section id="building.linux">
43 <title>Building on Linux</title>
45 <emphasis>(1)</emphasis> To build HarfBuzz on Linux, you must first install the
46 development packages for FreeType, Cairo, and GLib. The exact
47 commands required for this step will vary depending on
48 the Linux distribution you use.
51 For example, on an Ubuntu or Debian system, you would run:
52 <programlisting><command>sudo apt install</command> <package>gcc g++ libfreetype6-dev libglib2.0-dev libcairo2-dev</package></programlisting>
53 On Fedora, RHEL, CentOS, or other Red-Hat–based systems, you would run:
54 <programlisting><command>sudo yum install</command> <package>gcc gcc-c++ freetype-devel glib2-devel cairo-devel</package></programlisting>
59 <emphasis>(2)</emphasis> The next step depends on whether you
60 are building from the source in a downloaded release tarball or
61 from the source directly from the git repository.
64 <emphasis>(2)(a)</emphasis> If you downloaded the HarfBuzz
65 source code in a tarball, you can now extract the source.
68 From a shell in the top-level directory of the extracted source
69 code, you can run <command>meson build</command> followed by
70 <command>meson compile -C build</command> as with any other standard package.
73 This should leave you with a shared
74 library in the <filename>src/</filename> directory, and a few
75 utility programs including <command>hb-view</command> and
76 <command>hb-shape</command> under the <filename>util/</filename>
80 <emphasis>(2)(b)</emphasis> If you are building from the source in the HarfBuzz git
81 repository, rather than installing from a downloaded tarball
82 release, then you must install two more auxiliary tools before you
83 can build for the first time: <package>pkg-config</package>.
86 On Ubuntu or Debian, run:
87 <programlisting><command>sudo apt-get install</command> <package>meson pkg-config gtk-doc-tools</package></programlisting>
88 On Fedora, RHEL, CentOS, run:
89 <programlisting><command>sudo yum install</command> <package>meson pkgconfig gtk-doc</package></programlisting>
93 With <package>pkg-config</package> installed, you can now run
94 <command>meson build</command> then
95 <command>meson compile -C build</command> to build HarfBuzz.
100 <section id="building.windows">
101 <title>Building on Windows</title>
104 <ulink url="https://mesonbuild.com/Getting-meson.html">Install meson</ulink>
105 and run (from the console) <command>meson build</command> (by default
106 bundled dependencies are not built, <command>--wrap-mode=default</command>
107 overrides this), then <command>meson compile -C build</command> to
113 <section id="building.macos">
114 <title>Building on macOS</title>
117 There are two ways to build HarfBuzz on Mac systems: MacPorts
118 and Homebrew. The process is similar to the process used on a
122 <emphasis>(1)</emphasis> You must first install the
123 development packages for FreeType, Cairo, and GLib. If you are
124 using MacPorts, you should run:
125 <programlisting><command>sudo port install</command> <package>freetype glib2 cairo</package></programlisting>
128 If you are using Homebrew, you should run:
129 <programlisting><command>brew install</command> <package>freetype glib cairo</package></programlisting>
132 <emphasis>(2)</emphasis> The next step depends on whether you are building from the
133 source in a downloaded release tarball or from the source directly
134 from the git repository.
137 <emphasis>(2)(a)</emphasis> If you are installing HarfBuzz
138 from a downloaded tarball release, extract the tarball and
139 open a Terminal in the extracted source-code directory. Run:
140 <programlisting><command>meson build</command></programlisting>
142 <programlisting><command>meson compile -C build</command></programlisting>
146 <emphasis>(2)(b)</emphasis> Alternatively, if you are building
147 HarfBuzz from the source in the HarfBuzz git repository, then
148 you must install several built-time dependencies before
152 using MacPorts, you should run:
153 <programlisting><command>sudo port install</command> <package>meson pkgconfig gtk-doc</package></programlisting>
154 to install the build dependencies.
156 <para>If you are using Homebrew, you should run:
157 <programlisting><command>brew install</command> <package>meson pkgconfig gtk-doc</package></programlisting>
158 Finally, you can run:
159 <programlisting><command>meson build</command></programlisting>
162 <emphasis>(3)</emphasis> You can now build HarfBuzz (on either
163 a MacPorts or a Homebrew system) by running:
164 <programlisting><command>meson build</command></programlisting>
166 <programlisting><command>meson compile -C build</command></programlisting>
169 This should leave you with a shared
170 library in the <filename>src/</filename> directory, and a few
171 utility programs including <command>hb-view</command> and
172 <command>hb-shape</command> under the <filename>util/</filename>
178 <section id="configuration">
179 <title>Configuration options</title>
182 The instructions in the "Building HarfBuzz" section will build
183 the source code under its default configuration. If needed,
184 the following additional configuration options are available.
188 <?dbfo list-presentation="blocks"?>
190 <term><command>-Dglib=enabled</command></term>
193 Use <ulink url="https://developer.gnome.org/glib/">GLib</ulink>. <emphasis>(Default = auto)</emphasis>
196 This option enables or disables usage of the GLib
197 library. The default setting is to check for the
198 presence of GLib and, if it is found, build with
199 GLib support. GLib is native to GNU/Linux systems but is
200 available on other operating system as well.
206 <term><command>-Dgobject=enabled</command></term>
209 Use <ulink url="https://developer.gnome.org/gobject/stable/">GObject</ulink>. <emphasis>(Default = no)</emphasis>
212 This option enables or disables usage of the GObject
213 library. The default setting is to check for the
214 presence of GObject and, if it is found, build with
215 GObject support. GObject is native to GNU/Linux systems but is
216 available on other operating system as well.
222 <term><command>-Dcairo=enabled</command></term>
225 Use <ulink url="https://cairographics.org/">Cairo</ulink>. <emphasis>(Default = auto)</emphasis>
228 This option enables or disables usage of the Cairo
229 graphics-rendering library. The default setting is to
230 check for the presence of Cairo and, if it is found,
231 build with Cairo support.
234 Note: Cairo is used only by the HarfBuzz
235 command-line utilities, and not by the HarfBuzz library.
241 <term><command>-Dicu=enabled</command></term>
244 Use the <ulink url="http://site.icu-project.org/home">ICU</ulink> library. <emphasis>(Default = auto)</emphasis>
247 This option enables or disables usage of the
248 <emphasis>International Components for
249 Unicode</emphasis> (ICU) library, which provides access
250 to Unicode Character Database (UCD) properties as well
251 as normalization and conversion functions. The default
252 setting is to check for the presence of ICU and, if it
253 is found, build with ICU support.
259 <term><command>-Dgraphite=enabled</command></term>
262 Use the <ulink url="http://graphite.sil.org/">Graphite2</ulink> library. <emphasis>(Default = no)</emphasis>
265 This option enables or disables usage of the Graphite2
266 library, which provides support for the Graphite shaping
273 <term><command>-Dfreetype=enabled</command></term>
276 Use the <ulink url="https://www.freetype.org/">FreeType</ulink> library. <emphasis>(Default = auto)</emphasis>
279 This option enables or disables usage of the FreeType
280 font-rendering library. The default setting is to check for the
281 presence of FreeType and, if it is found, build with
288 <term><command>-Dgdi=enabled</command></term>
292 url="https://docs.microsoft.com/en-us/windows/desktop/intl/uniscribe">Uniscribe</ulink>
293 library (experimental). <emphasis>(Default = no)</emphasis>
296 This option enables or disables usage of the Uniscribe
297 font-rendering library. Uniscribe is available on
298 Windows systems. Uniscribe support is used only for
299 testing purposes and does not need to be enabled for
300 HarfBuzz to run on Windows systems.
306 <term><command>-Ddirectwrite=enabled</command></term>
309 Use the <ulink url="https://docs.microsoft.com/en-us/windows/desktop/directwrite/direct-write-portal">DirectWrite</ulink> library (experimental). <emphasis>(Default = no)</emphasis>
312 This option enables or disables usage of the DirectWrite
313 font-rendering library. DirectWrite is available on
314 Windows systems. DirectWrite support is used only for
315 testing purposes and does not need to be enabled for
316 HarfBuzz to run on Windows systems.
322 <term><command>-Dcoretext=enabled</command></term>
325 Use the <ulink url="https://developer.apple.com/documentation/coretext">CoreText</ulink> library. <emphasis>(Default = no)</emphasis>
328 This option enables or disables usage of the CoreText
329 library. CoreText is available on macOS and iOS systems.
335 <term><command>-Ddocs=enabled</command></term>
338 Use <ulink url="https://github.com/GNOME/gtk-doc">GTK-Doc</ulink>. <emphasis>(Default = no)</emphasis>
341 This option enables the building of the documentation.