From 1440db1570f9ca616d6eeb7fe3b3cf7df8d5f37f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 14 Feb 2018 13:55:32 +0000 Subject: [PATCH] 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