Andrew Geissler | 8f84068 | 2023-07-21 09:09:43 -0500 | [diff] [blame] | 1 | From cdcde5c1fd106a69118dff98118600911392762f Mon Sep 17 00:00:00 2001 |
| 2 | From: "Meyer, Wolfgang" <Wolfgang.Meyer@gossenmetrawatt.com> |
| 3 | Date: Fri, 16 Sep 2022 16:25:38 +0200 |
| 4 | Subject: [PATCH] meson.build: add features options for png, gif, tiff, webp, and motif |
| 5 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 6 | Upstream-Status: Submitted [https://github.com/kraxel/fbida/pull/4] |
Andrew Geissler | 8f84068 | 2023-07-21 09:09:43 -0500 | [diff] [blame] | 7 | Signed-off-by: "Meyer, Wolfgang" <Wolfgang.Meyer@gossenmetrawatt.com> |
| 8 | --- |
| 9 | meson.build | 41 +++++++++++++++++++++++++++-------------- |
| 10 | meson_options.txt | 5 +++++ |
| 11 | selections.c | 4 ++++ |
| 12 | 3 files changed, 36 insertions(+), 14 deletions(-) |
| 13 | create mode 100644 meson_options.txt |
| 14 | |
| 15 | diff --git a/meson.build b/meson.build |
| 16 | index cd9cc49..b5e3ffc 100644 |
| 17 | --- a/meson.build |
| 18 | +++ b/meson.build |
| 19 | @@ -23,9 +23,9 @@ drm_dep = dependency('libdrm') |
| 20 | gbm_dep = dependency('gbm') |
| 21 | epoxy_dep = dependency('epoxy') |
| 22 | exif_dep = dependency('libexif') |
| 23 | -png_dep = dependency('libpng') |
| 24 | -tiff_dep = dependency('libtiff-4') |
| 25 | -webp_dep = dependency('libwebp', required : false) |
| 26 | +png_dep = dependency('libpng', required: get_option('png')) |
| 27 | +tiff_dep = dependency('libtiff-4', required: get_option('tiff')) |
| 28 | +webp_dep = dependency('libwebp', required : get_option('webp')) |
| 29 | udev_dep = dependency('libudev') |
| 30 | input_dep = dependency('libinput') |
| 31 | xkb_dep = dependency('xkbcommon') |
| 32 | @@ -36,20 +36,20 @@ jpeg_dep = cc.find_library('jpeg') |
| 33 | util_dep = cc.find_library('util') |
| 34 | math_dep = cc.find_library('m', required : false) |
| 35 | pcd_dep = cc.find_library('pcd', required : false) |
| 36 | -gif_dep = cc.find_library('gif', required : false) |
| 37 | +gif_dep = cc.find_library('gif', required: get_option('gif')) |
| 38 | |
| 39 | # motif + x11 libs |
| 40 | -motif_dep = cc.find_library('Xm', required : false) |
| 41 | -xpm_dep = cc.find_library('Xpm', required : false) |
| 42 | -xt_dep = cc.find_library('Xt', required : false) |
| 43 | -xext_dep = cc.find_library('Xext', required : false) |
| 44 | -x11_dep = cc.find_library('X11', required : false) |
| 45 | +motif_dep = cc.find_library('Xm', required : get_option('motif')) |
| 46 | +xpm_dep = cc.find_library('Xpm', required : get_option('motif')) |
| 47 | +xt_dep = cc.find_library('Xt', required : get_option('motif')) |
| 48 | +xext_dep = cc.find_library('Xext', required : get_option('motif')) |
| 49 | +x11_dep = cc.find_library('X11', required : get_option('motif')) |
| 50 | |
| 51 | # image formats |
| 52 | read_srcs = [ 'readers.c', 'rd/read-ppm.c', 'rd/read-bmp.c', |
| 53 | - 'rd/read-jpeg.c', 'rd/read-png.c', 'rd/read-tiff.c' ] |
| 54 | + 'rd/read-jpeg.c' ] |
| 55 | write_srcs = [ 'writers.c', 'wr/write-ppm.c', 'wr/write-ps.c', |
| 56 | - 'wr/write-jpeg.c', 'wr/write-png.c', 'wr/write-tiff.c' ] |
| 57 | + 'wr/write-jpeg.c' ] |
| 58 | image_deps = [ jpeg_dep, png_dep, tiff_dep, |
| 59 | pcd_dep, gif_dep, webp_dep ] |
| 60 | |
| 61 | @@ -57,11 +57,21 @@ if pcd_dep.found() |
| 62 | read_srcs += 'rd/read-pcd.c' |
| 63 | config.set('HAVE_LIBPCD', true) |
| 64 | endif |
| 65 | -if gif_dep.found() |
| 66 | +if get_option('png').enabled() |
| 67 | + read_srcs += 'rd/read-png.c' |
| 68 | + write_srcs += 'wr/write-png.c' |
| 69 | + config.set('HAVE_LIBPNG', true) |
| 70 | +endif |
| 71 | +if get_option('tiff').enabled() |
| 72 | + read_srcs += 'rd/read-tiff.c' |
| 73 | + write_srcs += 'wr/write-tiff.c' |
| 74 | + config.set('HAVE_LIBTIFF', true) |
| 75 | +endif |
| 76 | +if get_option('gif').enabled() |
| 77 | read_srcs += 'rd/read-gif.c' |
| 78 | config.set('HAVE_LIBGIF', true) |
| 79 | endif |
| 80 | -if webp_dep.found() |
| 81 | +if get_option('webp').enabled() |
| 82 | read_srcs += 'rd/read-webp.c' |
| 83 | config.set('HAVE_LIBWEBP', true) |
| 84 | endif |
| 85 | @@ -168,7 +181,7 @@ ida_srcs = [ 'ida.c', 'man.c', 'hex.c', 'x11.c', 'viewer.c', |
| 86 | ida_deps = [ pixman_dep, exif_dep, image_deps, math_dep, |
| 87 | motif_dep, xpm_dep, xt_dep, xext_dep, x11_dep ] |
| 88 | |
| 89 | -if motif_dep.found() |
| 90 | +if get_option('motif').enabled() |
| 91 | executable('ida', |
| 92 | sources : ida_srcs, |
| 93 | dependencies : ida_deps, |
| 94 | diff --git a/meson_options.txt b/meson_options.txt |
| 95 | new file mode 100644 |
| 96 | index 0000000..ce37188 |
| 97 | --- /dev/null |
| 98 | +++ b/meson_options.txt |
| 99 | @@ -0,0 +1,5 @@ |
| 100 | +option('gif', type: 'feature', value : 'enabled') |
| 101 | +option('png', type: 'feature', value : 'enabled') |
| 102 | +option('tiff', type: 'feature', value : 'enabled') |
| 103 | +option('webp', type: 'feature', value : 'disabled') |
| 104 | +option('motif', type: 'feature', value : 'disabled') |
| 105 | diff --git a/selections.c b/selections.c |
| 106 | index 7b16264..ccdc686 100644 |
| 107 | --- a/selections.c |
| 108 | +++ b/selections.c |
| 109 | @@ -609,8 +609,12 @@ void ipc_init() |
| 110 | #ifdef HAVE_LIBGIF |
| 111 | targets[ntargets++] = MIME_IMAGE_GIF; |
| 112 | #endif |
| 113 | +#ifdef HAVE_LIBPNG |
| 114 | targets[ntargets++] = MIME_IMAGE_PNG; |
| 115 | +#endif |
| 116 | +#ifdef HAVE_LIBTIFF |
| 117 | targets[ntargets++] = MIME_IMAGE_TIFF; |
| 118 | +#endif |
| 119 | targets[ntargets++] = XA_PIXMAP; |
| 120 | targets[ntargets++] = XA_STRING; |
| 121 | |
| 122 | -- |
| 123 | 2.37.3 |
| 124 | |