From 7fff2901aa68198aeb0042836f89d2ed843d8248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 21 Aug 2016 17:16:03 +0200 Subject: [PATCH] meson: Add options for x/wayland/broadway backends --- config.h.meson | 6 +++ gdk/meson.build | 113 ++++++++++++++++++++++++---------------------- gtk/meson.build | 100 +++++++++++++++++++++------------------- meson.build | 8 ++++ meson_options.txt | 3 ++ 5 files changed, 130 insertions(+), 100 deletions(-) create mode 100644 meson_options.txt diff --git a/config.h.meson b/config.h.meson index 45527bf403..e6cd25d26a 100644 --- a/config.h.meson +++ b/config.h.meson @@ -309,3 +309,9 @@ /* Define to 1 if linux/memfd.h exists */ #mesondefine HAVE_LINUX_MEMFD_H + +#mesondefine GTK_LOCALEDIR + +#mesondefine GTK_DATADIR + +#mesondefine GTK_LIBDIR diff --git a/gdk/meson.build b/gdk/meson.build index a1fb9dfb41..248cacbe31 100644 --- a/gdk/meson.build +++ b/gdk/meson.build @@ -248,9 +248,9 @@ gdkmarshal_c = custom_target('gdkmarshal_c', cdata = configuration_data() -cdata.set('GDK_WINDOWING_X11', 1) -cdata.set('GDK_WINDOWING_WAYLAND', 1) -cdata.set('GDK_WINDOWING_BROADWAY', 1) +if x11_enabled cdata.set('GDK_WINDOWING_X11', 1) endif +if wayland_enabled cdata.set('GDK_WINDOWING_WAYLAND', 1) endif +if broadway_enabled cdata.set('GDK_WINDOWING_BROADWAY', 1) endif gdkconfig = configure_file(input : 'gdkconfig.h.meson', output : 'gdkconfig.h', configuration : cdata @@ -259,63 +259,68 @@ gdkconfig = configure_file(input : 'gdkconfig.h.meson', xinc = include_directories('x11') wlinc = include_directories('wayland') + +gdk_deps = [ + mlib, + pixbuf_dep, + cairo_dep, + pango_dep, + cairogobj_dep, + glib_dep, + epoxy_dep, + fontconfig_dep, + giounix_dep, + pangocairo_dep +] + +gdk_sources = [ + gdkconfig, + gdk_sources, + deprecated_gdk_sources, + gdkenum_c, gdkenum_h, + gdkmarshal_c, gdkmarshal_h, + gdkresources +] + +if x11_enabled + gdk_deps += [ + xrender_dep, + xi_dep, + xext_dep, + x11_dep, + ] + gdk_sources += [ + gdk_x_sources, + gdk_x_private_sources + ] +endif + +if wayland_enabled + gdk_deps += [ + shmlib, + xkbdep, + wlclientdep, + wlprotocolsdep, + wlcursordep, + wlegldep + ] + gdk_sources += [ + gdk_wayland_sources, + gdk_wayland_private_sources + ] +endif + + + libgdk_dep = declare_dependency( sources: ['gdk.h'], include_directories: [confinc, xinc, wlinc], - dependencies: [ - mlib, - shmlib, - xrender_dep, - xi_dep, - xext_dep, - x11_dep, - fontconfig_dep, - epoxy_dep, - giounix_dep, - glib_dep, - pangocairo_dep, - cairogobj_dep, - pango_dep, - cairo_dep, - pixbuf_dep, - xkbdep, - wlclientdep, - wlprotocolsdep, - wlcursordep, - wlegldep - ] + dependencies: gdk_deps, ) libgdk = shared_library('gdk', - gdkconfig, - gdk_sources, deprecated_gdk_sources, - gdkenum_c, gdkenum_h, - gdkmarshal_h, gdkmarshal_c, gdkresources, - gdk_x_sources, gdk_x_private_sources, - gdk_wayland_sources, gdk_wayland_private_sources, - gdk_broadway_sources, gdk_broadway_private_sources, + gdk_sources, c_args: ['-DHAVE_CONFIG_H', '-DGDK_COMPILATION'], include_directories: [confinc, xinc, wlinc], - dependencies: [ - mlib, - shmlib, - xrender_dep, - xi_dep, - xext_dep, - x11_dep, - fontconfig_dep, - epoxy_dep, - giounix_dep, - glib_dep, - pangocairo_dep, - cairogobj_dep, - pango_dep, - cairo_dep, - pixbuf_dep, - xkbdep, - wlclientdep, - wlprotocolsdep, - wlcursordep, - wlegldep - ] + dependencies: gdk_deps, ) diff --git a/gtk/meson.build b/gtk/meson.build index fd83a718ee..2c77bdf08b 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -411,67 +411,75 @@ gtk_dbus_src = gnome.gdbus_codegen('gtkdbusgenerated', 'gtkdbusinterfaces.xml', interface_prefix: 'org.Gtk.', namespace: '_Gtk') + +gtk_sources = [ + gtk_sources, + gtk_dbus_src, + gtk_unix_sources, + gtk_deprecated_c_sources, + dnd_sources, + inspector_sources, + a11y_sources, +] + +gtk_deps = [ + gmodule_dep, + giounix_dep, + glib_dep, + atkbridge_dep, + pangocairo_dep, + pangoft_dep, + pango_dep, + cairogobj_dep, + cairo_dep, + fontconfig_dep, + pixbuf_dep, + atk_dep, + epoxy_dep, + mlib, + libgdk_dep +] + +if x11_enabled + gtk_sources += [ + gtk_x11_sources, + gtk_use_wayland_or_x11_c_sources + ] + gtk_deps += [ + xi_dep, + x11_dep, + ] +endif + +if wayland_enabled + gtk_sources += [ + gtk_wayland_sources, + gtk_use_wayland_or_x11_c_sources + ] +endif + + libgtk_dep = declare_dependency( link_with: libgdk, sources: [ 'gtk.h' ], - dependencies: [ - gmodule_dep, - giounix_dep, - glib_dep, - atkbridge_dep, - pangocairo_dep, - pangoft_dep, - pango_dep, - cairogobj_dep, - cairo_dep, - fontconfig_dep, - pixbuf_dep, - atk_dep, - epoxy_dep, - mlib, - xi_dep, - x11_dep, - libgdk_dep - ], + dependencies: gtk_deps, include_directories: confinc ) libgtk = shared_library('gtk', - gtk_sources, gtk_dbus_src, gtk_unix_sources, - gtk_deprecated_c_sources, dnd_sources, - inspector_sources, a11y_sources, - gtk_x11_sources, gtk_wayland_sources, - gtk_use_wayland_or_x11_c_sources, + gtk_sources, c_args: [ '-DGTK_COMPILATION', '-DGTK_PRINT_BACKEND_ENABLE_UNSUPPORTED', - '-DGTK_BINARY_VERSION="3"', '-DGTK_HOST="bob"', '-DGTK_DATADIR="dir"', - '-DGTK_LIBDIR="libdir"', '-DGTK_SYSCONFDIR="sysconfdir"', - '-DGTK_LOCALEDIR="localedir"', '-DGTK_DATA_PREFIX="dataprefix"', + '-DGTK_BINARY_VERSION="3"', '-DGTK_HOST="bob"', + '-DGTK_SYSCONFDIR="sysconfdir"', + '-DGTK_DATA_PREFIX="dataprefix"', '-DGTK_PRINT_BACKENDS="null"', '-DGTK_VERSION="3"', '-DX11_DATA_PREFIX="/share/x11/locale"' ], include_directories: [ confinc, gdkinc ], - dependencies: [ - gmodule_dep, - giounix_dep, - glib_dep, - atkbridge_dep, - pangocairo_dep, - pangoft_dep, - pango_dep, - cairogobj_dep, - cairo_dep, - fontconfig_dep, - pixbuf_dep, - atk_dep, - epoxy_dep, - mlib, - xi_dep, - x11_dep, - libgdk_dep - ], + dependencies: gtk_deps, link_with: libgdk ) diff --git a/meson.build b/meson.build index 943418969e..ae9c67043c 100644 --- a/meson.build +++ b/meson.build @@ -19,9 +19,17 @@ gtk_micro_version = gtk_version[2] gtk_binary_age = 100 * gtk_minor_version.to_int() + gtk_micro_version.to_int() gtk_api_version = '@0@.0'.format(gtk_major_version) +x11_enabled = get_option('enable-x11-backend') +wayland_enabled = get_option('enable-wayland-backend') +broadway_enabled = get_option('enable-broadway-backend') + + cc = meson.get_compiler('c') cdata = configuration_data() cdata.set('PACKAGE_VERSION', '"'+meson.project_version()+'"') +cdata.set('GTK_LOCALEDIR', '"'+get_option('localedir')+'"') +cdata.set('GTK_DATADIR', '"'+get_option('datadir')+'"') +cdata.set('GTK_LIBDIR', '"'+get_option('libdir')+'"') check_headers = [ ['HAVE_CRT_EXTERNS_H', 'crt/externs.h'], ['HAVE_DLFCN_H', 'dlfcn.h'], diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000..28568a1e43 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,3 @@ +option('enable-x11-backend', type: 'boolean', value: 'true') +option('enable-wayland-backend', type: 'boolean', value: 'false') +option('enable-broadway-backend', type: 'boolean', value: 'false')