gtk, demos: Fix builds without HarfBuzz and PangoFT
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 28 Mar 2018 04:57:28 +0000 (12:57 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 2 Apr 2018 11:15:18 +0000 (19:15 +0800)
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

demos/gtk-demo/meson.build
gtk/gtkfontchooserwidget.c
gtk/meson.build

index 432aecb51b27c07007b08a09377b8431e36c5f29..b6492c7b5b8e2c6e4181acdf7ecdabc4ca208b73 100644 (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)
\ No newline at end of file
+install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir)
index 907d1a3f05c071592b7d86bdce36aa19c76faebb..e68c9ff783da0b59a5a247a3ebf15a97dc89640a 100644 (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);
 }
index ff57cb4b6536b615885732d31e4eabf905e4ff2e..5dea2569201b05a9cfa1a11d6e032d5a0f03543b 100644 (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