From 82ff5b3b46a4a29d8d53ada6c093769d7d37374a Mon Sep 17 00:00:00 2001 From: kramo Date: Fri, 13 Oct 2023 16:58:08 +0200 Subject: [PATCH] Add tiff_compression build option --- cartridges/shared.py.in | 1 + cartridges/utils/save_cover.py | 2 +- meson.build | 1 + meson_options.txt | 9 +++++++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cartridges/shared.py.in b/cartridges/shared.py.in index 74e19fa..a7ce958 100644 --- a/cartridges/shared.py.in +++ b/cartridges/shared.py.in @@ -36,6 +36,7 @@ APP_ID = "@APP_ID@" VERSION = "@VERSION@" PREFIX = "@PREFIX@" PROFILE = "@PROFILE@" +TIFF_COMPRESSION = "@TIFF_COMPRESSION@" SPEC_VERSION = 1.5 # The version of the game_id.json spec schema = Gio.Settings.new(APP_ID) diff --git a/cartridges/utils/save_cover.py b/cartridges/utils/save_cover.py index a62ecb9..e8d49e7 100644 --- a/cartridges/utils/save_cover.py +++ b/cartridges/utils/save_cover.py @@ -74,7 +74,7 @@ def convert_cover( tmp_path, compression="tiff_adobe_deflate" if shared.schema.get_boolean("high-quality-images") - else "webp", + else shared.TIFF_COMPRESSION, ) except UnidentifiedImageError: try: diff --git a/meson.build b/meson.build index 30b2be7..41d874f 100644 --- a/meson.build +++ b/meson.build @@ -31,6 +31,7 @@ conf.set('APP_ID', app_id) conf.set('PREFIX', prefix) conf.set('VERSION', meson.project_version()) conf.set('PROFILE', profile) +conf.set('TIFF_COMPRESSION', get_option('tiff_compression')) conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir'))) conf.set('pkgdatadir', pkgdatadir) conf.set('libexecdir', libexecdir) diff --git a/meson_options.txt b/meson_options.txt index 5026cd2..e349ff6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,3 +7,12 @@ option( ], value: 'release' ) +option( + 'tiff_compression', + type: 'combo', + choices: [ + 'webp', + 'jpeg', + ], + value: 'webp' +) \ No newline at end of file