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,18 +69,18 @@ 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',
@ -108,10 +108,9 @@ executable('gtk4-demo-application',
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)
@ -119,24 +118,9 @@ foreach icon_size : ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256']
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

@ -10,12 +10,10 @@ iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
source_dir: '.')
executable('gtk4-icon-browser',
iconbrowser_sources,
iconbrowser_resources,
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

@ -5,34 +5,22 @@ widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
source_dir: '.')
executable('gtk4-widget-factory',
'widget-factory.c',
widgetfactory_resources,
'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_data('data/@0@/gtk4-widget-factory-symbolic.symbolic.png'.format(icon_size),
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

@ -13,9 +13,11 @@ 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',
c_args: [
'-DGDK_DISABLE_DEPRECATED',
'-DGTK_DISABLE_DEPRECATED',
'-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir())],
'-DGTK_SRCDIR="@0@"'.format(meson.current_source_dir()),
],
dependencies: libgtk_dep)
endforeach

View File

@ -69,6 +69,10 @@ 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])
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

@ -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')
@ -673,16 +673,17 @@ gen_gtk_gresources_xml = find_program('gen-gtk-gresources-xml.py')
# 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])
command: [
gen_gtk_gresources_xml,
meson.current_source_dir(),
outfile
])
gtkresources = gnome.compile_resources(
'gtkresources',
gtkresources = gnome.compile_resources('gtkresources',
gtk_gresources_xml,
source_dir: meson.current_source_dir(),
c_name: '_gtk',
extra_args: '--manual-register'
)
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,10 +711,6 @@ 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.',
@ -726,7 +727,7 @@ 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_dir: join_paths(gtk_includedir, 'gtk-4.0/gtk'),
install_header: true)
gtktypebuiltins_h = gtktypebuiltins[1]
@ -742,10 +743,18 @@ gtkprivatetypebuiltins_h = gtkprivatetypebuiltins[1]
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,
)
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',
gtkversion = configure_file(input: 'gtkversion.h.in',
output: 'gtkversion.h',
configuration: gtkversion_cdata,
install_dir: 'include/gtk-4.0/gtk'
)
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,25 +839,27 @@ 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' ]
'_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
@ -876,7 +891,6 @@ foreach m : dyn_im_method_defs # populated in modules/input/meson.build
endforeach
# Library
libgtk = shared_library('gtk-4',
soversion: gtk_soversion,
sources: [typefuncs, gtk_sources, gtkmarshal_h, gtkprivatetypebuiltins_h],
@ -887,8 +901,7 @@ libgtk = shared_library('gtk-4',
link_args: common_ldflags,
install: true)
libgtk_dep = declare_dependency(
sources: [gtkversion, gtktypebuiltins_h],
libgtk_dep = declare_dependency(sources: [gtkversion, gtktypebuiltins_h],
include_directories: [confinc, gtkinc],
dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
link_with: libgtk,
@ -914,8 +927,25 @@ if false
])
gdk_gir_dep = declare_dependency(link_with: libgtk, sources: gdk_gir)
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 = gnome.generate_gir(libgtk,
sources: gsk_public_headers + gsk_public_sources + [ gskenum_h ],
sources: gsk_public_headers + gsk_gen_headers + gsk_public_sources,
namespace: 'Gsk',
nsversion: gtk_api_version,
identifier_prefix: 'Gsk',
@ -929,7 +959,9 @@ if false
'-DGSK_COMPILATION',
])
gsk_gir_dep = declare_dependency(link_with: libgtk, dependencies: gdk_gir_dep, sources: gsk_gir)
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']],
@ -977,12 +1008,11 @@ foreach tool : gtk_tools
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)

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
@ -411,8 +414,11 @@ if x11_enabled
# 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
@ -424,8 +430,6 @@ if x11_enabled
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 = []
@ -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,28 +522,22 @@ 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,
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,
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,
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'] : []
@ -560,7 +556,7 @@ pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
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

View File

@ -49,15 +49,15 @@ foreach im : included_immodules
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 = [