Commit 09195a82a4a39afb0f8281563f48ce4493455b4e

Werner Lemberg 2021-08-02T12:55:28

* meson.build: Fix zlib support. This commit synchronizes zlib support with both autotools and cmake: If no external zlib is found (or intentionally disabled on the command line), use the internal zlib by undefining `FT_CONFIG_OPTION_SYSTEM_ZLIB` without modifying `FT_CONFIG_OPTION_USE_ZLIB`. Also improve summary output. Problem reported by Moazin.

diff --git a/meson.build b/meson.build
index 5bfa188..5efb33d 100644
--- a/meson.build
+++ b/meson.build
@@ -87,7 +87,7 @@ foreach mod: ft_main_modules
   ft2_sources += 'src/@0@/@1@.c'.format(mod, source)
 endforeach
 
-# NOTE: The `gzip` and `bzip2` aux modules are handled through options.
+# NOTE: The `bzip2` aux module is handled through options.
 ft_aux_modules = run_command(python_exe,
   files('builds/meson/parse_modules_cfg.py'),
   '--format=aux-modules',
@@ -101,7 +101,9 @@ foreach auxmod: ft_aux_modules
     source = 'ftcache'
   elif auxmod == 'lzw'
     source = 'ftlzw'
-  elif auxmod == 'gzip' or auxmod == 'bzip2'
+  elif auxmod == 'gzip'
+    source = 'ftgzip'
+  elif auxmod == 'bzip2'
     # Handled through options instead, see below.
     continue
   endif
@@ -243,20 +245,16 @@ process_header_command = [python_exe,
 ftoption_command = process_header_command
 
 
-# GZip support
+# external GZip support
 zlib_dep = dependency('zlib',
   required: get_option('zlib'),
   fallback: 'zlib')
 
 if zlib_dep.found()
-  ftoption_command += [
-    '--enable=FT_CONFIG_OPTION_USE_ZLIB',
-    '--enable=FT_CONFIG_OPTION_SYSTEM_ZLIB',
-  ]
-  ft2_sources += files(['src/gzip/ftgzip.c',])
+  ftoption_command += ['--enable=FT_CONFIG_OPTION_SYSTEM_ZLIB']
   ft2_deps += [zlib_dep]
 else
-  ftoption_command += ['--disable=FT_CONFIG_OPTION_USE_ZLIB']
+  ftoption_command += ['--disable=FT_CONFIG_OPTION_SYSTEM_ZLIB']
 endif
 
 # BZip2 support
@@ -400,11 +398,13 @@ gen_docs = custom_target('freetype2 reference documentation',
 
 
 summary({'OS': host_machine.system(),
-         'Zlib': zlib_dep.found() ? 'yes' : 'no',
+        }, section: 'Operating System')
+
+summary({'Zlib': zlib_dep.found() ? 'external' : 'internal',
          'Bzip2': bzip2_dep.found() ? 'yes' : 'no',
          'Png': libpng_dep.found() ? 'yes' : 'no',
          'Harfbuzz': harfbuzz_dep.found() ? 'yes' : 'no',
          'Brotli': brotli_dep.found() ? 'yes' : 'no',
-        }, section: 'Configuration Options Summary:')
+        }, section: 'Used Libraries')
 
 # EOF