[gtk/gtk-3-24-meson: 15/64] meson: Fix introspection generation on Linux



commit 35b4fb28f5ec9b89ee88be7c19e167e2814e862b
Author: Nirbheek Chauhan <nirbheek centricular com>
Date:   Mon Dec 3 18:39:41 2018 +0530

    meson: Fix introspection generation on Linux

 gdk/meson.build     | 86 +++++++++++++++++++++++++++++++++++++++++++++++++----
 gdk/x11/meson.build |  1 -
 gtk/meson.build     | 75 ++++++++--------------------------------------
 meson.build         |  1 +
 meson_options.txt   |  2 +-
 5 files changed, 96 insertions(+), 69 deletions(-)
---
diff --git a/gdk/meson.build b/gdk/meson.build
index 0d88e8e45a..e76d7f9285 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -39,7 +39,7 @@ gdk_sources = files(
   'gdkmonitor.c'
 )
 
-gdk_public_headers = files(
+gdk_gir_public_headers = files(
   'gdk.h',
   'gdk-autocleanup.h',
   'gdkapplaunchcontext.h',
@@ -58,7 +58,6 @@ gdk_public_headers = files(
   'gdkglcontext.h',
   'gdkkeys.h',
   'gdkkeysyms.h',
-  'gdkkeysyms-compat.h',
   'gdkmain.h',
   'gdkmonitor.h',
   'gdkpango.h',
@@ -77,6 +76,8 @@ gdk_public_headers = files(
   'gdkvisual.h',
   'gdkwindow.h',
 )
+gdk_nogir_public_headers = [files('gdkkeysyms-compat.h')]
+gdk_public_headers = gdk_gir_public_headers + gdk_nogir_public_headers
 install_headers(gdk_public_headers, subdir : 'gtk-3.0/gdk')
 
 deprecated_h_sources = files('deprecated/gdkcolor.h')
@@ -142,8 +143,6 @@ gdkresources = gnome.compile_resources('gdkresources',
   extra_args: '--manual-register'
 )
 
-gdk_headers = gdk_public_headers
-
 gdk_enums = gnome.mkenums('gdkenumtypes',
   sources: gdk_public_headers,
   c_template : 'gdkenumtypes.c.template',
@@ -272,8 +271,85 @@ libgdk = shared_library('gdk-3',
                         darwin_versions : gtk_osxversions,
                         install: true)
 
+gdk_dep_sources = [gdkconfig, gdkenum_h]
+# Introspection
+if build_gir
+  gir_args = ['--quiet']
+
+  # We may build some of the dependencies as sub-projects; this means
+  # that we need to depend on the built introspection data, instead of
+  # the installed one
+  gdk_gir_inc = [ 'cairo-1.0', 'Gio-2.0', ]
+
+  if pixbuf_dep.type_name() == 'internal'
+    gdk_gir_inc += subproject('gdk-pixbuf').get_variable('gdkpixbuf_gir').get(0)
+  else
+    gdk_gir_inc += 'GdkPixbuf-2.0'
+  endif
+
+  if pango_dep.type_name() == 'internal'
+    gdk_gir_inc += subproject('pango').get_variable('pango_gir').get(0)
+  else
+    gdk_gir_inc += 'Pango-1.0'
+  endif
+
+  gdk_gir_sources = gdk_gir_public_headers + deprecated_h_sources
+  gdk_gir_sources += gdk_sources + gdk_enums + [gdkconfig]
+  gdk_gir = gnome.generate_gir(libgdk,
+                               sources: gdk_gir_sources,
+                               namespace: 'Gdk',
+                               nsversion: gtk_api_version,
+                               identifier_prefix: 'Gdk',
+                               symbol_prefix: 'gdk',
+                               export_packages: 'gdk-3.0',
+                               includes: gdk_gir_inc,
+                               header: 'gdk/gdk.h',
+                               install: true,
+                               extra_args: gir_args + [
+                                 '-DGDK_COMPILATION',
+                               ])
+  gdk_gir_dep = declare_dependency(sources: gdk_gir)
+  gdk_dep_sources += gdk_gir
+
+  if x11_enabled
+    gdk_x11_gir = gnome.generate_gir(libgdk,
+                                     sources: gdk_x11_public_headers + gdk_x11_sources,
+                                     namespace: 'GdkX11',
+                                     nsversion: gtk_api_version,
+                                     identifier_prefix: 'Gdk',
+                                     symbol_prefix: 'gdk',
+                                     export_packages: 'gdk-x11-3.0',
+                                     includes: gdk_gir_inc + [ gdk_gir[0], 'xlib-2.0', ],
+                                     install: true,
+                                     dependencies: gdk_gir_dep,
+                                     header: 'gdk/gdkx.h',
+                                     extra_args: gir_args + [
+                                       '-DGDK_COMPILATION',
+                                     ])
+    gdk_dep_sources += gdk_x11_gir
+  endif
+
+  if win32_enabled
+    gdk_win32_gir = gnome.generate_gir(libgdk,
+                                     sources: gdk_win32_public_headers + gdk_win32_sources,
+                                     namespace: 'GdkWin32',
+                                     nsversion: gtk_api_version,
+                                     identifier_prefix: 'Gdk',
+                                     symbol_prefix: 'gdk',
+                                     export_packages: 'gdk-win32-3.0',
+                                     includes: gdk_gir_inc + [gdk_gir[0]],
+                                     install: true,
+                                     dependencies: gdk_gir_dep,
+                                     header: 'gdk/gdkwin32.h',
+                                     extra_args: gir_args + [
+                                       '-DGDK_COMPILATION',
+                                     ])
+    gdk_dep_sources += gdk_x11_gir
+  endif
+endif
+
 libgdk_dep = declare_dependency(
   link_with: libgdk,
-  sources: ['gdk.h', gdkconfig, gdkenum_h],
+  sources: gdk_dep_sources,
   include_directories: [confinc, gdkx11_inc, wlinc],
   dependencies: gdk_deps)
diff --git a/gdk/x11/meson.build b/gdk/x11/meson.build
index c31a682d69..754ae0a615 100644
--- a/gdk/x11/meson.build
+++ b/gdk/x11/meson.build
@@ -19,7 +19,6 @@ gdk_x11_sources = files(
   'gdkmain-x11.c',
   'gdkproperty-x11.c',
   'gdkscreen-x11.c',
-  'gdkscreen-x11.h',
   'gdkselection-x11.c',
   'gdktestutils-x11.c',
   'gdkvisual-x11.c',
diff --git a/gtk/meson.build b/gtk/meson.build
index 531f2e962f..bb4f179149 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -394,10 +394,9 @@ gtk_private_type_headers = files(
   'gtktexthandleprivate.h',
 )
 
-gtk_public_headers = files(
+gtk_gir_public_headers = files(
   'gtk.h',
   'gtk-autocleanups.h',
-  'gtkx.h',
   'gtkx-autocleanups.h',
   'gtk-a11y.h',
   'gtkaboutdialog.h',
@@ -589,7 +588,6 @@ gtk_public_headers = files(
   'gtktextbuffer.h',
   'gtktextbufferrichtext.h',
   'gtktextchild.h',
-  'gtktextdisplay.h',
   'gtktextiter.h',
   'gtktextmark.h',
   'gtktexttag.h',
@@ -622,9 +620,14 @@ gtk_public_headers = files(
   'gtkwindowgroup.h',
 )
 
+gtk_nogir_public_headers = files(
+  'gtkx.h',
+  'gtktextdisplay.h',
+)
+
 # Installed headers without compatibility guarantees that are not included in gtk/gtk.h
 gtk_semi_private_headers = files('gtktextlayout.h')
-
+gtk_public_headers = gtk_gir_public_headers + gtk_nogir_public_headers
 install_headers(gtk_public_headers + gtk_semi_private_headers, subdir: 'gtk-3.0/gtk')
 
 gtk_unix_sources = files(
@@ -654,6 +657,7 @@ gtk_win32_sources = files(
 )
 
 if os_win32
+  # FIXME these sources should not be added to generate_gir?
   gtk_sources += gtk_win32_sources
 endif
 
@@ -762,7 +766,7 @@ gtkprivatetypebuiltins_h = gtkprivatetypebuiltins[1]
 typefuncs = custom_target('gtktypefuncs.inc',
                           depends: [ gdkenum_h ],
                           output: 'gtktypefuncs.inc',
-                          input: gdk_headers +
+                          input: gdk_public_headers +
                             gtk_public_headers +
                             gtk_deprecated_headers +
                             [ gtktypebuiltins_h, gdkenum_h ],
@@ -846,7 +850,7 @@ endif
 
 if quartz_enabled
   gtk_sources += gtk_use_quartz_sources
-  gtk_cargs += ['-DGDK_WINDOWING_QUARTZ', '-xobjective-c']  # FIXME? maybe add_languages() instead?
+  gtk_cargs += ['-DGDK_WINDOWING_QUARTZ', '-xobjective-c']
 endif
 
 # So we don't add these twice
@@ -902,65 +906,12 @@ libgtk = shared_library('gtk-3',
 
 gtk_dep_sources = [gtkversion, gtktypebuiltins_h]
 # Introspection
-build_gir = get_option('introspection')
 if build_gir
-  gir_args = [
-    '--quiet',
-  ]
-
-  # We may build some of the dependencies as sub-projects; this means
-  # that we need to depend on the built introspection data, instead of
-  # the installed one
-  gdk_gir_inc = [ 'cairo-1.0', 'Gio-2.0', ]
-
-  if pixbuf_dep.type_name() == 'internal'
-    gdk_gir_inc += subproject('gdk-pixbuf').get_variable('gdkpixbuf_gir').get(0)
-  else
-    gdk_gir_inc += 'GdkPixbuf-2.0'
-  endif
-
-  if pango_dep.type_name() == 'internal'
-    gdk_gir_inc += subproject('pango').get_variable('pango_gir').get(0)
-  else
-    gdk_gir_inc += 'Pango-1.0'
-  endif
-
-  gdk_gir = gnome.generate_gir(libgtk,
-                               sources: gdk_public_headers + gdk_sources + [ gdkenum_h ],
-                               namespace: 'Gdk',
-                               nsversion: gtk_api_version,
-                               identifier_prefix: 'Gdk',
-                               symbol_prefix: 'gdk',
-                               export_packages: 'gtk+-3.0',
-                               includes: gdk_gir_inc,
-                               header: 'gdk/gdk.h',
-                               install: true,
-                               extra_args: gir_args + [
-                                 '-DGDK_COMPILATION',
-                               ])
-  gdk_gir_dep = declare_dependency(sources: gdk_gir)
-  gtk_dep_sources += gdk_gir
-
-  if x11_enabled
-    gdk_x11_gir = gnome.generate_gir(libgtk,
-                                     sources: gdk_x11_public_headers + gdk_x11_sources,
-                                     namespace: 'GdkX11',
-                                     nsversion: gtk_api_version,
-                                     identifier_prefix: 'Gdk',
-                                     symbol_prefix: 'gdk',
-                                     export_packages: 'gtk+-x11-3.0',
-                                     includes: [ gdk_gir[0], 'xlib-2.0', ],
-                                     install: true,
-                                     dependencies: gdk_gir_dep,
-                                     header: 'gdk/gdkx.h',
-                                     extra_args: gir_args + [
-                                       '-DGDK_COMPILATION',
-                                     ])
-    gtk_dep_sources += gdk_x11_gir
-  endif
+  gir_args = ['--quiet']
 
   gtk_introspection_sources = [
-    gtk_public_headers,
+    gtk_gir_public_headers,
+    gtk_deprecated_headers,
     gtk_sources,
     a11y_headers,
     a11y_sources,
diff --git a/meson.build b/meson.build
index c280049568..8ff261545f 100644
--- a/meson.build
+++ b/meson.build
@@ -573,6 +573,7 @@ if cloudproviders_enabled
   endif
 endif
 
+build_gir = get_option('introspection')
 subdir('gdk')
 subdir('gtk')
 subdir('modules')
diff --git a/meson_options.txt b/meson_options.txt
index 782f7153f4..79aca2aa66 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,7 +27,7 @@ option('documentation', type: 'boolean', value: 'false',
   description : 'Build API reference and tools documentation')
 option('man-pages', type: 'boolean', value: 'false',
   description : 'Build man pages for installed tools')
-option('introspection', type: 'boolean', value: 'false',
+option('introspection', type: 'boolean', value: 'true',
   description : 'Build introspection data (requires gobject-introspection)')
 
 # Demos and binaries


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]