From 4b7017ef357686e8d1d7d6525174b18979a8bd16 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 14 Feb 2018 13:35:38 +0000 Subject: [PATCH 1/6] build: Rename 'disable-modules' option We should not have 'disable' in the name, to conform with the Meson best practices for boolean options. --- meson_options.txt | 4 ++-- modules/input/meson.build | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index 5d98ba5242..42283abdd2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -24,8 +24,8 @@ option('enable-cloudproviders', type: 'boolean', value: false, description : 'Enable the cloudproviders support') option('enable-xinerama', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', description : 'Enable support for the Xinerama extension') -option('disable-modules', type: 'boolean', value : 'false', - description : 'Disable dynamic module loading') +option('dynamic-modules', type: 'boolean', value : true, + description : 'Allow dynamic module loading') option('with-included-immodules', type: 'string', value : '', description : 'Build the specified input methods into gtk (comma-separated list or "all" or "none")') option('documentation', type: 'boolean', value: 'false', diff --git a/modules/input/meson.build b/modules/input/meson.build index 0111790c73..72171582db 100644 --- a/modules/input/meson.build +++ b/modules/input/meson.build @@ -6,8 +6,8 @@ # there is a bit of an ordering problem which we solve by collecting all the # information here but moving the actual build definitions to gtk/meson.build. build_dynamic_modules = false -disable_modules = get_option('disable-modules') -if not disable_modules +dynamic_modules = get_option('dynamic-modules') +if dynamic_modules gmodule_supported = dependency('gmodule-no-export-2.0').get_pkgconfig_variable('gmodule_supported') if gmodule_supported == 'true' build_dynamic_modules = true From d1a8ed02141d7dfbf17f6ec3286d867a8fbd0c2b Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 14 Feb 2018 13:43:19 +0000 Subject: [PATCH 2/6] build: Rename 'with-included-immodules' option We can call it 'included-immodules', and simplify its logic by always attempting to split the value, to avoid turning an array into a string and then back into an array again. --- meson_options.txt | 4 ++-- modules/input/meson.build | 20 ++++++-------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index 42283abdd2..2f9dd80285 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -26,8 +26,8 @@ option('enable-xinerama', type: 'combo', choices : ['yes', 'no', 'auto'], value description : 'Enable support for the Xinerama extension') option('dynamic-modules', type: 'boolean', value : true, description : 'Allow dynamic module loading') -option('with-included-immodules', type: 'string', value : '', - description : 'Build the specified input methods into gtk (comma-separated list or "all" or "none")') +option('included-immodules', type: 'string', value : 'none', + description : 'Build the specified input methods (comma-separated list, "all", or "none")') option('documentation', type: 'boolean', value: 'false', description : 'Build API reference and tools documentation') option('man-pages', type: 'boolean', value: 'false', diff --git a/modules/input/meson.build b/modules/input/meson.build index 72171582db..e60dbcc59e 100644 --- a/modules/input/meson.build +++ b/modules/input/meson.build @@ -32,20 +32,14 @@ all_immodules = [ all_immodules += backend_immodules # Allow building some or all immodules included -included_immodules = get_option('with-included-immodules') -if included_immodules == 'none' - included_immodules = '' -elif included_immodules == 'all' or included_immodules == 'yes' - included_immodules = ','.join(all_immodules) +included_immodules = get_option('included-immodules').split(',') +if included_immodules.contains('none') + included_immodules = [] +elif included_immodules.contains('all') + included_immodules = all_immodules endif -if included_immodules == '' - have_included_immodules = false - included_immodules = [] -else - have_included_immodules = true - included_immodules = included_immodules.split(',') -endif +have_included_immodules = included_immodules.length() > 0 foreach im: included_immodules if not all_immodules.contains(im) @@ -107,5 +101,3 @@ foreach m: method_defs endif endif endforeach - -# TODO: post-install gtk4-query-immodules run to create immodules.c From 2e7fef7d180530d210df0ade91ddb9ccedef6abd Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 14 Feb 2018 13:45:48 +0000 Subject: [PATCH 3/6] build: Rename the 'enable-colord' option Drop the 'enable-' prefix, to follow the naming best practices for Meson configuration options. --- meson_options.txt | 2 +- modules/printbackends/cups/meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index 2f9dd80285..dd0046dd10 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,4 @@ -option('enable-colord', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', +option('colord', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', description : 'Build colord support code') option('enable-x11-backend', type: 'boolean', value: 'true', description : 'Enable the X11 gdk backend') diff --git a/modules/printbackends/cups/meson.build b/modules/printbackends/cups/meson.build index a6f83d51e7..ef7a30ee9a 100644 --- a/modules/printbackends/cups/meson.build +++ b/modules/printbackends/cups/meson.build @@ -1,4 +1,4 @@ -enable_colord = get_option('enable-colord') +enable_colord = get_option('colord') if enable_colord != 'no' want_colord = enable_colord == 'yes' colord_dep = dependency('colord', version: '>= 0.1.9', required: want_colord) From 1440db1570f9ca616d6eeb7fe3b3cf7df8d5f37f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 14 Feb 2018 13:55:32 +0000 Subject: [PATCH 4/6] build: Coalesce print backends options into one Instead of having separate options for each print backend, we can use the same approach as the input method modules: a single option, with a comma-separated list of print backends. --- meson.build | 1 + meson_options.txt | 29 +++++++++++++++++------------ modules/printbackends/meson.build | 25 +++++++++++++++++++++---- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/meson.build b/meson.build index 32948844e2..f3e0fa2f76 100644 --- a/meson.build +++ b/meson.build @@ -704,6 +704,7 @@ summary = [ '', ' Enabled backends: @0@'.format(pkg_targets.strip()), ' Vulkan support: @0@'.format(have_vulkan), + ' Print backends: @0@'.format(' '.join(print_backends)), ' Tests: @0@'.format(get_option('build-tests')), ' Documentation: @0@'.format(get_option('documentation')), ' Demos: @0@'.format(get_option('demos')), diff --git a/meson_options.txt b/meson_options.txt index dd0046dd10..5ac89073ac 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,4 @@ -option('colord', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', - description : 'Build colord support code') +# GDK backends option('enable-x11-backend', type: 'boolean', value: 'true', description : 'Enable the X11 gdk backend') option('enable-wayland-backend', type: 'boolean', value: 'true', @@ -10,30 +9,36 @@ option('enable-win32-backend', type: 'boolean', value: 'false', description : 'Enable the Windows gdk backend') option('enable-quartz-backend', type: 'boolean', value: 'false', description : 'Enable the macOS gdk backend') + +# Optional dependencies option('enable-vulkan', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', description : 'Enable support for the Vulkan graphics API') -option('enable-test-print-backend', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'no', - description : 'Enable the test print backend') -option('enable-cups-print-backend', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', - description : 'Enable the CUPS print backend') -option('enable-papi-print-backend', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', - description : 'Enable the papi print backend') -option('enable-cloudprint-print-backend', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', - description : 'Enable the cloudprint print backend') -option('enable-cloudproviders', type: 'boolean', value: false, - description : 'Enable the cloudproviders support') option('enable-xinerama', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', description : 'Enable support for the Xinerama extension') +option('enable-cloudproviders', type: 'boolean', value: false, + description : 'Enable the cloudproviders support') + +# Print backends +option('print-backends', type : 'string', value : 'cups,papi', + description : 'Build the specified print backends (comma-separated list, "all", or "none")') +option('colord', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', + description : 'Build colord support for the CUPS printing backend') + +# Modules option('dynamic-modules', type: 'boolean', value : true, description : 'Allow dynamic module loading') option('included-immodules', type: 'string', value : 'none', description : 'Build the specified input methods (comma-separated list, "all", or "none")') + +# Documentation and introspection option('documentation', type: 'boolean', value: 'false', description : 'Build API reference and tools documentation') option('man-pages', type: 'boolean', value: 'false', description : 'Build man pages for installed tools') option('introspection', type: 'boolean', value: 'true', description : 'Build introspection data (requires gobject-introspection)') + +# Demos and binaries option('demos', type: 'boolean', value: 'true', description : 'Build demos and example programs') option('build-tests', type: 'boolean', value: 'true', diff --git a/modules/printbackends/meson.build b/modules/printbackends/meson.build index a348fda185..fa6ef4567d 100644 --- a/modules/printbackends/meson.build +++ b/modules/printbackends/meson.build @@ -1,7 +1,23 @@ +all_print_backends = [ + 'cups', + 'papi', + 'cloudprint', + 'test', +] + +enabled_print_backends = get_option('print-backends').split(',') + +if enabled_print_backends.contains('none') + enabled_print_backends = [] +elif enabled_print_backends.contains('all') + enabled_print_backends = all_print_backends +endif + +# The 'file' print backend cannot be disabled print_backends = ['file'] # Checks to see if we should compile with CUPS backend for GTK+ -enable_cups = get_option('enable-cups-print-backend') +enable_cups = enabled_print_backends.contains('cups') if enable_cups != 'no' want_cups = enable_cups == 'yes' #cups_config = find_program('cups-config', required : want_cups) @@ -37,7 +53,7 @@ if enable_cups != 'no' endif # Checks to see if we should compile with PAPI backend for GTK+ -enable_papi = get_option('enable-papi-print-backend') +enable_papi = enabled_print_backends.contains('papi') if enable_papi != 'no' want_papi = enable_papi == 'yes' libpapi = cc.find_library('libpapi', required : false) @@ -49,7 +65,7 @@ if enable_papi != 'no' endif # Checks to see if we should compile with cloudprint backend for GTK+ -enable_cloudprint = get_option('enable-cloudprint-print-backend') +enable_cloudprint = enabled_print_backends.contains('cloudprint') if enable_cloudprint != 'no' want_cloudprint = enable_cloudprint == 'yes' rest_dep = dependency('rest-0.7', required : want_cloudprint) @@ -72,10 +88,11 @@ if os_unix endif endif -if get_option('enable-test-print-backend') == 'yes' +if enabled_print_backends.contains('test') print_backends += ['test'] endif +# Automatic fall-back to the lpr backend if not print_backends.contains('papi') and not print_backends.contains('cups') print_backends += ['lpr'] endif From 7b32900c55745bb29b391ce334d86b502f34879d Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 14 Feb 2018 14:04:04 +0000 Subject: [PATCH 5/6] build: Rename GDK backend options Drop the 'enable-' prefix, and always enable all platform-specific backends. We can disable them depending on the platform. This way, the documentation printed by `meson configure` remains accurate. --- meson.build | 25 ++++++++++++++++--------- meson_options.txt | 18 +++++++++--------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/meson.build b/meson.build index f3e0fa2f76..037b78f8fa 100644 --- a/meson.build +++ b/meson.build @@ -87,27 +87,34 @@ gtk_soversion = '0.@0@.@1@'.format(gtk_binary_age - gtk_interface_age, gtk_inter gtk_api_version = '4.0' -x11_enabled = get_option('enable-x11-backend') -wayland_enabled = get_option('enable-wayland-backend') -broadway_enabled = get_option('enable-broadway-backend') -quartz_enabled = get_option('enable-quartz-backend') -win32_enabled = get_option('enable-win32-backend') -cloudproviders_enabled = get_option('enable-cloudproviders') +x11_enabled = get_option('x11-backend') +wayland_enabled = get_option('wayland-backend') +broadway_enabled = get_option('broadway-backend') +quartz_enabled = get_option('quartz-backend') +win32_enabled = get_option('win32-backend') os_unix = false os_linux = false os_win32 = false os_darwin = false -if host_machine.system().contains('darwin') +# Some windowing system backends depend on the platform we're +# building for, so we need to ensure they are disabled; in other +# cases, they are the only windowing system available, so we need +# to ensure they are enabled +if host_machine.system() == 'darwin' os_darwin = true + win32_enabled = false elif host_machine.system() == 'windows' os_win32 = true win32_enabled = true x11_enabled = false wayland_enabled = false -elif host_machine.system().contains('linux') + quartz_enabled = false +elif host_machine.system() == 'linux' os_linux = true + win32_enabled = false + quartz_enabled = false endif os_unix = not os_win32 @@ -578,7 +585,7 @@ else endif endif - +cloudproviders_enabled = get_option('enable-cloudproviders') if cloudproviders_enabled cloudproviders_dep = dependency('cloudproviders', required: true) if cloudproviders_dep.found() diff --git a/meson_options.txt b/meson_options.txt index 5ac89073ac..07de49a45a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,14 +1,14 @@ # GDK backends -option('enable-x11-backend', type: 'boolean', value: 'true', - description : 'Enable the X11 gdk backend') -option('enable-wayland-backend', type: 'boolean', value: 'true', - description : 'Enable the wayland gdk backend') -option('enable-broadway-backend', type: 'boolean', value: 'false', +option('x11-backend', type: 'boolean', value: true, + description : 'Enable the X11 gdk backend (only when building on Linux or macOS)') +option('wayland-backend', type: 'boolean', value: true, + description : 'Enable the wayland gdk backend (only when building on Linux)') +option('broadway-backend', type: 'boolean', value: false, description : 'Enable the broadway (HTML5) gdk backend') -option('enable-win32-backend', type: 'boolean', value: 'false', - description : 'Enable the Windows gdk backend') -option('enable-quartz-backend', type: 'boolean', value: 'false', - description : 'Enable the macOS gdk backend') +option('win32-backend', type: 'boolean', value: true, + description : 'Enable the Windows gdk backend (only when building on Windows)') +option('quartz-backend', type: 'boolean', value: true, + description : 'Enable the macOS gdk backend (only when building on macOS)') # Optional dependencies option('enable-vulkan', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', From 327e7a4ccc8585b98a58a6526cb84448df2d0f53 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 14 Feb 2018 14:07:22 +0000 Subject: [PATCH 6/6] build: Rename last 'enable' options Drop the 'enable-' prefix to conform to the best practices for naming configuration options in Meson. --- meson.build | 6 +++--- meson_options.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 037b78f8fa..24ada585fa 100644 --- a/meson.build +++ b/meson.build @@ -507,7 +507,7 @@ if x11_enabled endif endif - enable_xinerama = get_option('enable-xinerama') + enable_xinerama = get_option('xinerama') if enable_xinerama != 'no' want_xinerama = enable_xinerama == 'yes' xinerama_dep = dependency('xinerama', required: want_xinerama) @@ -560,7 +560,7 @@ have_vulkan = false vulkan_pkg_found = false vulkan_dep = [] -enable_vulkan = get_option('enable-vulkan') +enable_vulkan = get_option('vulkan') if enable_vulkan == 'no' message('Vulkan support explicitly disabled') else @@ -585,7 +585,7 @@ else endif endif -cloudproviders_enabled = get_option('enable-cloudproviders') +cloudproviders_enabled = get_option('cloudproviders') if cloudproviders_enabled cloudproviders_dep = dependency('cloudproviders', required: true) if cloudproviders_dep.found() diff --git a/meson_options.txt b/meson_options.txt index 07de49a45a..896347e10b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -11,11 +11,11 @@ option('quartz-backend', type: 'boolean', value: true, description : 'Enable the macOS gdk backend (only when building on macOS)') # Optional dependencies -option('enable-vulkan', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', +option('vulkan', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', description : 'Enable support for the Vulkan graphics API') -option('enable-xinerama', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', +option('xinerama', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto', description : 'Enable support for the Xinerama extension') -option('enable-cloudproviders', type: 'boolean', value: false, +option('cloudproviders', type: 'boolean', value: false, description : 'Enable the cloudproviders support') # Print backends