diff --git a/BUILD.md b/BUILD.md index e0dd17b83..96948fb2c 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,3 +1,19 @@ +# Building HarfBuzz + +HarfBuzz primarily uses the _meson_ build system. A community-maintained +_CMake_ build system is also available. Finally, you can build HarfBuzz +without a build system by compiling the amalgamated source file. + +## Installing dependencies + +First, we need to install desired dependencies. None of these are strictly +required to build the library, but when they are present, you can build the +library with additional _integration_ features, such as _FreeType_ integration. + +The command-line tools (`hb-view`, `hb-shape`, `hb-info`, `hb-subset`) require +_GLib_, while `hb-view` also requires _Cairo_. Most of the test suite requires +_GLib_ to run. + On Linux, install the development packages for FreeType, Cairo, and GLib. For example, on Ubuntu / Debian, you would do: @@ -15,6 +31,8 @@ On macOS: brew install pkg-config ragel gtk-doc freetype glib cairo meson +## Building HarfBuzz with meson + Then use meson to build the project and run the tests, like: meson build && ninja -Cbuild && meson test -Cbuild @@ -27,6 +45,16 @@ or via the Visual Studio installer when building with MSVC, using meson. Our CI configurations are also a good source of learning how to build HarfBuzz. +## Building without a build system + There is also amalgamated source provided with HarfBuzz which reduces whole process -of building HarfBuzz to `g++ src/harfbuzz.cc -fno-exceptions` but there is -no guarantee provided with buildability and reliability of features you get. +of building HarfBuzz to `c++ -c src/harfbuzz.cc` but there is no guarantee provided +with buildability and reliability of features you get. This can be useful when +embedding HarfBuzz in your project. + +For example, the `hb-shape` tool can be built simply as: + + $ c++ -O2 src/harfbuzz.cc util/hb-shape.cc -o hb-shape -I src -DHB_NO_FEATURES_H `pkg-config --cflags --libs glib-2.0` + +See `CONFIG.md` for ideas on how to shrink the feature set of your custom built +HarfBuzz library. diff --git a/CMakeLists.txt b/CMakeLists.txt index a3e7b8763..796746332 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -801,9 +801,6 @@ endif () ## Additional harfbuzz build artifacts if (HB_BUILD_UTILS) - add_definitions("-DPACKAGE_NAME=\"HarfBuzz\"") - add_definitions("-DPACKAGE_VERSION=\"${HB_VERSION}\"") - if (HB_HAVE_CAIRO) add_executable(hb-view ${PROJECT_SOURCE_DIR}/util/ansi-print.hh diff --git a/meson.build b/meson.build index 49f3739a7..d7494d940 100644 --- a/meson.build +++ b/meson.build @@ -375,9 +375,6 @@ if host_machine.system() != 'windows' endif endif -conf.set_quoted('PACKAGE_NAME', 'HarfBuzz') -conf.set_quoted('PACKAGE_VERSION', meson.project_version()) - foreach check : check_headers name = check[0] diff --git a/util/options.hh b/util/options.hh index f87e8bcba..56c178447 100644 --- a/util/options.hh +++ b/util/options.hh @@ -47,7 +47,9 @@ #endif +#ifndef HB_NO_FEATURES_H #include +#endif #include #include @@ -233,7 +235,7 @@ show_version (const char *name G_GNUC_UNUSED, gpointer data G_GNUC_UNUSED, GError **error G_GNUC_UNUSED) { - g_printf ("%s (%s) %s\n", g_get_prgname (), PACKAGE_NAME, PACKAGE_VERSION); + g_printf ("%s (HarfBuzz) %s\n", g_get_prgname (), HB_VERSION_STRING); if (strcmp (HB_VERSION_STRING, hb_version_string ())) g_printf ("Linked HarfBuzz library has a different version: %s\n", hb_version_string ());