aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/fbida/files/0002-meson.build-add-features-options-for-png-gif-tiff-we.patch
blob: fe36fcb7cb58843be1994202fffb2a2d9d436879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
From cdcde5c1fd106a69118dff98118600911392762f Mon Sep 17 00:00:00 2001
From: "Meyer, Wolfgang" <Wolfgang.Meyer@gossenmetrawatt.com>
Date: Fri, 16 Sep 2022 16:25:38 +0200
Subject: [PATCH] meson.build: add features options for png, gif, tiff, webp, and motif

Upstream-Status: Pending
Signed-off-by: "Meyer, Wolfgang" <Wolfgang.Meyer@gossenmetrawatt.com>
---
 meson.build       | 41 +++++++++++++++++++++++++++--------------
 meson_options.txt |  5 +++++
 selections.c      |  4 ++++
 3 files changed, 36 insertions(+), 14 deletions(-)
 create mode 100644 meson_options.txt

diff --git a/meson.build b/meson.build
index cd9cc49..b5e3ffc 100644
--- a/meson.build
+++ b/meson.build
@@ -23,9 +23,9 @@ drm_dep      = dependency('libdrm')
 gbm_dep      = dependency('gbm')
 epoxy_dep    = dependency('epoxy')
 exif_dep     = dependency('libexif')
-png_dep      = dependency('libpng')
-tiff_dep     = dependency('libtiff-4')
-webp_dep     = dependency('libwebp', required : false)
+png_dep      = dependency('libpng', required: get_option('png'))
+tiff_dep     = dependency('libtiff-4', required: get_option('tiff'))
+webp_dep     = dependency('libwebp', required : get_option('webp'))
 udev_dep     = dependency('libudev')
 input_dep    = dependency('libinput')
 xkb_dep      = dependency('xkbcommon')
@@ -36,20 +36,20 @@ jpeg_dep     = cc.find_library('jpeg')
 util_dep     = cc.find_library('util')
 math_dep     = cc.find_library('m', required : false)
 pcd_dep      = cc.find_library('pcd', required : false)
-gif_dep      = cc.find_library('gif', required : false)
+gif_dep      = cc.find_library('gif', required: get_option('gif'))
 
 # motif + x11 libs
-motif_dep    = cc.find_library('Xm', required : false)
-xpm_dep      = cc.find_library('Xpm', required : false)
-xt_dep       = cc.find_library('Xt', required : false)
-xext_dep     = cc.find_library('Xext', required : false)
-x11_dep      = cc.find_library('X11', required : false)
+motif_dep    = cc.find_library('Xm', required : get_option('motif'))
+xpm_dep      = cc.find_library('Xpm', required : get_option('motif'))
+xt_dep       = cc.find_library('Xt', required : get_option('motif'))
+xext_dep     = cc.find_library('Xext', required : get_option('motif'))
+x11_dep      = cc.find_library('X11', required : get_option('motif'))
 
 # image formats
 read_srcs    = [ 'readers.c', 'rd/read-ppm.c', 'rd/read-bmp.c',
-                 'rd/read-jpeg.c', 'rd/read-png.c', 'rd/read-tiff.c' ]
+                 'rd/read-jpeg.c' ]
 write_srcs   = [ 'writers.c', 'wr/write-ppm.c', 'wr/write-ps.c',
-                 'wr/write-jpeg.c', 'wr/write-png.c', 'wr/write-tiff.c' ]
+                 'wr/write-jpeg.c' ]
 image_deps   = [ jpeg_dep, png_dep, tiff_dep,
                  pcd_dep, gif_dep, webp_dep ]
 
@@ -57,11 +57,21 @@ if pcd_dep.found()
     read_srcs += 'rd/read-pcd.c'
     config.set('HAVE_LIBPCD', true)
 endif
-if gif_dep.found()
+if get_option('png').enabled()
+    read_srcs += 'rd/read-png.c'
+    write_srcs += 'wr/write-png.c'
+    config.set('HAVE_LIBPNG', true)
+endif
+if get_option('tiff').enabled()
+    read_srcs += 'rd/read-tiff.c'
+    write_srcs += 'wr/write-tiff.c'
+    config.set('HAVE_LIBTIFF', true)
+endif
+if get_option('gif').enabled()
     read_srcs += 'rd/read-gif.c'
     config.set('HAVE_LIBGIF', true)
 endif
-if webp_dep.found()
+if get_option('webp').enabled()
     read_srcs += 'rd/read-webp.c'
     config.set('HAVE_LIBWEBP', true)
 endif
@@ -168,7 +181,7 @@ ida_srcs     = [ 'ida.c', 'man.c', 'hex.c', 'x11.c', 'viewer.c',
 ida_deps     = [ pixman_dep, exif_dep, image_deps, math_dep,
                  motif_dep, xpm_dep, xt_dep, xext_dep, x11_dep ]
 
-if motif_dep.found()
+if get_option('motif').enabled()
     executable('ida',
                sources             : ida_srcs,
                dependencies        : ida_deps,
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..ce37188
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option('gif', type: 'feature', value : 'enabled')
+option('png', type: 'feature', value : 'enabled')
+option('tiff', type: 'feature', value : 'enabled')
+option('webp', type: 'feature', value : 'disabled')
+option('motif', type: 'feature', value : 'disabled')
diff --git a/selections.c b/selections.c
index 7b16264..ccdc686 100644
--- a/selections.c
+++ b/selections.c
@@ -609,8 +609,12 @@ void ipc_init()
 #ifdef HAVE_LIBGIF
     targets[ntargets++] = MIME_IMAGE_GIF;
 #endif
+#ifdef HAVE_LIBPNG
     targets[ntargets++] = MIME_IMAGE_PNG;
+#endif
+#ifdef HAVE_LIBTIFF
     targets[ntargets++] = MIME_IMAGE_TIFF;
+#endif
     targets[ntargets++] = XA_PIXMAP;
     targets[ntargets++] = XA_STRING;
 
-- 
2.37.3