build: Fix the introspection build

GSK has various enumeration types that are currently not used; while
they may go away, currently they are built and introspected. If we want
the introspection machinery to work, and still use static libraries to
build GDK and GSK into the GTK shared library, then we need to reference
the get_type() function of these enumeration types somewhere, to avoid
the linker discarding it, and thus breaking the build.

As luck would have it, we have an autogenerated bit of C that refers to
all the get_type() functions in the library; if we add the GSK types to
it, then we get the reference we're looking for, and the build succeeds.
This commit is contained in:
Emmanuele Bassi 2017-04-28 15:23:45 +01:00
parent ea32f4c020
commit efd2ce2be5
2 changed files with 9 additions and 6 deletions

View File

@ -23,7 +23,7 @@ for filename in in_files:
for line in f: for line in f:
line = line.rstrip('\n').rstrip('\r') line = line.rstrip('\n').rstrip('\r')
# print line # print line
match = re.search(r'\bg[td]k_[a-zA-Z0-9_]*_get_type\b', line) match = re.search(r'\bg[tds]k_[a-zA-Z0-9_]*_get_type\b', line)
if match: if match:
func = match.group(0) func = match.group(0)
if not func in funcs: if not func in funcs:

View File

@ -741,14 +741,14 @@ gtkprivatetypebuiltins_h = gtkprivatetypebuiltins[1]
# Generate gtktypefuncs.inc # Generate gtktypefuncs.inc
typefuncs = custom_target('gtktypefuncs.inc', typefuncs = custom_target('gtktypefuncs.inc',
depends: gdkenum_h, depends: [ gdkenum_h, gskenum_h, ],
output: 'gtktypefuncs.inc', output: 'gtktypefuncs.inc',
input: gdk_headers + input: gdk_headers +
gtk_public_headers + gtk_public_headers +
gtk_deprecated_headers + gtk_deprecated_headers +
gtk_private_headers + gtk_private_headers +
[ gtktypebuiltins_h, ] + [ gtktypebuiltins_h, ] +
[ gdkenum_h, ], [ gdkenum_h, gskenum_h, ],
command: [ command: [
find_program('gentypefuncs.py'), find_program('gentypefuncs.py'),
'@OUTPUT@', '@OUTPUT@',
@ -890,7 +890,8 @@ libgtk = shared_library('gtk-4',
c_args: gtk_cargs + common_cflags, c_args: gtk_cargs + common_cflags,
include_directories: [confinc, gdkinc, gskinc, gtkinc], include_directories: [confinc, gdkinc, gskinc, gtkinc],
dependencies: gtk_deps + [libgdk_dep, libgsk_dep], dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
link_with: [libgdk, libgsk, included_input_modules], link_with: [libgdk, libgsk, ],
link_whole: included_input_modules,
link_args: common_ldflags, link_args: common_ldflags,
install: true) install: true)
@ -901,7 +902,7 @@ libgtk_dep = declare_dependency(sources: [gtkversion, gtktypebuiltins_h],
link_args: common_ldflags) link_args: common_ldflags)
# Introspection # Introspection
if false if not meson.is_cross_build()
gir_args = [ gir_args = [
'--c-include=gtk/gtk.h', '--c-include=gtk/gtk.h',
] ]
@ -933,12 +934,13 @@ if false
dependencies: gdk_gir_dep, dependencies: gdk_gir_dep,
extra_args: [ extra_args: [
'--c-include=gdk/gdkx.h', '--c-include=gdk/gdkx.h',
'--include-uninstalled=./gtk/Gdk-4.0.gir',
'-DGDK_COMPILATION', '-DGDK_COMPILATION',
]) ])
endif endif
gsk_gir = gnome.generate_gir(libgtk, gsk_gir = gnome.generate_gir(libgtk,
sources: gsk_public_headers + gsk_gen_headers + gsk_public_sources, sources: gsk_public_headers + gsk_public_sources + [ gskenum_h ],
namespace: 'Gsk', namespace: 'Gsk',
nsversion: gtk_api_version, nsversion: gtk_api_version,
identifier_prefix: 'Gsk', identifier_prefix: 'Gsk',
@ -956,6 +958,7 @@ if false
dependencies: gdk_gir_dep, dependencies: gdk_gir_dep,
sources: gsk_gir) sources: gsk_gir)
gnome.generate_gir(libgtk, gnome.generate_gir(libgtk,
sources: gtk_public_headers + gtk_public_sources + dnd_sources + a11y_headers + a11y_sources + [ sources: gtk_public_headers + gtk_public_sources + dnd_sources + a11y_headers + a11y_sources + [
gtktypebuiltins_h, gtktypebuiltins_h,