Add meson options to disable building harfbuzz-subset

This commit is contained in:
Khaled Hosny committed 2026-03-04 18:12:45 +02:00
1 parent 72ee0c2dfd
commit b91d4b8d75
8 files changed
+146 -106

No files matched your search

+5 -1
View File
@@ -419,7 +419,11 @@ endif
configure_file(output: 'config.h', configuration: conf)
alias_target('lib', libharfbuzz)
alias_target('libs', libharfbuzz, libharfbuzz_subset)
libs = [libharfbuzz]
if not get_option('subset').disabled()
libs += [libharfbuzz_subset]
endif
alias_target('libs', libs)
# Re glib, see https://github.com/harfbuzz/harfbuzz/issues/4153#issuecomment-2646347531
add_test_setup('default',
+2
View File
@@ -33,6 +33,8 @@ option('raster', type: 'feature', value: 'enabled',
description: 'Enable HarfBuzz glyph rasterization library')
option('vector', type: 'feature', value: 'enabled',
description: 'Enable HarfBuzz glyph vector drawing library')
option('subset', type: 'feature', value: 'enabled',
description: 'Enable HarfBuzz font subsetting and instancing library')
# Common feature options
option('tests', type: 'feature', value: 'enabled', yield: true,
+16 -14
View File
@@ -26,19 +26,21 @@ foreach source : benchmarks
), workdir: meson.current_source_dir() / '..', timeout: 100)
endforeach
benchmarks_subset = [
'benchmark-subset.cc',
]
if not get_option('subset').disabled()
benchmarks_subset = [
'benchmark-subset.cc',
]
foreach source : benchmarks_subset
benchmark_name = source.split('.')[0]
benchmark(benchmark_name, executable(benchmark_name, source,
dependencies: [
google_benchmark_dep, libharfbuzz_dep, libharfbuzz_subset_dep
],
cpp_args: [],
include_directories: [incconfig, incsrc],
install: false,
), workdir: meson.current_source_dir() / '..', timeout: 100)
endforeach
foreach source : benchmarks_subset
benchmark_name = source.split('.')[0]
benchmark(benchmark_name, executable(benchmark_name, source,
dependencies: [
google_benchmark_dep, libharfbuzz_dep, libharfbuzz_subset_dep
],
cpp_args: [],
include_directories: [incconfig, incsrc],
install: false,
), workdir: meson.current_source_dir() / '..', timeout: 100)
endforeach
endif
+43 -35
View File
@@ -667,37 +667,40 @@ libharfbuzz_dep = declare_dependency(
meson.override_dependency('harfbuzz', libharfbuzz_dep)
# harfbuzz-subset
harfbuzz_subset_def = custom_target('harfbuzz-subset.def',
command: gen_def_cmd,
input: hb_subset_headers,
output: 'harfbuzz-subset.def')
defs_list += [harfbuzz_subset_def]
libharfbuzz_subset_dep = null_dep
if not get_option('subset').disabled()
harfbuzz_subset_def = custom_target('harfbuzz-subset.def',
command: gen_def_cmd,
input: hb_subset_headers,
output: 'harfbuzz-subset.def')
defs_list += [harfbuzz_subset_def]
libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
include_directories: incconfig,
dependencies: [m_dep],
link_with: [libharfbuzz],
cpp_args: cpp_args + extra_hb_cpp_args,
soversion: hb_so_version,
version: version,
install: true,
darwin_versions: darwin_versions,
link_language: chosen_linker,
)
libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
include_directories: incconfig,
dependencies: [m_dep],
link_with: [libharfbuzz],
cpp_args: cpp_args + extra_hb_cpp_args,
soversion: hb_so_version,
version: version,
install: true,
darwin_versions: darwin_versions,
link_language: chosen_linker,
)
custom_target('harfbuzz-subset.cc',
build_by_default: true,
output: 'harfbuzz-subset.cc',
input: hb_base_sources + hb_subset_sources,
command: [find_program('gen-harfbuzzcc.py'),
'@OUTPUT@', meson.current_source_dir(), '@INPUT@'],
)
custom_target('harfbuzz-subset.cc',
build_by_default: true,
output: 'harfbuzz-subset.cc',
input: hb_base_sources + hb_subset_sources,
command: [find_program('gen-harfbuzzcc.py'),
'@OUTPUT@', meson.current_source_dir(), '@INPUT@'],
)
libharfbuzz_subset_dep = declare_dependency(
link_with: libharfbuzz_subset,
include_directories: incsrc,
dependencies: [m_dep])
meson.override_dependency('harfbuzz-subset', libharfbuzz_subset_dep)
libharfbuzz_subset_dep = declare_dependency(
link_with: libharfbuzz_subset,
include_directories: incsrc,
dependencies: [m_dep])
meson.override_dependency('harfbuzz-subset', libharfbuzz_subset_dep)
endif
hb_raster_sources = [
'hb-raster.cc',
@@ -945,12 +948,14 @@ pkgmod.generate(libharfbuzz,
version: meson.project_version(),
)
pkgmod.generate(libharfbuzz_subset,
description: 'HarfBuzz font subsetter',
requires: ['harfbuzz = @0@'.format(meson.project_version())],
subdirs: [meson.project_name()],
version: meson.project_version(),
)
if not get_option('subset').disabled()
pkgmod.generate(libharfbuzz_subset,
description: 'HarfBuzz font subsetter',
requires: ['harfbuzz = @0@'.format(meson.project_version())],
subdirs: [meson.project_name()],
version: meson.project_version(),
)
endif
libharfbuzz_icu_dep = null_dep
if have_icu and not have_icu_builtin
@@ -1240,4 +1245,7 @@ if get_option('tests').enabled()
)
endif
install_headers(hb_headers + hb_subset_headers, subdir: meson.project_name())
install_headers(hb_headers, subdir: meson.project_name())
if not get_option('subset').disabled()
install_headers(hb_subset_headers, subdir: meson.project_name())
endif
+3
View File
@@ -108,6 +108,9 @@ foreach source : tests
libharfbuzz_icu_dep]
suite = ['api']
if test_name.contains('-subset') or test_name.contains('-instance')
if get_option('subset').disabled()
continue
endif
deps += libharfbuzz_subset_dep
suite += 'subset'
endif
+36 -23
View File
@@ -25,11 +25,20 @@ foreach file_name : tests
extra_cpp_args += '-DHB_EXPERIMENTAL_API'
endif
if (test_name.contains('subset') or test_name.contains('repacker')) and get_option('subset').disabled()
continue
endif
link_with_libs = [libharfbuzz]
if not get_option('subset').disabled()
link_with_libs += [libharfbuzz_subset]
endif
exe = executable(test_name, sources,
cpp_args: cpp_args + extra_cpp_args,
include_directories: [incconfig, incsrc],
link_args: fuzzer_ldflags,
link_with: [libharfbuzz, libharfbuzz_subset],
link_with: link_with_libs,
install: false,
)
set_variable('@0@_exe'.format(test_name.underscorify()), exe)
@@ -87,29 +96,33 @@ foreach chunk : fonts_glob_chunks
i += 1
endforeach
i = 0
foreach chunk : fonts_glob_chunks + subset_fonts_glob_chunks
test('subset-fuzzer-chunk-@0@'.format(i),
hb_subset_fuzzer_exe,
args: chunk,
workdir: meson.current_build_dir() / '..' / '..',
protocol: 'tap',
suite: ['fuzzing'],
)
i += 1
endforeach
if not get_option('subset').disabled()
i = 0
foreach chunk : fonts_glob_chunks + subset_fonts_glob_chunks
test('subset-fuzzer-chunk-@0@'.format(i),
hb_subset_fuzzer_exe,
args: chunk,
workdir: meson.current_build_dir() / '..' / '..',
protocol: 'tap',
suite: ['fuzzing'],
)
i += 1
endforeach
endif
i = 0
foreach chunk : graphs_glob_chunks
test('repacker-fuzzer-chunk-@0@'.format(i),
hb_repacker_fuzzer_exe,
args: chunk,
workdir: meson.current_build_dir() / '..' / '..',
protocol: 'tap',
suite: ['fuzzing'],
)
i += 1
endforeach
if not get_option('subset').disabled()
i = 0
foreach chunk : graphs_glob_chunks
test('repacker-fuzzer-chunk-@0@'.format(i),
hb_repacker_fuzzer_exe,
args: chunk,
workdir: meson.current_build_dir() / '..' / '..',
protocol: 'tap',
suite: ['fuzzing'],
)
i += 1
endforeach
endif
i = 0
foreach chunk : sets_glob_chunks
+15 -13
View File
@@ -13,16 +13,18 @@ test('shape_threads', executable('hb-shape-threads', 'hb-shape-threads.cc',
)
test('subset_threads', executable('hb-subset-threads', 'hb-subset-threads.cc',
dependencies: [
thread_dep
],
cpp_args: [],
include_directories: [incconfig, incsrc],
link_with: [libharfbuzz, libharfbuzz_subset],
install: false,
),
workdir: meson.current_source_dir() / '..' / '..',
timeout: 300,
suite: ['threads', 'slow'],
)
if not get_option('subset').disabled()
test('subset_threads', executable('hb-subset-threads', 'hb-subset-threads.cc',
dependencies: [
thread_dep
],
cpp_args: [],
include_directories: [incconfig, incsrc],
link_with: [libharfbuzz, libharfbuzz_subset],
install: false,
),
workdir: meson.current_source_dir() / '..' / '..',
timeout: 300,
suite: ['threads', 'slow'],
)
endif
+26 -20
View File
@@ -158,14 +158,18 @@ if conf.get('HAVE_GLIB', 0) == 1
)
meson.override_find_program('hb-info', hb_info)
hb_subset = executable('hb-subset', hb_subset_cli_sources,
cpp_args: cpp_args,
include_directories: [incconfig, incsrc],
dependencies: util_deps,
link_with: [libharfbuzz, libharfbuzz_subset],
install: true,
)
meson.override_find_program('hb-subset', hb_subset)
if not get_option('subset').disabled()
hb_subset = executable('hb-subset', hb_subset_cli_sources,
cpp_args: cpp_args,
include_directories: [incconfig, incsrc],
dependencies: util_deps,
link_with: [libharfbuzz, libharfbuzz_subset],
install: true,
)
meson.override_find_program('hb-subset', hb_subset)
else
hb_subset = disabler()
endif
if help2man.found()
foreach binary: [hb_shape, hb_vector, hb_info, hb_subset]
@@ -183,18 +187,20 @@ if conf.get('HAVE_GLIB', 0) == 1
endif
if get_option('experimental_api')
test('test-hb-subset-parsing',
executable('test-hb-subset-parsing',
['test-hb-subset-parsing.c'],
cpp_args: cpp_args,
c_args: ['-DHB_EXPERIMENTAL_API'],
include_directories: [incconfig, incsrc],
dependencies: util_deps,
link_with: [libharfbuzz, libharfbuzz_subset],
install: false,
),
workdir : meson.current_source_dir(),
suite: ['util'])
if not get_option('subset').disabled()
test('test-hb-subset-parsing',
executable('test-hb-subset-parsing',
['test-hb-subset-parsing.c'],
cpp_args: cpp_args,
c_args: ['-DHB_EXPERIMENTAL_API'],
include_directories: [incconfig, incsrc],
dependencies: util_deps,
link_with: [libharfbuzz, libharfbuzz_subset],
install: false,
),
workdir : meson.current_source_dir(),
suite: ['util'])
endif
endif
else
# Disable tests that use this