gtk, demos: Fix builds without HarfBuzz and PangoFT

Really exclude the portions in the gtkfontchooserwidget.c that are built
when HarfBuzz and PangoFT2 are built, and update the Meson files to
exclude such sources as well from the main GTK SO/DLL and from the
gtk4-demo program.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
This commit is contained in:
Chun-wei Fan 2018-03-28 12:57:28 +08:00
parent bca4a78f07
commit 464943e5a6
3 changed files with 16 additions and 6 deletions

View File

@ -76,8 +76,11 @@ demos = files([
gtkdemo_deps = [ libgtk_dep, ]
extra_demo_sources = files(['main.c', 'gtkfishbowl.c', 'fontplane.c', 'gtkgears.c'])
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files('font_features.c')
extra_demo_sources += files(['script-names.c', 'language-names.c'])
gtkdemo_deps += [ harfbuzz_dep, ]
endif
@ -97,9 +100,7 @@ gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
source_dir: '.')
executable('gtk4-demo',
'main.c', 'gtkfishbowl.c', 'fontplane.c', 'script-names.c', 'language-names.c',
'gtkgears.c',
demos, demos_h, gtkdemo_resources,
demos, demos_h, extra_demo_sources, gtkdemo_resources,
c_args: gtkdemo_args,
dependencies: gtkdemo_deps,
include_directories: confinc,
@ -135,4 +136,4 @@ install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
gnome.compile_schemas()
# appdata
install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir)
install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir)

View File

@ -766,7 +766,10 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
gtk_widget_class_bind_template_callback (widget_class, size_change_cb);
gtk_widget_class_bind_template_callback (widget_class, output_cb);
gtk_widget_class_bind_template_callback (widget_class, selection_changed);
#if defined(HAVE_HARFBUZZ) && defined(HAVE_PANGOFT)
gtk_widget_class_bind_template_callback (widget_class, update_language);
#endif
gtk_widget_class_set_css_name (widget_class, I_("fontchooser"));
}
@ -896,7 +899,11 @@ gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser)
/* Load data and set initial style-dependent parameters */
gtk_font_chooser_widget_load_fonts (fontchooser, TRUE);
#if defined(HAVE_HARFBUZZ) && defined(HAVE_PANGOFT)
gtk_font_chooser_widget_populate_features (fontchooser);
#endif
gtk_font_chooser_widget_set_cell_size (fontchooser);
gtk_font_chooser_widget_take_font_desc (fontchooser, NULL);
}

View File

@ -7,8 +7,6 @@ subdir('inspector')
gtk_private_sources = files([
'fallback-c89.c',
'fnmatch.c',
'language-names.c',
'script-names.c',
'gdkpixbufutils.c',
'gtkactionhelper.c',
'gtkactionmuxer.c',
@ -874,6 +872,10 @@ gtk_deps = [
if harfbuzz_dep.found() and pangoft_dep.found()
gtk_deps += [ harfbuzz_dep, pangoft_dep ]
gtk_sources += files([
'language-names.c',
'script-names.c',
])
endif
if x11_enabled