From c00a155e90a9b22bd6ab5fa5407bb9923ee16ca0 Mon Sep 17 00:00:00 2001
From: "Meyer, Wolfgang" <Wolfgang.Meyer@gossenmetrawatt.com>
Date: Fri, 16 Sep 2022 18:45:58 +0200
Subject: [PATCH] meson.build: make fbpdf build optional

Upstream-Status: Pending
Signed-off-by: "Meyer, Wolfgang" <Wolfgang.Meyer@gossenmetrawatt.com>
---
 meson.build       | 22 ++++++++++++----------
 meson_options.txt |  1 +
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/meson.build b/meson.build
index 6b3daf3..289d1ec 100644
--- a/meson.build
+++ b/meson.build
@@ -15,11 +15,11 @@ x11resdir    = x11resrun.stdout().strip()
 
 # pkg-config deps
 pixman_dep   = dependency('pixman-1')
-poppler_dep  = dependency('poppler-glib')
+poppler_dep  = dependency('poppler-glib', required: get_option('pdf'))
 cairo_dep    = dependency('cairo')
 drm_dep      = dependency('libdrm')
-gbm_dep      = dependency('gbm')
-epoxy_dep    = dependency('epoxy')
+gbm_dep      = dependency('gbm', required: get_option('pdf'))
+epoxy_dep    = dependency('epoxy', required: get_option('pdf'))
 exif_dep     = dependency('libexif')
 png_dep      = dependency('libpng', required: get_option('png'))
 tiff_dep     = dependency('libtiff-4', required: get_option('tiff'))
@@ -132,13 +132,15 @@ fbpdf_deps   = [ drm_dep, gbm_dep, epoxy_dep,
                  pixman_dep, poppler_dep, cairo_dep,
                  udev_dep, input_dep ]
 
-executable('fbpdf',
-           sources             : fbpdf_srcs,
-           dependencies        : fbpdf_deps,
-           install             : true)
-install_data('fbgs',
-             install_dir        : get_option('bindir'),
-             install_mode       : 'rwxr--r--')
+if get_option('pdf').enabled()
+    executable('fbpdf',
+               sources             : fbpdf_srcs,
+               dependencies        : fbpdf_deps,
+               install             : true)
+    install_data('fbgs',
+                 install_dir        : get_option('bindir'),
+                 install_mode       : 'rwxr--r--')
+endif
 
 # build fbcon
 fbcon_srcs   = [ 'fbcon.c', 'drmtools.c', 'fbtools.c', 'gfx.c', 'vt.c', 'kbd.c' ]
diff --git a/meson_options.txt b/meson_options.txt
index ce37188..74699ab 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,3 +3,4 @@ option('png', type: 'feature', value : 'enabled')
 option('tiff', type: 'feature', value : 'enabled')
 option('webp', type: 'feature', value : 'disabled')
 option('motif', type: 'feature', value : 'disabled')
+option('pdf', type: 'feature', value : 'enabled')
-- 
2.37.3

