From 40c5681ab92e7db1298273ccf3c816e6a1498260 Mon Sep 17 00:00:00 2001
From: Werner Lemberg <wl@gnu.org>
Date: Mon, 26 Oct 2020 18:09:56 +0100
Subject: [PATCH] * meson.build: Fix 'harfbuzz' and 'brotli' build options
 (#59347).

Without this patch, 'harfbuzz' and 'brotli' are always required.

Patch submitted anonymously in Savannah bug report.
---
 meson.build | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/meson.build
+++ b/meson.build
@@ -267,13 +267,17 @@ ft2_deps += [libpng_dep]
 harfbuzz_dep = dependency('harfbuzz',
                  version: '>= 1.8.0',
                  required: get_option('harfbuzz'))
-ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ']
-ft2_deps += [harfbuzz_dep]
+if harfbuzz_dep.found()
+  ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ']
+  ft2_deps += [harfbuzz_dep]
+endif
 
 # Brotli decompression support
 brotli_dep = dependency('libbrotlidec', required: get_option('brotli'))
-ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_BROTLI']
-ft2_deps += [brotli_dep]
+if brotli_dep.found()
+  ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_BROTLI']
+  ft2_deps += [brotli_dep]
+endif
 
 # We can now generate `ftoption.h`.
 ftoption_h = custom_target('ftoption.h',
