build: Improve consistency of the "coding" style

We're mixing a lot of styles in the Meson build files. This is an
attempt at making everything slightly more consistent in terms of
whitespace and indentation.
This commit is contained in:
Emmanuele Bassi 2017-04-26 17:04:20 +01:00
parent 1afd415583
commit 17518ef89b
10 changed files with 276 additions and 274 deletions

View File

@ -69,74 +69,58 @@ demos = files([
'tree_store.c', 'tree_store.c',
]) ])
gtkdemo_deps = [libgtk_dep] gtkdemo_deps = [ libgtk_dep, ]
if harfbuzz_dep.found() and pangoft_dep.found() if harfbuzz_dep.found() and pangoft_dep.found()
demos += files('font_features.c') demos += files('font_features.c')
gtkdemo_deps += harfbuzz_dep gtkdemo_deps += [ harfbuzz_dep, ]
endif endif
if os_unix if os_unix
demos += files('pagesetup.c') demos += files('pagesetup.c')
endif endif
gtkdemo_args = ['-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED'] gtkdemo_args = [ '-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED', ]
demos_h = custom_target('gtk4 demo header', demos_h = custom_target('gtk4 demo header',
output : 'demos.h', output: 'demos.h',
input : demos, input: demos,
command : [find_program('geninclude.py'), '@OUTPUT@', '@INPUT@']) command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ])
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources', gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml', 'demo.gresource.xml',
source_dir: '.') source_dir: '.')
executable('gtk4-demo', executable('gtk4-demo',
'main.c', 'gtkfishbowl.c', demos, demos_h, gtkdemo_resources, 'main.c', 'gtkfishbowl.c', demos, demos_h, gtkdemo_resources,
c_args : gtkdemo_args, c_args: gtkdemo_args,
dependencies : gtkdemo_deps, dependencies: gtkdemo_deps,
include_directories : confinc, include_directories: confinc,
gui_app : true, gui_app: true,
install : true) install: true)
executable('gtk4-demo-application', executable('gtk4-demo-application',
'application.c', gtkdemo_resources, 'application.c', gtkdemo_resources,
c_args : gtkdemo_args, c_args: gtkdemo_args,
dependencies : gtkdemo_deps, dependencies: gtkdemo_deps,
include_directories : confinc, include_directories: confinc,
gui_app : true, gui_app: true,
install : true) install: true)
# icons # icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
icontheme_dir = join_paths(get_option('datadir'), 'icons/hicolor') foreach icon_size: [ '16x16', '22x22', '24x24', '32x32', '48x48', '256x256', ]
foreach icon_size : ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
gtk_demo_icons_dir = join_paths(icontheme_dir, '@0@/apps'.format(icon_size)) gtk_demo_icons_dir = join_paths(icontheme_dir, '@0@/apps'.format(icon_size))
install_data('data/@0@/gtk4-demo.png'.format(icon_size), install_data('data/@0@/gtk4-demo.png'.format(icon_size),
install_dir : gtk_demo_icons_dir) install_dir: gtk_demo_icons_dir)
install_data('data/@0@/gtk4-demo-symbolic.symbolic.png'.format(icon_size), install_data('data/@0@/gtk4-demo-symbolic.symbolic.png'.format(icon_size),
install_dir : gtk_demo_icons_dir) install_dir: gtk_demo_icons_dir)
endforeach endforeach
# FIXME: check if there are ordering guarantees, i.e. this is actually run
# only after all the icons have been installed.
# TODO: uninstall script, once we have an uninstall target (Meson issue)
# TODO: should we be able to pass a locally-built exe here? (Meson issue)
if not meson.is_cross_build() or meson.has_exe_wrapper()
# FIXME: this errors out, probably needs to be done differently or with wrapper script
#meson.add_install_script(gtk_update_icon_cache.full_path(),
# '--ignore-theme-index',
# '--force',
# icontheme_dir)
endif
# desktop file # desktop file
install_data('gtk4-demo.desktop', install_dir: gtk_applicationsdir)
install_data('gtk4-demo.desktop',
install_dir : join_paths(get_option('datadir'), 'applications'))
# GSettings # GSettings
install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
install_data('org.gtk.Demo.gschema.xml', gnome.compile_schemas()
install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas/'))

View File

@ -6,16 +6,14 @@ iconbrowser_sources = [
] ]
iconbrowser_resources = gnome.compile_resources('iconbrowser_resources', iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
'iconbrowser.gresource.xml', 'iconbrowser.gresource.xml',
source_dir: '.') source_dir: '.')
executable('gtk4-icon-browser', executable('gtk4-icon-browser',
iconbrowser_sources, iconbrowser_sources, iconbrowser_resources,
iconbrowser_resources, dependencies: libgtk_dep,
dependencies: libgtk_dep, include_directories: confinc,
include_directories : confinc, gui_app: true,
gui_app: true, install: true)
install: true)
install_data('gtk4-icon-browser.desktop', install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir)
install_dir : join_paths(get_option('datadir'), 'applications'))

View File

@ -1,38 +1,26 @@
# demos/widget-factory # demos/widget-factory
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources', widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml', 'widget-factory.gresource.xml',
source_dir: '.') source_dir: '.')
executable('gtk4-widget-factory', executable('gtk4-widget-factory',
'widget-factory.c', 'widget-factory.c', widgetfactory_resources,
widgetfactory_resources, dependencies: libgtk_dep,
dependencies: libgtk_dep, include_directories: confinc,
include_directories : confinc, gui_app: true,
gui_app: true, install: true)
install: true)
# desktop file # desktop file
install_data('gtk4-widget-factory.desktop', install_dir: gtk_applicationsdir)
install_data('gtk4-widget-factory.desktop',
install_dir : join_paths(get_option('datadir'), 'applications'))
# icons # icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
icontheme_dir = join_paths(get_option('datadir'), 'icons/hicolor') foreach icon_size : ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256', ]
foreach icon_size : ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
icons_dir = join_paths(icontheme_dir, '@0@/apps'.format(icon_size)) icons_dir = join_paths(icontheme_dir, '@0@/apps'.format(icon_size))
install_data('data/@0@/gtk4-widget-factory.png'.format(icon_size), install_data('data/@0@/gtk4-widget-factory.png'.format(icon_size),
install_dir : icons_dir) install_dir: icons_dir)
install_data('data/@0@/gtk4-widget-factory-symbolic.symbolic.png'.format(icon_size), install_data('data/@0@/gtk4-widget-factory-symbolic.symbolic.png'.format(icon_size),
install_dir : icons_dir) install_dir: icons_dir)
endforeach endforeach
if not meson.is_cross_build() or meson.has_exe_wrapper()
# FIXME: this errors out, probably needs to be done differently or with wrapper script
#meson.add_install_script(gtk_update_icon_cache.full_path(),
# '--ignore-theme-index',
# '--force',
# icontheme_dir)
endif

View File

@ -1,5 +1,5 @@
bp_resources = gnome.compile_resources('bloatpad_resources', bp_resources = gnome.compile_resources('bloatpad_resources',
'bloatpad.gresources.xml', 'bloatpad.gresources.xml',
source_dir: '.') source_dir: '.')
executable('bloatpad', 'bloatpad.c', bp_resources, dependencies: libgtk_dep) executable('bloatpad', 'bloatpad.c', bp_resources, dependencies: libgtk_dep)

View File

@ -13,10 +13,12 @@ foreach ex : examples
# TODO: name clash with testsuite/gtk/builder, rename one of the two # TODO: name clash with testsuite/gtk/builder, rename one of the two
example_name = ex == 'builder' ? 'builder_example' : ex example_name = ex == 'builder' ? 'builder_example' : ex
executable(example_name, '@0@.c'.format(ex), executable(example_name, '@0@.c'.format(ex),
c_args : ['-DGDK_DISABLE_DEPRECATED', c_args: [
'-DGTK_DISABLE_DEPRECATED', '-DGDK_DISABLE_DEPRECATED',
'-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir())], '-DGTK_DISABLE_DEPRECATED',
dependencies: libgtk_dep) '-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir()),
],
dependencies: libgtk_dep)
endforeach endforeach
subdir('bp') subdir('bp')

View File

@ -68,7 +68,11 @@ gdk_x11_deps = [
] ]
libgdk_x11 = static_library('gdk-x11', libgdk_x11 = static_library('gdk-x11',
gdk_x11_sources, gdkconfig, gdkenum_h, gdk_x11_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc], include_directories: [ confinc, gdkinc, ],
c_args: ['-DGDK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"'], c_args: [
dependencies: [gdk_deps, gdk_x11_deps]) '-DGDK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
'-DG_LOG_USE_STRUCTURED=1',
],
dependencies: [ gdk_deps, gdk_x11_deps, ])

View File

@ -605,7 +605,7 @@ if os_unix
'gtkunixprint-autocleanups.h', 'gtkunixprint-autocleanups.h',
'gtkunixprint.h', 'gtkunixprint.h',
] ]
install_headers(gtk_unix_print_headers, subdir : 'gtk-4.0/unix-print/gtk') install_headers(gtk_unix_print_headers, subdir: 'gtk-4.0/unix-print/gtk')
gtk_sources += files([ gtk_sources += files([
'gtkcustompaperunixdialog.c', 'gtkcustompaperunixdialog.c',
@ -664,7 +664,7 @@ if quartz_enabled
endif endif
if not (x11_enabled or win32_enabled or quartz_enabled) if not (x11_enabled or win32_enabled or quartz_enabled)
gtk_sources += ['gtkmountoperation-stub.c'] gtk_sources += ['gtkmountoperation-stub.c', ]
endif endif
gen_gtk_gresources_xml = find_program('gen-gtk-gresources-xml.py') gen_gtk_gresources_xml = find_program('gen-gtk-gresources-xml.py')
@ -672,17 +672,18 @@ gen_gtk_gresources_xml = find_program('gen-gtk-gresources-xml.py')
# handled here, and also with the working dir from which the script is called. # handled here, and also with the working dir from which the script is called.
# Hopefully all to be fixed in Meson 0.39 # Hopefully all to be fixed in Meson 0.39
outfile = '@0@/gtk.gresources.xml'.format(meson.current_build_dir()) outfile = '@0@/gtk.gresources.xml'.format(meson.current_build_dir())
gtk_gresources_xml = configure_file(output : 'gtk.gresources.xml', gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml',
input : 'gtk/ui/gtkdialog.ui', # FIXME: shouldn't be needed command: [
command : [gen_gtk_gresources_xml, meson.current_source_dir(), outfile]) gen_gtk_gresources_xml,
meson.current_source_dir(),
outfile
])
gtkresources = gnome.compile_resources( gtkresources = gnome.compile_resources('gtkresources',
'gtkresources', gtk_gresources_xml,
gtk_gresources_xml, source_dir: meson.current_source_dir(),
source_dir: meson.current_source_dir(), c_name: '_gtk',
c_name: '_gtk', extra_args: '--manual-register')
extra_args: '--manual-register'
)
gtk_x11_sources = files([ gtk_x11_sources = files([
'gtkapplication-x11.c', 'gtkapplication-x11.c',
@ -693,6 +694,10 @@ gtk_wayland_sources = files([
'gtkapplication-wayland.c' 'gtkapplication-wayland.c'
]) ])
gtk_use_wayland_or_x11_c_sources = files([
'gtkapplication-dbus.c'
])
if quartz_enabled if quartz_enabled
dnd_sources = files([ dnd_sources = files([
'gtkclipboard-quartz.c', 'gtkclipboard-quartz.c',
@ -706,46 +711,50 @@ else
]) ])
endif endif
gtk_use_wayland_or_x11_c_sources = files([
'gtkapplication-dbus.c'
])
gtk_dbus_src = gnome.gdbus_codegen('gtkdbusgenerated', gtk_dbus_src = gnome.gdbus_codegen('gtkdbusgenerated',
'gtkdbusinterfaces.xml', 'gtkdbusinterfaces.xml',
interface_prefix: 'org.Gtk.', interface_prefix: 'org.Gtk.',
namespace: '_Gtk') namespace: '_Gtk')
gtkmarshalers = gnome.genmarshal('gtkmarshalers', gtkmarshalers = gnome.genmarshal('gtkmarshalers',
sources : 'gtkmarshalers.list', sources: 'gtkmarshalers.list',
prefix : '_gtk_marshal', prefix: '_gtk_marshal',
valist_marshallers : true) valist_marshallers: true)
gtkmarshal_h = gtkmarshalers[1] gtkmarshal_h = gtkmarshalers[1]
gtktypebuiltins = gnome.mkenums('gtktypebuiltins', gtktypebuiltins = gnome.mkenums('gtktypebuiltins',
sources: gtk_public_headers + gtk_deprecated_headers + a11y_headers, sources: gtk_public_headers + gtk_deprecated_headers + a11y_headers,
c_template : 'gtktypebuiltins.c.template', c_template: 'gtktypebuiltins.c.template',
h_template : 'gtktypebuiltins.h.template', h_template: 'gtktypebuiltins.h.template',
install_dir : 'include/gtk-4.0/gtk', install_dir: join_paths(gtk_includedir, 'gtk-4.0/gtk'),
install_header : true) install_header: true)
gtktypebuiltins_h = gtktypebuiltins[1] gtktypebuiltins_h = gtktypebuiltins[1]
gtkprivatetypebuiltins = gnome.mkenums('gtkprivatetypebuiltins', gtkprivatetypebuiltins = gnome.mkenums('gtkprivatetypebuiltins',
sources: gtk_private_type_headers, sources: gtk_private_type_headers,
c_template : 'gtkprivatetypebuiltins.c.template', c_template: 'gtkprivatetypebuiltins.c.template',
h_template : 'gtkprivatetypebuiltins.h.template') h_template: 'gtkprivatetypebuiltins.h.template')
gtkprivatetypebuiltins_h = gtkprivatetypebuiltins[1] 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,
output : 'gtktypefuncs.inc', output: 'gtktypefuncs.inc',
input : gdk_headers + gtk_public_headers + gtk_deprecated_headers + gtk_private_headers + [gtktypebuiltins_h] + [gdkenum_h], input: gdk_headers +
command: [find_program('gentypefuncs.py'), '@OUTPUT@', '@INPUT@'], gtk_public_headers +
install: false, gtk_deprecated_headers +
) gtk_private_headers +
[ gtktypebuiltins_h, ] +
[ gdkenum_h, ],
command: [
find_program('gentypefuncs.py'),
'@OUTPUT@',
'@INPUT@',
],
install: false)
gtkversion_cdata = configuration_data() gtkversion_cdata = configuration_data()
gtkversion_cdata.set('GTK_MAJOR_VERSION', gtk_major_version) gtkversion_cdata.set('GTK_MAJOR_VERSION', gtk_major_version)
@ -754,23 +763,27 @@ gtkversion_cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
gtkversion_cdata.set('GTK_BINARY_AGE', gtk_binary_age) gtkversion_cdata.set('GTK_BINARY_AGE', gtk_binary_age)
gtkversion_cdata.set('GTK_INTERFACE_AGE', gtk_interface_age) gtkversion_cdata.set('GTK_INTERFACE_AGE', gtk_interface_age)
gtkversion = configure_file( gtkversion = configure_file(input: 'gtkversion.h.in',
input : 'gtkversion.h.in', output: 'gtkversion.h',
output : 'gtkversion.h', configuration: gtkversion_cdata,
configuration: gtkversion_cdata, install_dir: join_paths(gtk_includedir, 'gtk-4.0/gtk'))
install_dir: 'include/gtk-4.0/gtk'
)
gtk_cargs = [ gtk_cargs = [
'-DGTK_COMPILATION', '-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gtk"', '-DG_LOG_DOMAIN="Gtk"',
'-DG_LOG_USE_STRUCTURED=1',
'-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED', '-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED',
'-DGTK_BINARY_VERSION="@0@"'.format(gtk_binary_version), '-DGTK_BINARY_VERSION="@0@"'.format(gtk_binary_version),
'-DGTK_HOST="@0@"'.format(host_machine.system()), '-DGTK_HOST="@0@"'.format(host_machine.system()),
'-DGTK_DATA_PREFIX="@0@"'.format(gtk_prefix), '-DGTK_DATA_PREFIX="@0@"'.format(gtk_prefix),
] ]
gtk_gen_headers = [gtkmarshal_h, gtktypebuiltins_h, gtkprivatetypebuiltins_h, gtkversion] gtk_gen_headers = [
gtkmarshal_h,
gtktypebuiltins_h,
gtkprivatetypebuiltins_h,
gtkversion,
]
gtk_sources += [ gtk_sources += [
gtk_dbus_src, gtk_dbus_src,
@ -826,73 +839,73 @@ if x11_enabled or wayland_enabled
gtk_deps += pangoft_dep gtk_deps += pangoft_dep
endif endif
# org.gtk.Settings.FileChooser.gschema.xml gtk_settings_schemas = [
# org.gtk.Settings.ColorChooser.gschema.xml 'org.gtk.Settings.FileChooser.gschema.xml',
# org.gtk.Settings.Debug.gschema.xml 'org.gtk.Settings.ColorChooser.gschema.xml',
'org.gtk.Settings.Debug.gschema.xml',
]
install_data(gtk_settings_schemas, install_dir: gtk_schemasdir)
gnome.compile_schemas() gnome.compile_schemas()
# Check for more things # Check for more things
if cc.has_header('langinfo.h') if cc.has_header('langinfo.h')
foreach nl_enum : [ '_NL_MEASUREMENT_MEASUREMENT', foreach nl_enum: [ '_NL_MEASUREMENT_MEASUREMENT',
'_NL_PAPER_HEIGHT', '_NL_PAPER_HEIGHT',
'_NL_PAPER_WIDTH', '_NL_PAPER_WIDTH',
'_NL_TIME_FIRST_WEEKDAY' ] '_NL_TIME_FIRST_WEEKDAY', ]
cdata.set('HAVE_' + nl_enum, cc.has_header_symbol('langinfo.h', nl_enum)) cdata.set('HAVE_' + nl_enum, cc.has_header_symbol('langinfo.h', nl_enum))
endforeach endforeach
endif endif
# Input methods # Input methods
gen_headers = [gtk_gen_headers, gsk_gen_headers, gdk_gen_headers] gen_headers = [ gtk_gen_headers, gsk_gen_headers, gdk_gen_headers, ]
included_input_modules = [] included_input_modules = []
foreach m : inc_im_method_defs # populated in modules/input/meson.build foreach m: inc_im_method_defs # populated in modules/input/meson.build
im_name = m[0] im_name = m[0]
im_srcs = m[1] im_srcs = m[1]
im_args = m[2] im_args = m[2]
im_libs = m[3] im_libs = m[3]
included_input_modules += static_library('im-@0@'.format(im_name), included_input_modules += static_library('im-@0@'.format(im_name),
im_srcs, gen_headers, im_srcs, gen_headers,
c_args : im_args, c_args: im_args,
include_directories : [confinc, gdkinc, gtkinc], include_directories: [confinc, gdkinc, gtkinc],
dependencies : gtk_deps + im_libs) dependencies: gtk_deps + im_libs)
endforeach endforeach
foreach m : dyn_im_method_defs # populated in modules/input/meson.build foreach m: dyn_im_method_defs # populated in modules/input/meson.build
im_name = m[0] im_name = m[0]
im_srcs = m[1] im_srcs = m[1]
im_args = m[2] im_args = m[2]
im_libs = m[3] im_libs = m[3]
shared_module('im-@0@'.format(im_name), im_srcs, gen_headers, shared_module('im-@0@'.format(im_name), im_srcs, gen_headers,
c_args : im_args, c_args: im_args,
include_directories : [confinc, gdkinc, gtkinc], include_directories: [confinc, gdkinc, gtkinc],
dependencies : gtk_deps + im_libs, dependencies: gtk_deps + im_libs,
name_prefix : '', # we want im-foo.so not libim-foo.so name_prefix: '', # we want im-foo.so not libim-foo.so
install_dir : immodules_install_dir, install_dir: immodules_install_dir,
install : true) install: true)
endforeach endforeach
# Library # Library
libgtk = shared_library('gtk-4', libgtk = shared_library('gtk-4',
soversion: gtk_soversion, soversion: gtk_soversion,
sources: [typefuncs, gtk_sources, gtkmarshal_h, gtkprivatetypebuiltins_h], sources: [typefuncs, gtk_sources, gtkmarshal_h, gtkprivatetypebuiltins_h],
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, included_input_modules],
link_args: common_ldflags, link_args: common_ldflags,
install: true) install: true)
libgtk_dep = declare_dependency( libgtk_dep = declare_dependency(sources: [gtkversion, gtktypebuiltins_h],
sources: [gtkversion, gtktypebuiltins_h], include_directories: [confinc, gtkinc],
include_directories: [confinc, gtkinc], dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
dependencies: gtk_deps + [libgdk_dep, libgsk_dep], link_with: libgtk,
link_with: libgtk, link_args: common_ldflags)
link_args: common_ldflags)
# Introspection # Introspection
if false if false
@ -901,35 +914,54 @@ if false
] ]
gdk_gir = gnome.generate_gir(libgtk, gdk_gir = gnome.generate_gir(libgtk,
sources: gdk_public_headers + gdk_public_sources + [ gdkenum_h ], sources: gdk_public_headers + gdk_public_sources + [ gdkenum_h ],
namespace: 'Gdk', namespace: 'Gdk',
nsversion: gtk_api_version, nsversion: gtk_api_version,
identifier_prefix: 'Gdk', identifier_prefix: 'Gdk',
symbol_prefix: 'gdk', symbol_prefix: 'gdk',
export_packages: 'gtk+-4.0', export_packages: 'gtk+-4.0',
includes: [ 'Gio-2.0', 'GdkPixbuf-2.0', 'Pango-1.0', 'cairo-1.0', ], includes: [ 'Gio-2.0', 'GdkPixbuf-2.0', 'Pango-1.0', 'cairo-1.0', ],
install: true, install: true,
extra_args: gir_args + [ extra_args: gir_args + [
'-DGDK_COMPILATION', '-DGDK_COMPILATION',
]) ])
gdk_gir_dep = declare_dependency(link_with: libgtk, sources: gdk_gir) gdk_gir_dep = declare_dependency(link_with: libgtk, sources: gdk_gir)
gsk_gir = gnome.generate_gir(libgtk, if x11_enabled
sources: gsk_public_headers + gsk_public_sources + [ gskenum_h ], gnome.generate_gir(libgtk,
namespace: 'Gsk', sources: gdk_x11_public_headers + gdk_x11_sources,
nsversion: gtk_api_version, namespace: 'GdkX11',
identifier_prefix: 'Gsk', nsversion: gtk_api_version,
symbol_prefix: 'gsk', identifier_prefix: 'Gdk',
export_packages: 'gtk+-4.0', symbol_prefix: 'gdk',
includes: [ 'Graphene-1.0', 'Gdk-4.0' ], export_packages: 'gtk+-x11-4.0',
install: true, includes: [ 'Gio-2.0', 'GdkPixbuf-2.0', 'Pango-1.0', 'xlib-2.0', ],
dependencies: gdk_gir_dep, install: true,
extra_args: gir_args + [ dependencies: gdk_gir_dep,
'--include-uninstalled=./gtk/Gdk-4.0.gir', extra_args: [
'-DGSK_COMPILATION', '--c-include=gdk/gdkx.h',
]) '-DGDK_COMPILATION',
])
endif
gsk_gir_dep = declare_dependency(link_with: libgtk, dependencies: gdk_gir_dep, sources: gsk_gir) gsk_gir = gnome.generate_gir(libgtk,
sources: gsk_public_headers + gsk_gen_headers + gsk_public_sources,
namespace: 'Gsk',
nsversion: gtk_api_version,
identifier_prefix: 'Gsk',
symbol_prefix: 'gsk',
export_packages: 'gtk+-4.0',
includes: [ 'Graphene-1.0', 'Gdk-4.0' ],
install: true,
dependencies: gdk_gir_dep,
extra_args: gir_args + [
'--include-uninstalled=./gtk/Gdk-4.0.gir',
'-DGSK_COMPILATION',
])
gsk_gir_dep = declare_dependency(link_with: libgtk,
dependencies: gdk_gir_dep,
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 + [
@ -953,7 +985,6 @@ if false
endif endif
# Installed tools # Installed tools
gtk_tools = [ gtk_tools = [
['gtk4-query-settings', ['gtk-query-settings.c']], ['gtk4-query-settings', ['gtk-query-settings.c']],
['gtk4-builder-tool', ['gtk-builder-tool.c']], ['gtk4-builder-tool', ['gtk-builder-tool.c']],
@ -963,32 +994,31 @@ gtk_tools = [
['gtk4-query-immodules', ['queryimmodules.c', 'gtkutils.c']], ['gtk4-query-immodules', ['queryimmodules.c', 'gtkutils.c']],
] ]
foreach tool : gtk_tools foreach tool: gtk_tools
tool_name = tool.get(0) tool_name = tool.get(0)
tool_srcs = tool.get(1) tool_srcs = tool.get(1)
exe = executable(tool_name, tool_srcs, exe = executable(tool_name, tool_srcs,
include_directories: [confinc], include_directories: [confinc],
c_args: gtk_cargs, c_args: gtk_cargs,
dependencies: libgtk_dep, dependencies: libgtk_dep,
install: true) install: true)
set_variable(tool_name.underscorify(), exe) # used in testsuites set_variable(tool_name.underscorify(), exe) # used in testsuites
endforeach endforeach
# Data to install # Data to install
install_data('gtkbuilder.rng', install_data('gtkbuilder.rng',
install_dir : join_paths(get_option('datadir'),'gtk-4.0')) install_dir: join_paths(gtk_datadir, 'gtk-4.0'))
install_data('gtkbuilder.loc', 'gtkbuilder.its', install_data('gtkbuilder.loc', 'gtkbuilder.its',
install_dir : join_paths(get_option('datadir'),'gettext/its')) install_dir: join_paths(gtk_datadir, 'gettext/its'))
if quartz_enabled if quartz_enabled
# HACK: install_data() doesn't allow installing under a different name (#1487) # HACK: install_data() doesn't allow installing under a different name (#1487)
# FIXME: or maybe just rename it to gtk-keys.css in the src tree? # FIXME: or maybe just rename it to gtk-keys.css in the src tree?
configure_file(input : 'gtk-keys.css.mac', configure_file(input: 'gtk-keys.css.mac',
output : 'gtk-keys.css', output: 'gtk-keys.css',
configuration : configuration_data(), configuration: configuration_data(),
install_dir : join_paths(get_option('datadir'),'themes/Mac/gtk-4.0')) install_dir: join_paths(get_option('datadir'), 'themes/Mac/gtk-4.0'))
endif endif

View File

@ -56,7 +56,7 @@ gtk_major_version = gtk_version.split('.')[0].to_int()
gtk_minor_version = gtk_version.split('.')[1].to_int() gtk_minor_version = gtk_version.split('.')[1].to_int()
gtk_micro_version = gtk_version.split('.')[2].to_int() gtk_micro_version = gtk_version.split('.')[2].to_int()
gtk_interface_age = 0 gtk_interface_age = 0
add_project_arguments('-DGTK_VERSION="' + meson.project_version() + '"', language: 'c') add_project_arguments('-DGTK_VERSION="@0@"'.format(meson.project_version()), language: 'c')
add_project_arguments('-D_GNU_SOURCE', language : 'c') add_project_arguments('-D_GNU_SOURCE', language : 'c')
@ -77,8 +77,8 @@ x11_enabled = get_option('enable-x11-backend')
wayland_enabled = get_option('enable-wayland-backend') wayland_enabled = get_option('enable-wayland-backend')
broadway_enabled = get_option('enable-broadway-backend') broadway_enabled = get_option('enable-broadway-backend')
mir_enabled = get_option('enable-mir-backend') mir_enabled = get_option('enable-mir-backend')
quartz_enabled = false # FIXME quartz_enabled = get_option('enable-quartz-backend')
win32_enabled = false # FIXME win32_enabled = get_option('enable-win32-backend')
os_unix = false os_unix = false
os_linux = false os_linux = false
@ -324,13 +324,16 @@ backend_immodules = []
pc_gdk_extra_libs = [] pc_gdk_extra_libs = []
cairo_backends = [] cairo_backends = []
foreach backend : [['cairo-xlib', x11_enabled], foreach backend: [ ['cairo-xlib', cairo_req, x11_enabled],
['cairo-win32', win32_enabled], ['cairo-win32', cairo_req, win32_enabled],
['cairo-quartz', quartz_enabled], ['cairo-quartz', cairo_req, quartz_enabled],
['cairo', broadway_enabled or wayland_enabled or mir_enabled]] ['cairo', cairo_req, broadway_enabled or wayland_enabled or mir_enabled], ]
if backend[1] backend_enabled = backend.get(2)
dependency(backend[0], version: cairo_req) cairo_backend_req = backend.get(1)
cairo_backends += [backend[0]] cairo_backend = backend.get(0)
if backend_enabled
dependency(cairo_backend, version: cairo_backend_req)
cairo_backends += [ cairo_backend ]
endif endif
endforeach endforeach
@ -391,28 +394,31 @@ if x11_enabled
cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found()) cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found())
cdata.set('HAVE_XFIXES', xfixes_dep.found()) cdata.set('HAVE_XFIXES', xfixes_dep.found())
if cc.has_function('XkbQueryExtension', dependencies : x11_dep, if cc.has_function('XkbQueryExtension', dependencies: x11_dep,
prefix : '#include <X11/XKBlib.h>') prefix : '#include <X11/XKBlib.h>')
cdata.set('HAVE_XKB', 1) cdata.set('HAVE_XKB', 1)
endif endif
if cc.has_function('XSyncQueryExtension', dependencies : xext_dep, if cc.has_function('XSyncQueryExtension', dependencies: xext_dep,
prefix : '''#include <X11/Xlib.h> prefix: '''#include <X11/Xlib.h>
#include <X11/extensions/sync.h>''') #include <X11/extensions/sync.h>''')
cdata.set('HAVE_XSYNC', 1) cdata.set('HAVE_XSYNC', 1)
endif endif
if cc.has_function('XGetEventData', dependencies : x11_dep) if cc.has_function('XGetEventData', dependencies: x11_dep)
cdata.set('HAVE_XGENERICEVENTS', 1) cdata.set('HAVE_XGENERICEVENTS', 1)
endif endif
if xi_dep.found() and cc.has_header('X11/extensions/XInput2.h', dependencies : xi_dep) if xi_dep.found() and cc.has_header('X11/extensions/XInput2.h', dependencies: xi_dep)
cdata.set('XINPUT_2', 1) cdata.set('XINPUT_2', 1)
# Note that we also check that the XIScrollClassInfo struct is defined, # Note that we also check that the XIScrollClassInfo struct is defined,
# because at least Ubuntu Oneiric seems to have XIAllowTouchEvents(), # because at least Ubuntu Oneiric seems to have XIAllowTouchEvents(),
# but not the XIScrollClassInfo struct # but not the XIScrollClassInfo struct
prefix = '#include<X11/Xlib.h>\n#include<X11/extensions/XInput2.h>' has_allow_touch_evens = cc.has_function('XIAllowTouchEvents', dependencies: xi_dep)
if cc.has_function('XIAllowTouchEvents', dependencies : xi_dep) and cc.has_member('XIScrollClassInfo', 'number', prefix: prefix, dependencies : xi_dep) has_scroll_class_info = cc.has_member('XIScrollClassInfo', 'number', dependencies: xi_dep,
prefix: '''#include <X11/Xlib.h>
#include <X11/extensions/XInput2.h>''')
if has_allow_touch_evens and has_scroll_class_info
cdata.set('XINPUT_2_2', 1) cdata.set('XINPUT_2_2', 1)
endif endif
endif endif
@ -420,12 +426,10 @@ if x11_enabled
enable_xinerama = get_option('enable-xinerama') enable_xinerama = get_option('enable-xinerama')
if enable_xinerama != 'no' if enable_xinerama != 'no'
want_xinerama = enable_xinerama == 'yes' want_xinerama = enable_xinerama == 'yes'
xinerama_dep = dependency('xinerama', required : want_xinerama) xinerama_dep = dependency('xinerama', required: want_xinerama)
if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies : xinerama_dep) if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
cdata.set('HAVE_XFREE_XINERAMA', 1) cdata.set('HAVE_XFREE_XINERAMA', 1)
x11_pkgs += ['xinerama'] x11_pkgs += ['xinerama']
elif want_xinerama
error('No function XineramaQueryExtension in xinerama dependency which was explicitly requested.')
endif endif
else else
xinerama_dep = [] xinerama_dep = []
@ -437,8 +441,8 @@ endif
mir_pkgs = [] mir_pkgs = []
if mir_enabled if mir_enabled
mirclient_dep = dependency('mirclient', version : mirclient_req) mirclient_dep = dependency('mirclient', version: mirclient_req)
mircookie_dep = dependency('mircookie', version : mircookie_req) mircookie_dep = dependency('mircookie', version: mircookie_req)
libcontent_hub_glib_dep = dependency('libcontenthub-glib') libcontent_hub_glib_dep = dependency('libcontenthub-glib')
mir_pkgs = [ mir_pkgs = [
@ -478,8 +482,8 @@ have_vulkan = false
vulkan_lib = [] vulkan_lib = []
enable_vulkan = get_option('enable-vulkan') enable_vulkan = get_option('enable-vulkan')
if enable_vulkan != 'no' if enable_vulkan != 'no'
vulkan_lib = cc.find_library('vulkan', required : false) vulkan_lib = cc.find_library('vulkan', required: false)
if vulkan_lib.found() and cc.has_function('vkCreateInstance', dependencies : vulkan_lib) and cc.has_header('vulkan/vulkan.h') if vulkan_lib.found() and cc.has_function('vkCreateInstance', dependencies: vulkan_lib) and cc.has_header('vulkan/vulkan.h')
have_vulkan = true have_vulkan = true
pc_gdk_extra_libs += ['-lvulkan'] pc_gdk_extra_libs += ['-lvulkan']
elif enable_vulkan == 'yes' elif enable_vulkan == 'yes'
@ -500,13 +504,11 @@ subdir('testsuite')
subdir('examples') subdir('examples')
# config.h # config.h
configure_file(input: 'config.h.meson', configure_file(input: 'config.h.meson',
output: 'config.h', output: 'config.h',
configuration: cdata) configuration: cdata)
# pkg-config files - bit of a mess all of this # pkg-config files - bit of a mess all of this
pkgconf = configuration_data() pkgconf = configuration_data()
pkgconf.set('prefix', get_option('prefix')) pkgconf.set('prefix', get_option('prefix'))
@ -520,29 +522,23 @@ pkgconf.set('host', '@0@-@1@'.format(host_machine.cpu_family(), host_machine.sys
# Requires # Requires
pango_pkgname = win32_enabled ? 'pangowin32' : 'pango' pango_pkgname = win32_enabled ? 'pangowin32' : 'pango'
pkgconf.set('GDK_PACKAGES', ' '.join([ pkgconf.set('GDK_PACKAGES',
pango_pkgname, pango_req, ' '.join([ pango_pkgname, pango_req,
'pangocairo', pango_req, 'pangocairo', pango_req,
'gdk-pixbuf-2.0', gdk_pixbuf_req, 'gdk-pixbuf-2.0', gdk_pixbuf_req,
'cairo', cairo_req, 'cairo', cairo_req,
'cairo-gobject', cairo_req])) 'cairo-gobject', cairo_req ]))
pkgconf.set('GSK_PACKAGES', ' '.join([ pkgconf.set('GSK_PACKAGES',
#'gdk-pixbuf-2.0', gdk_pixbuf_req, ' '.join([ 'graphene-gobject-1.0', graphene_req ]))
#'cairo', cairo_req, pkgconf.set('GTK_PACKAGES',
#'cairo-gobject', cairo_req, ' '.join([ 'atk', atk_req,
'graphene-gobject-1.0', graphene_req])) 'gio-2.0', glib_req ]))
pkgconf.set('GTK_PACKAGES', ' '.join([
'atk', atk_req,
#'cairo', cairo_req,
#'cairo-gobject', cairo_req,
#'gdk-pixbuf-2.0', gdk_pixbuf_req,
'gio-2.0', glib_req]))
# Requires.private # Requires.private
gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0' gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0'
pkgconf.set('GDK_PRIVATE_PACKAGES', ' '.join([ pkgconf.set('GDK_PRIVATE_PACKAGES',
gio_pkgname, glib_req, ' '.join([ gio_pkgname, glib_req,
'epoxy', epoxy_req] + x11_pkgs + wayland_pkgs + mir_pkgs + cairo_backends)) 'epoxy', epoxy_req ] + x11_pkgs + wayland_pkgs + mir_pkgs + cairo_backends))
pkgconf.set('GSK_PRIVATE_PACKAGES', '') # all already in GDK_PRIVATE_PACKAGES pkgconf.set('GSK_PRIVATE_PACKAGES', '') # all already in GDK_PRIVATE_PACKAGES
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : [] pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
pkgconf.set('GTK_PRIVATE_PACKAGES', ' '.join(atk_pkgs + pangoft2_pkgs)) pkgconf.set('GTK_PRIVATE_PACKAGES', ' '.join(atk_pkgs + pangoft2_pkgs))
@ -557,10 +553,10 @@ pkgconf.set('GTK_EXTRA_CFLAGS', '')
pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig') pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
pkgs = ['gtk+-4.0.pc'] pkgs = [ 'gtk+-4.0.pc' ]
pkg_targets = '' pkg_targets = ''
foreach backend : ['broadway', 'mir', 'quartz', 'wayland', 'win32', 'x11'] foreach backend: [ 'broadway', 'mir', 'quartz', 'wayland', 'win32', 'x11', ]
if get_variable('@0@_enabled'.format(backend)) if get_variable('@0@_enabled'.format(backend))
pkgs += ['gtk+-@0@-4.0.pc'.format(backend)] pkgs += ['gtk+-@0@-4.0.pc'.format(backend)]
pkg_targets += ' ' + backend pkg_targets += ' ' + backend
@ -568,18 +564,18 @@ foreach backend : ['broadway', 'mir', 'quartz', 'wayland', 'win32', 'x11']
endforeach endforeach
pkgconf.set('GDK_BACKENDS', pkg_targets.strip()) pkgconf.set('GDK_BACKENDS', pkg_targets.strip())
foreach pkg : pkgs foreach pkg: pkgs
configure_file(input : 'gtk+-4.0.pc.in', configure_file(input: 'gtk+-4.0.pc.in',
output : pkg, output: pkg,
configuration : pkgconf, configuration: pkgconf,
install_dir : pkg_install_dir) install_dir: pkg_install_dir)
endforeach endforeach
if host_machine.system() != 'windows' if host_machine.system() != 'windows'
configure_file(input : 'gtk+-unix-print-4.0.pc.in', configure_file(input: 'gtk+-unix-print-4.0.pc.in',
output : 'gtk+-unix-print-4.0.pc', output: 'gtk+-unix-print-4.0.pc',
configuration : pkgconf, configuration: pkgconf,
install_dir : pkg_install_dir) install_dir: pkg_install_dir)
endif endif
subdir('po') subdir('po')

View File

@ -42,22 +42,22 @@ else
included_immodules = included_immodules.split(',') included_immodules = included_immodules.split(',')
endif endif
foreach im : included_immodules foreach im: included_immodules
if not all_immodules.contains(im) if not all_immodules.contains(im)
error('The specified input method "@0@" is not available (available methods: @1@)'.format(im, ', '.join(all_immodules))) error('The specified input method "@0@" is not available (available methods: @1@)'.format(im, ', '.join(all_immodules)))
endif endif
endforeach endforeach
immodules_subdir = 'gtk-4.0/@0@/immodules'.format(gtk_binary_version) immodules_subdir = 'gtk-4.0/@0@/immodules'.format(gtk_binary_version)
immodules_install_dir = join_paths(get_option('libdir'), immodules_subdir) immodules_install_dir = join_paths(gtk_libdir, immodules_subdir)
sysconfdir = join_paths(get_option('prefix'),get_option('sysconfdir')) mp_confdir = join_paths(gtk_sysconfdir, 'gtk-4.0')
mp_confdir = join_paths(sysconfdir, 'gtk-4.0')
mp_cargs = [ mp_cargs = [
'-DMULTIPRESS_LOCALEDIR=""', # FIXME: where is $(mplocaledir) ever set? '-DMULTIPRESS_LOCALEDIR=""', # FIXME: where is $(mplocaledir) ever set?
'-DMULTIPRESS_CONFDIR="@0@"'.format(mp_confdir), '-DMULTIPRESS_CONFDIR="@0@"'.format(mp_confdir),
'-DGDK_DISABLE_DEPRECATION_WARNINGS', '-DGDK_DISABLE_DEPRECATION_WARNINGS',
] ]
install_data('im-multipress.conf', install_dir : mp_confdir) install_data('im-multipress.conf', install_dir : mp_confdir)
method_defs = [ method_defs = [
@ -81,7 +81,7 @@ method_defs = [
inc_im_method_defs = [] inc_im_method_defs = []
dyn_im_method_defs = [] dyn_im_method_defs = []
foreach m : method_defs foreach m: method_defs
im = m.get(0) im = m.get(0)
srcs = m.get(1) srcs = m.get(1)
cargs = m.get(3, []) cargs = m.get(3, [])
@ -90,7 +90,7 @@ foreach m : method_defs
# only use backend-specific input methods for backends that are enabled # only use backend-specific input methods for backends that are enabled
if all_immodules.contains(im) if all_immodules.contains(im)
# check for extra libs lazily # check for extra libs lazily
foreach libname : m.get(2, []) foreach libname: m.get(2, [])
libs += [cc.find_library(libname)] libs += [cc.find_library(libname)]
endforeach endforeach

View File

@ -141,13 +141,13 @@ endif
# and find .ui files and .png files and such that they load at runtime # and find .ui files and .png files and such that they load at runtime
test_args = ['-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir())] test_args = ['-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir())]
foreach t : gtk_tests foreach t: gtk_tests
test_name = t.get(0) test_name = t.get(0)
test_srcs = ['@0@.c'.format(test_name), t.get(1, [])] test_srcs = ['@0@.c'.format(test_name), t.get(1, [])]
executable(test_name, test_srcs, executable(test_name, test_srcs,
include_directories : [confinc, gdkinc], include_directories: [confinc, gdkinc],
c_args : test_args, c_args: test_args,
dependencies : [libgtk_dep, libm]) dependencies: [libgtk_dep, libm])
endforeach endforeach
subdir('visuals') subdir('visuals')