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',
])
gtkdemo_deps = [libgtk_dep]
gtkdemo_deps = [ libgtk_dep, ]
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files('font_features.c')
gtkdemo_deps += harfbuzz_dep
gtkdemo_deps += [ harfbuzz_dep, ]
endif
if os_unix
demos += files('pagesetup.c')
endif
gtkdemo_args = ['-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED']
gtkdemo_args = [ '-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED', ]
demos_h = custom_target('gtk4 demo header',
output : 'demos.h',
input : demos,
command : [find_program('geninclude.py'), '@OUTPUT@', '@INPUT@'])
output: 'demos.h',
input: demos,
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ])
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.')
'demo.gresource.xml',
source_dir: '.')
executable('gtk4-demo',
'main.c', 'gtkfishbowl.c', demos, demos_h, gtkdemo_resources,
c_args : gtkdemo_args,
dependencies : gtkdemo_deps,
include_directories : confinc,
gui_app : true,
install : true)
'main.c', 'gtkfishbowl.c', demos, demos_h, gtkdemo_resources,
c_args: gtkdemo_args,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
install: true)
executable('gtk4-demo-application',
'application.c', gtkdemo_resources,
c_args : gtkdemo_args,
dependencies : gtkdemo_deps,
include_directories : confinc,
gui_app : true,
install : true)
'application.c', gtkdemo_resources,
c_args: gtkdemo_args,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
install: true)
# 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))
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_dir : gtk_demo_icons_dir)
install_dir: gtk_demo_icons_dir)
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
install_data('gtk4-demo.desktop',
install_dir : join_paths(get_option('datadir'), 'applications'))
install_data('gtk4-demo.desktop', install_dir: gtk_applicationsdir)
# GSettings
install_data('org.gtk.Demo.gschema.xml',
install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas/'))
install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
gnome.compile_schemas()

View File

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

View File

@ -1,38 +1,26 @@
# demos/widget-factory
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml',
source_dir: '.')
'widget-factory.gresource.xml',
source_dir: '.')
executable('gtk4-widget-factory',
'widget-factory.c',
widgetfactory_resources,
dependencies: libgtk_dep,
include_directories : confinc,
gui_app: true,
install: true)
'widget-factory.c', widgetfactory_resources,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
install: true)
# desktop file
install_data('gtk4-widget-factory.desktop',
install_dir : join_paths(get_option('datadir'), 'applications'))
install_data('gtk4-widget-factory.desktop', install_dir: gtk_applicationsdir)
# 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))
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_dir : icons_dir)
install_dir: icons_dir)
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',
'bloatpad.gresources.xml',
source_dir: '.')
'bloatpad.gresources.xml',
source_dir: '.')
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
example_name = ex == 'builder' ? 'builder_example' : ex
executable(example_name, '@0@.c'.format(ex),
c_args : ['-DGDK_DISABLE_DEPRECATED',
'-DGTK_DISABLE_DEPRECATED',
'-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir())],
dependencies: libgtk_dep)
c_args: [
'-DGDK_DISABLE_DEPRECATED',
'-DGTK_DISABLE_DEPRECATED',
'-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir()),
],
dependencies: libgtk_dep)
endforeach
subdir('bp')

View File

@ -68,7 +68,11 @@ gdk_x11_deps = [
]
libgdk_x11 = static_library('gdk-x11',
gdk_x11_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc],
c_args: ['-DGDK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"'],
dependencies: [gdk_deps, gdk_x11_deps])
gdk_x11_sources, gdkconfig, gdkenum_h,
include_directories: [ confinc, gdkinc, ],
c_args: [
'-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.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([
'gtkcustompaperunixdialog.c',
@ -664,7 +664,7 @@ if quartz_enabled
endif
if not (x11_enabled or win32_enabled or quartz_enabled)
gtk_sources += ['gtkmountoperation-stub.c']
gtk_sources += ['gtkmountoperation-stub.c', ]
endif
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.
# Hopefully all to be fixed in Meson 0.39
outfile = '@0@/gtk.gresources.xml'.format(meson.current_build_dir())
gtk_gresources_xml = configure_file(output : 'gtk.gresources.xml',
input : 'gtk/ui/gtkdialog.ui', # FIXME: shouldn't be needed
command : [gen_gtk_gresources_xml, meson.current_source_dir(), outfile])
gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml',
command: [
gen_gtk_gresources_xml,
meson.current_source_dir(),
outfile
])
gtkresources = gnome.compile_resources(
'gtkresources',
gtk_gresources_xml,
source_dir: meson.current_source_dir(),
c_name: '_gtk',
extra_args: '--manual-register'
)
gtkresources = gnome.compile_resources('gtkresources',
gtk_gresources_xml,
source_dir: meson.current_source_dir(),
c_name: '_gtk',
extra_args: '--manual-register')
gtk_x11_sources = files([
'gtkapplication-x11.c',
@ -693,6 +694,10 @@ gtk_wayland_sources = files([
'gtkapplication-wayland.c'
])
gtk_use_wayland_or_x11_c_sources = files([
'gtkapplication-dbus.c'
])
if quartz_enabled
dnd_sources = files([
'gtkclipboard-quartz.c',
@ -706,46 +711,50 @@ else
])
endif
gtk_use_wayland_or_x11_c_sources = files([
'gtkapplication-dbus.c'
])
gtk_dbus_src = gnome.gdbus_codegen('gtkdbusgenerated',
'gtkdbusinterfaces.xml',
interface_prefix: 'org.Gtk.',
namespace: '_Gtk')
'gtkdbusinterfaces.xml',
interface_prefix: 'org.Gtk.',
namespace: '_Gtk')
gtkmarshalers = gnome.genmarshal('gtkmarshalers',
sources : 'gtkmarshalers.list',
prefix : '_gtk_marshal',
valist_marshallers : true)
sources: 'gtkmarshalers.list',
prefix: '_gtk_marshal',
valist_marshallers: true)
gtkmarshal_h = gtkmarshalers[1]
gtktypebuiltins = gnome.mkenums('gtktypebuiltins',
sources: gtk_public_headers + gtk_deprecated_headers + a11y_headers,
c_template : 'gtktypebuiltins.c.template',
h_template : 'gtktypebuiltins.h.template',
install_dir : 'include/gtk-4.0/gtk',
install_header : true)
sources: gtk_public_headers + gtk_deprecated_headers + a11y_headers,
c_template: 'gtktypebuiltins.c.template',
h_template: 'gtktypebuiltins.h.template',
install_dir: join_paths(gtk_includedir, 'gtk-4.0/gtk'),
install_header: true)
gtktypebuiltins_h = gtktypebuiltins[1]
gtkprivatetypebuiltins = gnome.mkenums('gtkprivatetypebuiltins',
sources: gtk_private_type_headers,
c_template : 'gtkprivatetypebuiltins.c.template',
h_template : 'gtkprivatetypebuiltins.h.template')
sources: gtk_private_type_headers,
c_template: 'gtkprivatetypebuiltins.c.template',
h_template: 'gtkprivatetypebuiltins.h.template')
gtkprivatetypebuiltins_h = gtkprivatetypebuiltins[1]
# Generate gtktypefuncs.inc
typefuncs = custom_target('gtktypefuncs.inc',
depends: gdkenum_h,
output : 'gtktypefuncs.inc',
input : gdk_headers + gtk_public_headers + gtk_deprecated_headers + gtk_private_headers + [gtktypebuiltins_h] + [gdkenum_h],
command: [find_program('gentypefuncs.py'), '@OUTPUT@', '@INPUT@'],
install: false,
)
depends: gdkenum_h,
output: 'gtktypefuncs.inc',
input: gdk_headers +
gtk_public_headers +
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.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_INTERFACE_AGE', gtk_interface_age)
gtkversion = configure_file(
input : 'gtkversion.h.in',
output : 'gtkversion.h',
configuration: gtkversion_cdata,
install_dir: 'include/gtk-4.0/gtk'
)
gtkversion = configure_file(input: 'gtkversion.h.in',
output: 'gtkversion.h',
configuration: gtkversion_cdata,
install_dir: join_paths(gtk_includedir, 'gtk-4.0/gtk'))
gtk_cargs = [
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gtk"',
'-DG_LOG_USE_STRUCTURED=1',
'-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED',
'-DGTK_BINARY_VERSION="@0@"'.format(gtk_binary_version),
'-DGTK_HOST="@0@"'.format(host_machine.system()),
'-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_dbus_src,
@ -826,73 +839,73 @@ if x11_enabled or wayland_enabled
gtk_deps += pangoft_dep
endif
# org.gtk.Settings.FileChooser.gschema.xml
# org.gtk.Settings.ColorChooser.gschema.xml
# org.gtk.Settings.Debug.gschema.xml
gtk_settings_schemas = [
'org.gtk.Settings.FileChooser.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()
# Check for more things
if cc.has_header('langinfo.h')
foreach nl_enum : [ '_NL_MEASUREMENT_MEASUREMENT',
'_NL_PAPER_HEIGHT',
'_NL_PAPER_WIDTH',
'_NL_TIME_FIRST_WEEKDAY' ]
foreach nl_enum: [ '_NL_MEASUREMENT_MEASUREMENT',
'_NL_PAPER_HEIGHT',
'_NL_PAPER_WIDTH',
'_NL_TIME_FIRST_WEEKDAY', ]
cdata.set('HAVE_' + nl_enum, cc.has_header_symbol('langinfo.h', nl_enum))
endforeach
endif
# 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 = []
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_srcs = m[1]
im_args = m[2]
im_libs = m[3]
included_input_modules += static_library('im-@0@'.format(im_name),
im_srcs, gen_headers,
c_args : im_args,
include_directories : [confinc, gdkinc, gtkinc],
dependencies : gtk_deps + im_libs)
im_srcs, gen_headers,
c_args: im_args,
include_directories: [confinc, gdkinc, gtkinc],
dependencies: gtk_deps + im_libs)
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_srcs = m[1]
im_args = m[2]
im_libs = m[3]
shared_module('im-@0@'.format(im_name), im_srcs, gen_headers,
c_args : im_args,
include_directories : [confinc, gdkinc, gtkinc],
dependencies : gtk_deps + im_libs,
name_prefix : '', # we want im-foo.so not libim-foo.so
install_dir : immodules_install_dir,
install : true)
c_args: im_args,
include_directories: [confinc, gdkinc, gtkinc],
dependencies: gtk_deps + im_libs,
name_prefix: '', # we want im-foo.so not libim-foo.so
install_dir: immodules_install_dir,
install: true)
endforeach
# Library
libgtk = shared_library('gtk-4',
soversion: gtk_soversion,
sources: [typefuncs, gtk_sources, gtkmarshal_h, gtkprivatetypebuiltins_h],
c_args: gtk_cargs + common_cflags,
include_directories: [confinc, gdkinc, gskinc, gtkinc],
dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
link_with: [libgdk, libgsk, included_input_modules],
link_args: common_ldflags,
install: true)
soversion: gtk_soversion,
sources: [typefuncs, gtk_sources, gtkmarshal_h, gtkprivatetypebuiltins_h],
c_args: gtk_cargs + common_cflags,
include_directories: [confinc, gdkinc, gskinc, gtkinc],
dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
link_with: [libgdk, libgsk, included_input_modules],
link_args: common_ldflags,
install: true)
libgtk_dep = declare_dependency(
sources: [gtkversion, gtktypebuiltins_h],
include_directories: [confinc, gtkinc],
dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
link_with: libgtk,
link_args: common_ldflags)
libgtk_dep = declare_dependency(sources: [gtkversion, gtktypebuiltins_h],
include_directories: [confinc, gtkinc],
dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
link_with: libgtk,
link_args: common_ldflags)
# Introspection
if false
@ -901,35 +914,54 @@ if false
]
gdk_gir = gnome.generate_gir(libgtk,
sources: gdk_public_headers + gdk_public_sources + [ gdkenum_h ],
namespace: 'Gdk',
nsversion: gtk_api_version,
identifier_prefix: 'Gdk',
symbol_prefix: 'gdk',
export_packages: 'gtk+-4.0',
includes: [ 'Gio-2.0', 'GdkPixbuf-2.0', 'Pango-1.0', 'cairo-1.0', ],
install: true,
extra_args: gir_args + [
'-DGDK_COMPILATION',
])
sources: gdk_public_headers + gdk_public_sources + [ gdkenum_h ],
namespace: 'Gdk',
nsversion: gtk_api_version,
identifier_prefix: 'Gdk',
symbol_prefix: 'gdk',
export_packages: 'gtk+-4.0',
includes: [ 'Gio-2.0', 'GdkPixbuf-2.0', 'Pango-1.0', 'cairo-1.0', ],
install: true,
extra_args: gir_args + [
'-DGDK_COMPILATION',
])
gdk_gir_dep = declare_dependency(link_with: libgtk, sources: gdk_gir)
gsk_gir = gnome.generate_gir(libgtk,
sources: gsk_public_headers + gsk_public_sources + [ gskenum_h ],
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',
])
if x11_enabled
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-4.0',
includes: [ 'Gio-2.0', 'GdkPixbuf-2.0', 'Pango-1.0', 'xlib-2.0', ],
install: true,
dependencies: gdk_gir_dep,
extra_args: [
'--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,
sources: gtk_public_headers + gtk_public_sources + dnd_sources + a11y_headers + a11y_sources + [
@ -953,7 +985,6 @@ if false
endif
# Installed tools
gtk_tools = [
['gtk4-query-settings', ['gtk-query-settings.c']],
['gtk4-builder-tool', ['gtk-builder-tool.c']],
@ -963,32 +994,31 @@ gtk_tools = [
['gtk4-query-immodules', ['queryimmodules.c', 'gtkutils.c']],
]
foreach tool : gtk_tools
foreach tool: gtk_tools
tool_name = tool.get(0)
tool_srcs = tool.get(1)
exe = executable(tool_name, tool_srcs,
include_directories: [confinc],
c_args: gtk_cargs,
dependencies: libgtk_dep,
install: true)
include_directories: [confinc],
c_args: gtk_cargs,
dependencies: libgtk_dep,
install: true)
set_variable(tool_name.underscorify(), exe) # used in testsuites
endforeach
# Data to install
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_dir : join_paths(get_option('datadir'),'gettext/its'))
install_dir: join_paths(gtk_datadir, 'gettext/its'))
if quartz_enabled
# 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?
configure_file(input : 'gtk-keys.css.mac',
output : 'gtk-keys.css',
configuration : configuration_data(),
install_dir : join_paths(get_option('datadir'),'themes/Mac/gtk-4.0'))
configure_file(input: 'gtk-keys.css.mac',
output: 'gtk-keys.css',
configuration: configuration_data(),
install_dir: join_paths(get_option('datadir'), 'themes/Mac/gtk-4.0'))
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_micro_version = gtk_version.split('.')[2].to_int()
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')
@ -77,8 +77,8 @@ x11_enabled = get_option('enable-x11-backend')
wayland_enabled = get_option('enable-wayland-backend')
broadway_enabled = get_option('enable-broadway-backend')
mir_enabled = get_option('enable-mir-backend')
quartz_enabled = false # FIXME
win32_enabled = false # FIXME
quartz_enabled = get_option('enable-quartz-backend')
win32_enabled = get_option('enable-win32-backend')
os_unix = false
os_linux = false
@ -324,13 +324,16 @@ backend_immodules = []
pc_gdk_extra_libs = []
cairo_backends = []
foreach backend : [['cairo-xlib', x11_enabled],
['cairo-win32', win32_enabled],
['cairo-quartz', quartz_enabled],
['cairo', broadway_enabled or wayland_enabled or mir_enabled]]
if backend[1]
dependency(backend[0], version: cairo_req)
cairo_backends += [backend[0]]
foreach backend: [ ['cairo-xlib', cairo_req, x11_enabled],
['cairo-win32', cairo_req, win32_enabled],
['cairo-quartz', cairo_req, quartz_enabled],
['cairo', cairo_req, broadway_enabled or wayland_enabled or mir_enabled], ]
backend_enabled = backend.get(2)
cairo_backend_req = backend.get(1)
cairo_backend = backend.get(0)
if backend_enabled
dependency(cairo_backend, version: cairo_backend_req)
cairo_backends += [ cairo_backend ]
endif
endforeach
@ -391,28 +394,31 @@ if x11_enabled
cdata.set('HAVE_XCOMPOSITE', xcomposite_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>')
cdata.set('HAVE_XKB', 1)
endif
if cc.has_function('XSyncQueryExtension', dependencies : xext_dep,
prefix : '''#include <X11/Xlib.h>
#include <X11/extensions/sync.h>''')
if cc.has_function('XSyncQueryExtension', dependencies: xext_dep,
prefix: '''#include <X11/Xlib.h>
#include <X11/extensions/sync.h>''')
cdata.set('HAVE_XSYNC', 1)
endif
if cc.has_function('XGetEventData', dependencies : x11_dep)
if cc.has_function('XGetEventData', dependencies: x11_dep)
cdata.set('HAVE_XGENERICEVENTS', 1)
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)
# Note that we also check that the XIScrollClassInfo struct is defined,
# because at least Ubuntu Oneiric seems to have XIAllowTouchEvents(),
# but not the XIScrollClassInfo struct
prefix = '#include<X11/Xlib.h>\n#include<X11/extensions/XInput2.h>'
if cc.has_function('XIAllowTouchEvents', dependencies : xi_dep) and cc.has_member('XIScrollClassInfo', 'number', prefix: prefix, dependencies : xi_dep)
has_allow_touch_evens = cc.has_function('XIAllowTouchEvents', 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)
endif
endif
@ -420,12 +426,10 @@ if x11_enabled
enable_xinerama = get_option('enable-xinerama')
if enable_xinerama != 'no'
want_xinerama = enable_xinerama == 'yes'
xinerama_dep = dependency('xinerama', required : want_xinerama)
if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies : xinerama_dep)
xinerama_dep = dependency('xinerama', required: want_xinerama)
if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
cdata.set('HAVE_XFREE_XINERAMA', 1)
x11_pkgs += ['xinerama']
elif want_xinerama
error('No function XineramaQueryExtension in xinerama dependency which was explicitly requested.')
endif
else
xinerama_dep = []
@ -437,8 +441,8 @@ endif
mir_pkgs = []
if mir_enabled
mirclient_dep = dependency('mirclient', version : mirclient_req)
mircookie_dep = dependency('mircookie', version : mircookie_req)
mirclient_dep = dependency('mirclient', version: mirclient_req)
mircookie_dep = dependency('mircookie', version: mircookie_req)
libcontent_hub_glib_dep = dependency('libcontenthub-glib')
mir_pkgs = [
@ -478,8 +482,8 @@ have_vulkan = false
vulkan_lib = []
enable_vulkan = get_option('enable-vulkan')
if enable_vulkan != 'no'
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')
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')
have_vulkan = true
pc_gdk_extra_libs += ['-lvulkan']
elif enable_vulkan == 'yes'
@ -500,13 +504,11 @@ subdir('testsuite')
subdir('examples')
# config.h
configure_file(input: 'config.h.meson',
output: 'config.h',
configuration: cdata)
# pkg-config files - bit of a mess all of this
pkgconf = configuration_data()
pkgconf.set('prefix', get_option('prefix'))
@ -520,29 +522,23 @@ pkgconf.set('host', '@0@-@1@'.format(host_machine.cpu_family(), host_machine.sys
# Requires
pango_pkgname = win32_enabled ? 'pangowin32' : 'pango'
pkgconf.set('GDK_PACKAGES', ' '.join([
pango_pkgname, pango_req,
'pangocairo', pango_req,
'gdk-pixbuf-2.0', gdk_pixbuf_req,
'cairo', cairo_req,
'cairo-gobject', cairo_req]))
pkgconf.set('GSK_PACKAGES', ' '.join([
#'gdk-pixbuf-2.0', gdk_pixbuf_req,
#'cairo', cairo_req,
#'cairo-gobject', cairo_req,
'graphene-gobject-1.0', graphene_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]))
pkgconf.set('GDK_PACKAGES',
' '.join([ pango_pkgname, pango_req,
'pangocairo', pango_req,
'gdk-pixbuf-2.0', gdk_pixbuf_req,
'cairo', cairo_req,
'cairo-gobject', cairo_req ]))
pkgconf.set('GSK_PACKAGES',
' '.join([ 'graphene-gobject-1.0', graphene_req ]))
pkgconf.set('GTK_PACKAGES',
' '.join([ 'atk', atk_req,
'gio-2.0', glib_req ]))
# Requires.private
gio_pkgname = os_unix ? 'gio-unix-2.0' : 'gio-2.0'
pkgconf.set('GDK_PRIVATE_PACKAGES', ' '.join([
gio_pkgname, glib_req,
'epoxy', epoxy_req] + x11_pkgs + wayland_pkgs + mir_pkgs + cairo_backends))
pkgconf.set('GDK_PRIVATE_PACKAGES',
' '.join([ gio_pkgname, glib_req,
'epoxy', epoxy_req ] + x11_pkgs + wayland_pkgs + mir_pkgs + cairo_backends))
pkgconf.set('GSK_PRIVATE_PACKAGES', '') # all already in GDK_PRIVATE_PACKAGES
pangoft2_pkgs = (wayland_enabled or x11_enabled) ? ['pangoft2'] : []
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')
pkgs = ['gtk+-4.0.pc']
pkgs = [ 'gtk+-4.0.pc' ]
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))
pkgs += ['gtk+-@0@-4.0.pc'.format(backend)]
pkg_targets += ' ' + backend
@ -568,18 +564,18 @@ foreach backend : ['broadway', 'mir', 'quartz', 'wayland', 'win32', 'x11']
endforeach
pkgconf.set('GDK_BACKENDS', pkg_targets.strip())
foreach pkg : pkgs
configure_file(input : 'gtk+-4.0.pc.in',
output : pkg,
configuration : pkgconf,
install_dir : pkg_install_dir)
foreach pkg: pkgs
configure_file(input: 'gtk+-4.0.pc.in',
output: pkg,
configuration: pkgconf,
install_dir: pkg_install_dir)
endforeach
if host_machine.system() != 'windows'
configure_file(input : 'gtk+-unix-print-4.0.pc.in',
output : 'gtk+-unix-print-4.0.pc',
configuration : pkgconf,
install_dir : pkg_install_dir)
configure_file(input: 'gtk+-unix-print-4.0.pc.in',
output: 'gtk+-unix-print-4.0.pc',
configuration: pkgconf,
install_dir: pkg_install_dir)
endif
subdir('po')

View File

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

View File

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