From 69d8f27c69b30f2c3726f279c2daa183d954c6b0 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sat, 20 Nov 2021 17:09:15 +0200 Subject: [PATCH] [meson] Require 0.55.0 We implicitly require it for building ragel subproject. This new version requirement should satisfied in both Fedora 33 and Debian bullseye, and not be too cutting edge for us. --- .circleci/config.yml | 5 +++-- docs/meson.build | 4 ++-- meson.build | 39 ++++++++++----------------------------- perf/meson.build | 10 ++-------- src/meson.build | 32 ++++++++------------------------ test/fuzzing/meson.build | 6 +++--- test/shape/meson.build | 12 ++++++------ test/subset/meson.build | 8 ++++---- 8 files changed, 38 insertions(+), 78 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 84f59bb89..72f1b4ddb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -68,7 +68,7 @@ jobs: steps: - checkout - run: apk update && apk add ragel gcc g++ glib-dev freetype-dev cairo-dev git py3-pip ninja - - run: pip3 install meson==0.52.0 + - run: pip3 install meson==0.56.0 - run: meson build --buildtype=minsize - run: ninja -Cbuild -j9 - run: meson test -Cbuild --print-errorlogs @@ -94,7 +94,8 @@ jobs: steps: - checkout - run: apt update || true - - run: DEBIAN_FRONTEND=noninteractive apt install -y clang lld git binutils meson pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev + - run: DEBIAN_FRONTEND=noninteractive apt install -y python3 python3-pip ninja-build clang lld git binutils pkg-config ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev + - run: pip3 install meson==0.56.0 # asan+ubsan - run: rm -rf build && meson build --default-library=static -Db_sanitize=address,undefined --buildtype=debugoptimized --wrap-mode=nodownload -Dexperimental_api=true - run: ninja -Cbuild -j8 && meson test -Cbuild --print-errorlogs | asan_symbolize | c++filt diff --git a/docs/meson.build b/docs/meson.build index 73d9521fd..9da1fd564 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -49,8 +49,8 @@ ignore_headers = [ gnome.gtkdoc('harfbuzz', main_sgml: 'harfbuzz-docs.xml', - src_dir: [join_paths(meson.current_source_dir(), '../src'), - join_paths(meson.current_build_dir(), '../src'), + src_dir: [meson.current_source_dir() / '..' / 'src', + meson.current_build_dir() / '..' / 'src', ], scan_args: ['--deprecated-guards=HB_DISABLE_DEPRECATED', '--ignore-decorators=HB_EXTERN|HB_DEPRECATED', diff --git a/meson.build b/meson.build index cd7acff24..0cddf7c79 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('harfbuzz', 'c', 'cpp', - meson_version: '>= 0.52.0', + meson_version: '>= 0.55.0', version: '3.1.1', default_options: [ 'cpp_rtti=false', # Just to support msvc, we are passing -fno-exceptions also anyway @@ -141,18 +141,12 @@ if not get_option('cairo').disabled() endif if not cairo_dep.found() - # Requires Meson 0.54.0 to use cairo subproject - if meson.version().version_compare('>=0.54.0') - # Note that we don't have harfbuzz -> cairo -> freetype2 -> harfbuzz fallback - # dependency cycle here because we have configured freetype2 above with - # harfbuzz support disabled, so when cairo will lookup freetype2 dependency - # it will be forced to use that one. - cairo_dep = dependency('cairo', fallback: 'cairo', required: get_option('cairo')) - cairo_ft_dep = dependency('cairo-ft', fallback: 'cairo', required: get_option('cairo')) - elif get_option('cairo').enabled() - error('cairo feature is enabled but it cannot be found on the system and ' + - 'meson>=0.54.0 is required to build it as subproject') - endif + # Note that we don't have harfbuzz -> cairo -> freetype2 -> harfbuzz fallback + # dependency cycle here because we have configured freetype2 above with + # harfbuzz support disabled, so when cairo will lookup freetype2 dependency + # it will be forced to use that one. + cairo_dep = dependency('cairo', fallback: 'cairo', required: get_option('cairo')) + cairo_ft_dep = dependency('cairo-ft', fallback: 'cairo', required: get_option('cairo')) endif endif @@ -387,19 +381,6 @@ build_summary = { 'Benchmark': get_option('benchmark').enabled(), }, } -if meson.version().version_compare('>=0.53') - foreach section_title, section : build_summary - summary(section, bool_yn: true, section: section_title) - endforeach -else - summary = [''] - foreach section_title, section : build_summary - summary += ' @0@:'.format(section_title) - foreach feature, value : section - summary += ' @0@:'.format(feature) - summary += ' @0@'.format(value) - endforeach - summary += '' - endforeach - message('\n'.join(summary)) -endif +foreach section_title, section : build_summary + summary(section, bool_yn: true, section: section_title) +endforeach diff --git a/perf/meson.build b/perf/meson.build index c3b0e3e4a..e12744c4d 100644 --- a/perf/meson.build +++ b/perf/meson.build @@ -6,12 +6,6 @@ if get_option('experimental_api') and add_languages('rust', required: false, nat ttf_parser_dep = subproject('ttf-parser').get_variable('ttf_parser_dep') endif -if ttf_parser_dep.found() - benchmark_cpp_args = ['-DHAVE_TTFPARSER'] -else - benchmark_cpp_args = [] -endif - benchmark('perf', executable('perf', 'perf.cc', dependencies: [ google_benchmark_dep, freetype_dep, @@ -20,8 +14,8 @@ benchmark('perf', executable('perf', 'perf.cc', # https://github.com/RazrFalcon/ttf-parser/issues/29 ttf_parser_dep, thread_dep, cpp.find_library('dl'), ], - cpp_args: benchmark_cpp_args, + cpp_args: ttf_parser_dep.found() ? ['-DHAVE_TTFPARSER'] : [], include_directories: [incconfig, incsrc], link_with: [libharfbuzz], install: false, -), workdir: join_paths(meson.current_source_dir(), '..'), timeout: 100) +), workdir: meson.current_source_dir() / '..', timeout: 100) diff --git a/src/meson.build b/src/meson.build index bda44c683..1a114f6d4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -3,7 +3,7 @@ hb_version_h = configure_file( input: 'hb-version.h.in', output: 'hb-version.h', install: true, - install_dir: join_paths(get_option('includedir'), meson.project_name())) + install_dir: get_option('includedir') / meson.project_name()) # Base and default-included sources and headers hb_base_sources = files( @@ -569,7 +569,7 @@ cmake_config.set('have_gobject', '@0@'.format(have_gobject)) configure_file(input: 'harfbuzz-config.cmake.in', output: 'harfbuzz-config.cmake', configuration: cmake_config, - install_dir: join_paths(get_option('libdir'), 'cmake', 'harfbuzz'), + install_dir: get_option('libdir') / 'cmake' / 'harfbuzz', ) libharfbuzz_gobject_dep = null_dep @@ -579,14 +579,12 @@ if have_gobject h_templ = configure_file( input: 'hb-gobject-enums.h.tmpl', output: 'hb-gobject-enums-tmp.h.tmpl', - configuration: configuration_data(), - format: 'cmake') + copy: true) cc_templ = configure_file( input: 'hb-gobject-enums.cc.tmpl', output: 'hb-gobject-enums-tmp.cc.tmpl', - configuration: configuration_data(), - format: 'cmake') + copy: true) enums = gnome.mkenums('hb-gobject', sources: hb_headers, @@ -607,7 +605,7 @@ if have_gobject output: 'hb-gobject-enums.h', command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@'], install: true, - install_dir: join_paths(get_option('prefix'), get_option('includedir'), meson.project_name()), + install_dir: get_option('prefix') / get_option('includedir') / meson.project_name(), ) hb_gobject_sources += [enum_c] @@ -658,16 +656,10 @@ if have_gobject '--cflags-end']) endif - if build_gir - libharfbuzz_gobject_sources = hb_gen_files_gir - else - libharfbuzz_gobject_sources = hb_gobject_sources - endif - libharfbuzz_gobject_dep = declare_dependency( link_with: libharfbuzz_gobject, include_directories: incsrc, - sources: libharfbuzz_gobject_sources, + sources: build_gir ? hb_gen_files_gir : hb_gobject_sources, dependencies: [glib_dep, gobject_dep]) pkgmod.generate(libharfbuzz_gobject, @@ -708,21 +700,13 @@ if get_option('tests').enabled() env.set('HBHEADERS', ' '.join(HBHEADERS)) if cpp.get_id() != 'msvc' and not meson.is_cross_build() # ensure the local tools are usable - if meson.version().version_compare('>=0.55') - dist_check_script += 'check-libstdc++' - endif - dist_check_script += ['check-static-inits', 'check-symbols'] + dist_check_script += ['check-libstdc++', 'check-static-inits', 'check-symbols'] endif foreach name : dist_check_script - if name == 'check-symbols' - test_depends = defs_list - else - test_depends = [] - endif test(name, find_program(name + '.py'), env: env, - depends: test_depends, + depends: name == 'check-symbols' ? defs_list : [], suite: ['src'], ) endforeach diff --git a/test/fuzzing/meson.build b/test/fuzzing/meson.build index 9ddb4b2c7..3aba9eb67 100644 --- a/test/fuzzing/meson.build +++ b/test/fuzzing/meson.build @@ -38,7 +38,7 @@ test('shape_fuzzer', find_program('run-shape-fuzzer-tests.py'), ], timeout: 300, depends: [hb_shape_fuzzer_exe, libharfbuzz, libharfbuzz_subset], - workdir: join_paths(meson.current_build_dir(), '..', '..'), + workdir: meson.current_build_dir() / '..' / '..', env: env, suite: ['fuzzing', 'slow'], ) @@ -50,7 +50,7 @@ test('subset_fuzzer', find_program('run-subset-fuzzer-tests.py'), # as the tests are ran concurrently let's raise acceptable time here # ideally better to break and let meson handles them in parallel timeout: 300, - workdir: join_paths(meson.current_build_dir(), '..', '..'), + workdir: meson.current_build_dir() / '..' / '..', env: env, suite: ['fuzzing', 'slow'], ) @@ -59,7 +59,7 @@ test('draw_fuzzer', find_program('run-draw-fuzzer-tests.py'), args: [ hb_draw_fuzzer_exe, ], - workdir: join_paths(meson.current_build_dir(), '..', '..'), + workdir: meson.current_build_dir() / '..' / '..', env: env, suite: ['fuzzing'], ) diff --git a/test/shape/meson.build b/test/shape/meson.build index dfc9f3297..48f5500eb 100644 --- a/test/shape/meson.build +++ b/test/shape/meson.build @@ -14,10 +14,10 @@ foreach file_name : in_house_tests test(test_name, shaping_run_tests_py, args: [ hb_shape, - join_paths(meson.current_source_dir(), 'data', 'in-house', 'tests', file_name), + meson.current_source_dir() / 'data' / 'in-house' / 'tests' / file_name, ], env: env, - workdir: join_paths(meson.current_build_dir(), '..', '..'), + workdir: meson.current_build_dir() / '..' / '..', suite: ['shaping', 'in-house'], ) endforeach @@ -28,10 +28,10 @@ foreach file_name : aots_tests test(test_name, shaping_run_tests_py, args: [ hb_shape, - join_paths(meson.current_source_dir(), 'data', 'aots', 'tests', file_name), + meson.current_source_dir() / 'data' / 'aots' / 'tests' / file_name, ], env: env, - workdir: join_paths(meson.current_build_dir(), '..', '..'), + workdir: meson.current_build_dir() / '..' / '..', suite: ['shaping', 'aots'], ) endforeach @@ -42,10 +42,10 @@ foreach file_name : text_rendering_tests test(test_name, shaping_run_tests_py, args: [ hb_shape, - join_paths(meson.current_source_dir(), 'data', 'text-rendering-tests', 'tests', file_name), + meson.current_source_dir() / 'data' / 'text-rendering-tests' / 'tests' / file_name, ], env: env, - workdir: join_paths(meson.current_build_dir(), '..', '..'), + workdir: meson.current_build_dir() / '..' / '..', suite: ['shaping', 'text-rendering-tests'], ) endforeach diff --git a/test/subset/meson.build b/test/subset/meson.build index bfcfa83a9..167e53a9e 100644 --- a/test/subset/meson.build +++ b/test/subset/meson.build @@ -66,12 +66,12 @@ foreach t : tests test(t, run_test, args: [ hb_subset, - join_paths(meson.current_source_dir(), 'data', 'tests', fname), + meson.current_source_dir() / 'data' / 'tests' / fname, ], # as the tests are ran concurrently let's raise acceptable time here # ideally better to break and let meson handles them in parallel timeout: 500, - workdir: join_paths(meson.current_build_dir(), '..', '..'), + workdir: meson.current_build_dir() / '..' / '..', suite: 'subset', ) endforeach @@ -84,9 +84,9 @@ foreach t : repack_tests test(t, run_repack_test, args: [ hb_subset, - join_paths(meson.current_source_dir(), 'data', 'repack_tests', fname), + meson.current_source_dir() / 'data' / 'repack_tests' / fname, ], - workdir: join_paths(meson.current_build_dir(), '..', '..'), + workdir: meson.current_build_dir() / '..' / '..', suite: ['subset', 'repack'], ) endforeach