[meson] Make compatbile with 0.49.0

Contains a just put together summary feature polyfill and workaround
to broken ternary operator.
This commit is contained in:
Ebrahim Byagowi 2020-08-12 23:04:26 +04:30 committed by ebraminio
parent 1e4fe10b98
commit 58209c86a0
4 changed files with 98 additions and 43 deletions

View File

@ -77,7 +77,8 @@ jobs:
- image: alpine - image: alpine
steps: steps:
- checkout - checkout
- run: apk update && apk add ragel meson gcc g++ glib-dev freetype-dev cairo-dev git - run: apk update && apk add ragel gcc g++ glib-dev freetype-dev cairo-dev git py3-pip ninja
- run: pip3 install meson==0.49.0
- run: meson build --buildtype=minsize - run: meson build --buildtype=minsize
- run: ninja -Cbuild -j9 - run: ninja -Cbuild -j9
- run: meson test -Cbuild --print-errorlogs - run: meson test -Cbuild --print-errorlogs

View File

@ -1,5 +1,5 @@
project('harfbuzz', 'c', 'cpp', project('harfbuzz', 'c', 'cpp',
meson_version: '>= 0.53.0', meson_version: '>= 0.49.0',
version: '2.7.0', version: '2.7.0',
default_options: [ default_options: [
'cpp_eh=none', # Just to support msvc, we are passing -fno-rtti also anyway 'cpp_eh=none', # Just to support msvc, we are passing -fno-rtti also anyway
@ -107,7 +107,12 @@ if not get_option('icu').disabled()
endif endif
if not icu_dep.found() and cpp.get_id() == 'msvc' if not icu_dep.found() and cpp.get_id() == 'msvc'
icu_dep = cpp.find_library(get_option('buildtype') == 'debug' ? 'icuucd' : 'icuuc', if get_option('buildtype') == 'debug'
icu_dep_name = 'icuucd'
else
icu_dep_name = 'icuuc'
endif
icu_dep = cpp.find_library(icu_dep_name,
required: get_option('icu'), required: get_option('icu'),
has_headers: ['unicode/uchar.h', has_headers: ['unicode/uchar.h',
'unicode/unorm2.h', 'unicode/unorm2.h',
@ -142,10 +147,10 @@ if not get_option('cairo').disabled()
if cairo_dep.type_name() == 'internal' if cairo_dep.type_name() == 'internal'
# It is true at least for the port we have # It is true at least for the port we have
cairo_ft_dep = cairo_dep cairo_ft_dep = cairo_dep
elif cairo_dep.type_name() == 'library' and \ elif (cairo_dep.type_name() == 'library' and
cpp.has_function('cairo_ft_font_face_create_for_ft_face', cpp.has_function('cairo_ft_font_face_create_for_ft_face',
prefix: '#include <cairo-ft.h>', prefix: '#include <cairo-ft.h>',
dependencies: cairo_dep) dependencies: cairo_dep))
cairo_ft_dep = cairo_dep cairo_ft_dep = cairo_dep
else # including the most important type for us, 'pkgconfig' else # including the most important type for us, 'pkgconfig'
cairo_ft_dep = dependency('cairo-ft', required: get_option('cairo')) cairo_ft_dep = dependency('cairo-ft', required: get_option('cairo'))
@ -343,11 +348,11 @@ if not get_option('tests').disabled()
subdir('test') subdir('test')
endif endif
if not get_option('benchmark').disabled() and \ if (not get_option('benchmark').disabled() and
get_option('wrap_mode') != 'nodownload' and \ get_option('wrap_mode') != 'nodownload' and
host_machine.system() != 'windows' and \ host_machine.system() != 'windows' and
not meson.is_subproject() and \ not meson.is_subproject() and
not meson.is_cross_build() not meson.is_cross_build())
subdir('perf') subdir('perf')
endif endif
@ -357,28 +362,53 @@ endif
configure_file(output: 'config.h', configuration: conf) configure_file(output: 'config.h', configuration: conf)
summary({'prefix': get_option('prefix'), build_summary = {
'Directories':
{'prefix': get_option('prefix'),
'bindir': get_option('bindir'), 'bindir': get_option('bindir'),
'libdir': get_option('libdir'), 'libdir': get_option('libdir'),
'includedir': get_option('includedir'), 'includedir': get_option('includedir'),
'datadir': get_option('datadir'), 'datadir': get_option('datadir'),
}, section: 'Directories') },
summary({'Builtin': true, 'Unicode callbacks (you want at least one)':
{'Builtin': true,
'Glib': conf.get('HAVE_GLIB', 0) == 1, 'Glib': conf.get('HAVE_GLIB', 0) == 1,
'ICU': conf.get('HAVE_ICU', 0) == 1, 'ICU': conf.get('HAVE_ICU', 0) == 1,
}, bool_yn: true, section: 'Unicode callbacks (you want at least one)') },
summary({'FreeType': conf.get('HAVE_FREETYPE', 0) == 1, 'Font callbacks (the more the merrier)':
}, bool_yn: true, section: 'Font callbacks (the more the merrier)') {'FreeType': conf.get('HAVE_FREETYPE', 0) == 1,
summary({'Cairo': conf.get('HAVE_CAIRO', 0) == 1, },
'Dependencies used for command-line utilities':
{'Cairo': conf.get('HAVE_CAIRO', 0) == 1,
'Fontconfig': conf.get('HAVE_FONTCONFIG', 0) == 1, 'Fontconfig': conf.get('HAVE_FONTCONFIG', 0) == 1,
}, bool_yn: true, section: 'Dependencies used for command-line utilities') },
summary({'Graphite2': conf.get('HAVE_GRAPHITE2', 0) == 1, 'Additional shapers':
}, bool_yn: true, section: 'Additional shapers') {'Graphite2': conf.get('HAVE_GRAPHITE2', 0) == 1,
summary({'CoreText': conf.get('HAVE_CORETEXT', 0) == 1, },
'Platform shapers (not normally needed)':
{'CoreText': conf.get('HAVE_CORETEXT', 0) == 1,
'DirectWrite': conf.get('HAVE_DIRECTWRITE', 0) == 1, 'DirectWrite': conf.get('HAVE_DIRECTWRITE', 0) == 1,
'GDI/Uniscribe': (conf.get('HAVE_GDI', 0) == 1) and (conf.get('HAVE_UNISCRIBE', 0) == 1), 'GDI/Uniscribe': (conf.get('HAVE_GDI', 0) == 1) and (conf.get('HAVE_UNISCRIBE', 0) == 1),
}, bool_yn: true, section: 'Platform shapers (not normally needed)') },
summary({'Documentation': conf.get('HAVE_GTK_DOC', 0) == 1, 'Other features':
{'Documentation': conf.get('HAVE_GTK_DOC', 0) == 1,
'GObject bindings': conf.get('HAVE_GOBJECT', 0) == 1, 'GObject bindings': conf.get('HAVE_GOBJECT', 0) == 1,
'Introspection': conf.get('HAVE_INTROSPECTION', 0) == 1, 'Introspection': conf.get('HAVE_INTROSPECTION', 0) == 1,
}, bool_yn: true, section: 'Other features') },
}
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

View File

@ -6,6 +6,12 @@ if get_option('experimental_api') and add_languages('rust', required: false, nat
ttf_parser_dep = subproject('ttf-parser').get_variable('ttf_parser_dep') ttf_parser_dep = subproject('ttf-parser').get_variable('ttf_parser_dep')
endif endif
if ttf_parser_dep.found()
benchmark_cpp_args = ['-DHAVE_TTFPARSER']
else
benchmark_cpp_args = []
endif
benchmark('perf', executable('perf', 'perf.cc', benchmark('perf', executable('perf', 'perf.cc',
dependencies: [ dependencies: [
google_benchmark_dep, freetype_dep, google_benchmark_dep, freetype_dep,
@ -14,7 +20,7 @@ benchmark('perf', executable('perf', 'perf.cc',
# https://github.com/RazrFalcon/ttf-parser/issues/29 # https://github.com/RazrFalcon/ttf-parser/issues/29
ttf_parser_dep, thread_dep, cpp.find_library('dl'), ttf_parser_dep, thread_dep, cpp.find_library('dl'),
], ],
cpp_args: ttf_parser_dep.found() ? ['-DHAVE_TTFPARSER'] : [], cpp_args: benchmark_cpp_args,
include_directories: [incconfig, incsrc], include_directories: [incconfig, incsrc],
link_with: [libharfbuzz], link_with: [libharfbuzz],
install: false, install: false,

View File

@ -563,15 +563,22 @@ endif
have_gobject = conf.get('HAVE_GOBJECT', 0) == 1 have_gobject = conf.get('HAVE_GOBJECT', 0) == 1
if have_gobject
have_gobject_string = 'true'
else
have_gobject_string = 'false'
endif
cmake_config = configuration_data() cmake_config = configuration_data()
cmake_config.set('libdir', '${prefix}/@0@'.format(get_option('libdir'))) cmake_config.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
cmake_config.set('includedir', '${prefix}/@0@'.format(get_option('includedir'))) cmake_config.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
cmake_config.set('HB_LIBTOOL_VERSION_INFO', hb_libtool_version_info) cmake_config.set('HB_LIBTOOL_VERSION_INFO', hb_libtool_version_info)
cmake_config.set('have_gobject', have_gobject ? 'true' : 'false') cmake_config.set('have_gobject', have_gobject_string)
configure_file(input: 'harfbuzz-config.cmake.in', configure_file(input: 'harfbuzz-config.cmake.in',
output: 'harfbuzz-config.cmake', output: 'harfbuzz-config.cmake',
configuration: cmake_config, configuration: cmake_config,
install_dir: get_option('libdir') / 'cmake' / 'harfbuzz') install_dir: get_option('libdir') / 'cmake' / 'harfbuzz',
)
libharfbuzz_gobject_dep = null_dep libharfbuzz_gobject_dep = null_dep
if have_gobject if have_gobject
@ -670,10 +677,16 @@ if have_gobject
'--cflags-end']) '--cflags-end'])
endif endif
if build_gir
gobject_sources = hb_gen_files_gir
else
gobject_sources = hb_gobject_sources
endif
libharfbuzz_gobject_dep = declare_dependency( libharfbuzz_gobject_dep = declare_dependency(
link_with: libharfbuzz_gobject, link_with: libharfbuzz_gobject,
include_directories: incsrc, include_directories: incsrc,
sources: build_gir ? hb_gen_files_gir : hb_gobject_sources, sources: gobject_sources,
dependencies: [glib_dep, gobject_dep]) dependencies: [glib_dep, gobject_dep])
pkgmod.generate(libharfbuzz_gobject, pkgmod.generate(libharfbuzz_gobject,
@ -721,10 +734,15 @@ if get_option('tests').enabled()
endif endif
foreach name : dist_check_script foreach name : dist_check_script
if name == 'check-symbols'
test_depends = defs_list
else
test_depends = []
endif
test(name, find_program(name + '.py'), test(name, find_program(name + '.py'),
env: env, env: env,
depends: name == 'check-symbols' ? defs_list : [], depends: test_depends,
suite: ['src'] + (name == 'check-static-inits' ? ['slow'] : []), suite: ['src'],
) )
endforeach endforeach
endif endif