aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-03-15 03:31:30 +0100
committerPřemysl Eric Janouch <p@janouch.name>2023-03-15 05:52:32 +0100
commit796b05c9a5f04aba87e26c5a8384d84edee20b77 (patch)
tree74b1dbda5521bb39bcf9215c3e884499fca215d2 /meson.build
parent9286858573ef5e430ac2fb24c274a6fcd41a1edd (diff)
downloadfiv-796b05c9a5f04aba87e26c5a8384d84edee20b77.tar.gz
fiv-796b05c9a5f04aba87e26c5a8384d84edee20b77.tar.xz
fiv-796b05c9a5f04aba87e26c5a8384d84edee20b77.zip
Integrate online reverse image search
This makes use of our image processing capabilities in order to turn arbitrary image files into normalized thumbnails, upload them to a temporary host, and pass the resulting URI to a search provider. In future, fiv should ideally run the upload itself, so that its status and any errors are obvious to the user, as well as to get rid of the script's dependency on jq.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build35
1 files changed, 31 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index 1be61ff..8571101 100644
--- a/meson.build
+++ b/meson.build
@@ -35,12 +35,12 @@ dependencies = [
dependency('gtk+-3.0'),
dependency('pixman-1'),
- # Wuffs is included as a submodule.
dependency('libturbojpeg'),
dependency('libwebp'),
dependency('libwebpdemux'),
dependency('libwebpdecoder', required : false),
dependency('libwebpmux'),
+ # Wuffs is included as a submodule.
lcms2,
libjpegqs,
@@ -251,6 +251,32 @@ if not win32
install_dir : get_option('datadir') / 'applications')
endforeach
+ # TODO(p): Consider moving this to /usr/share or /usr/lib.
+ install_data('fiv-reverse-search',
+ install_dir : get_option('bindir'))
+
+ # As usual, handling generated files in Meson is a fucking pain.
+ updatable_desktops = [application_ns + 'fiv.desktop']
+ foreach name, uri : {
+ 'Google' : 'https://lens.google.com/uploadbyurl?url=',
+ 'Bing' : 'https://www.bing.com/images/searchbyimage?cbir=sbi&imgurl=',
+ 'Yandex' : 'https://yandex.com/images/search?rpt=imageview&url=',
+ 'TinEye' : 'https://tineye.com/search?url=',
+ 'SauceNAO' : 'https://saucenao.com/search.php?url=',
+ 'IQDB' : 'https://iqdb.org/?url=',
+ }
+ desktop = 'fiv-reverse-search-' + name.to_lower() + '.desktop'
+ updatable_desktops += application_ns + desktop
+
+ test(desktop, dfv, args : configure_file(
+ input : 'fiv-reverse-search.desktop.in',
+ output : application_ns + desktop,
+ configuration : {'NAME' : name, 'URL' : uri},
+ install : true,
+ install_dir : get_option('datadir') / 'applications',
+ ))
+ endforeach
+
# With gdk-pixbuf, fiv.desktop depends on currently installed modules;
# the package manager needs to be told to run this script as necessary.
dynamic_desktops = gdkpixbuf.found()
@@ -259,9 +285,10 @@ if not win32
input : 'fiv-update-desktop-files.in',
output : 'fiv-update-desktop-files',
configuration : {
- 'EXE' : get_option('prefix') / get_option('bindir') / exe.name(),
- 'DESKTOP' : get_option('prefix') / get_option('datadir') \
- / 'applications' / application_ns + 'fiv.desktop',
+ 'FIV' : get_option('prefix') / get_option('bindir') / exe.name(),
+ 'DESKTOPDIR' : get_option('prefix') /
+ get_option('datadir') / 'applications',
+ 'DESKTOPS' : ' \\\n\t'.join(updatable_desktops),
},
install : dynamic_desktops,
install_dir : get_option('bindir'))