40.0-add-control-optional-deps.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. From a5f01beb41a81f483d90eb4dd785822a8615f65f Mon Sep 17 00:00:00 2001
  2. From: Gilles Dartiguelongue <eva@gentoo.org>
  3. Date: Wed, 30 May 2018 08:44:18 +0200
  4. Subject: [PATCH] build: Add control for optional dependencies
  5. ---
  6. meson.build | 18 ++++++++++++++----
  7. meson_options.txt | 3 +++
  8. src/meson.build | 12 ++++++++----
  9. 3 files changed, 25 insertions(+), 8 deletions(-)
  10. create mode 100644 meson_options.txt
  11. diff --git a/meson.build b/meson.build
  12. index 1e1522c..45d7ed7 100644
  13. --- a/meson.build
  14. +++ b/meson.build
  15. @@ -34,10 +34,20 @@ zlib_dep = dependency ('zlib')
  16. cairo_dep = dependency ('cairo')
  17. gdk_pixbuf_dep = dependency ('gdk-pixbuf-2.0')
  18. gusb_dep = dependency ('gusb', version: '>= 0.2.7')
  19. -colord_dep = dependency ('colord', required: false)
  20. -packagekit_dep = dependency ('packagekit-glib2', version: '>= 1.1.5', required: false)
  21. -webp_dep = dependency ('libwebp', required: false)
  22. -webpmux_dep = dependency ('libwebpmux', required: false)
  23. +
  24. +if get_option('colord')
  25. + colord_dep = dependency ('colord')
  26. +endif
  27. +
  28. +if get_option('packagekit')
  29. + packagekit_dep = dependency ('packagekit-glib2', version: '>= 1.1.5')
  30. +endif
  31. +
  32. +if get_option('webp')
  33. + webp_dep = dependency ('libwebp')
  34. + webpmux_dep = dependency ('libwebpmux')
  35. +endif
  36. +
  37. sane_dep = dependency ('sane-backends')
  38. msgfmt = find_program ('msgfmt')
  39. itstool = find_program ('itstool')
  40. diff --git a/meson_options.txt b/meson_options.txt
  41. new file mode 100644
  42. index 0000000..570ecdd
  43. --- /dev/null
  44. +++ b/meson_options.txt
  45. @@ -0,0 +1,3 @@
  46. +option('colord', type: 'boolean', value: false)
  47. +option('packagekit', type: 'boolean', value: false)
  48. +option('webp', type: 'boolean', value: false)
  49. diff --git a/src/meson.build b/src/meson.build
  50. index 3f699eb..0c8965e 100644
  51. --- a/src/meson.build
  52. +++ b/src/meson.build
  53. @@ -1,16 +1,20 @@
  54. vala_args = [ '--pkg=posix', '--vapidir=' + meson.current_source_dir () ]
  55. dependencies = [ glib_dep, gtk_dep, libhandy_dep, zlib_dep, cairo_dep, gdk_pixbuf_dep, gusb_dep, sane_dep ]
  56. -if colord_dep.found ()
  57. +if get_option('colord')
  58. vala_args += [ '-D', 'HAVE_COLORD' ]
  59. dependencies += colord_dep
  60. endif
  61. -if packagekit_dep.found ()
  62. +if get_option('packagekit')
  63. vala_args += [ '-D', 'HAVE_PACKAGEKIT' ]
  64. dependencies += packagekit_dep
  65. endif
  66. -if webp_dep.found () and (not colord_dep.found () or webpmux_dep.found ()) # Webpmux only required if colord
  67. +if get_option('webp')
  68. vala_args += [ '-D', 'HAVE_WEBP' ]
  69. - dependencies += [ webp_dep, webpmux_dep ]
  70. + dependencies += [ webp_dep ]
  71. + # Webpmux only required if colord
  72. + if get_option('colord')
  73. + dependencies += [ webpmux_dep ]
  74. + endif
  75. endif
  76. simple_scan = executable ('simple-scan',
  77. --
  78. 2.26.3