app: Provide a stub implementation of AS_CHECK_VERSION if needed

Our only code that is conditional on the libappstream version wants
version 0.14.0, which conveniently is exactly the version that
introduced AS_CHECK_VERSION.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 556984e1c1)
This commit is contained in:
Simon McVittie
2023-07-10 18:43:23 +01:00
parent b6e376f6d1
commit 8434abaedf
3 changed files with 7 additions and 4 deletions

View File

@@ -1130,7 +1130,7 @@ flatpak_dir_load_appstream_store (FlatpakDir *self,
appstream_file = g_file_new_for_path (appstream_path);
as_metadata_set_format_style (mdata, AS_FORMAT_STYLE_COLLECTION);
#ifdef HAVE_APPSTREAM_0_14_0
#if AS_CHECK_VERSION(0, 14, 0)
success = as_metadata_parse_file (mdata, appstream_file, AS_FORMAT_KIND_XML, &local_error);
#else
as_metadata_parse_file (mdata, appstream_file, AS_FORMAT_KIND_XML, &local_error);

View File

@@ -28,6 +28,12 @@
#include "flatpak-dir-private.h"
#include "flatpak-permission-dbus-generated.h"
/* AS_CHECK_VERSION was introduced in 0.14.0; we still support 0.12.0, so
* behave as though versions without this macro are arbitrarily old */
#ifndef AS_CHECK_VERSION
#define AS_CHECK_VERSION(major, minor, micro) (0)
#endif
/* Appstream data expires after a day */
#define FLATPAK_APPSTREAM_TTL 86400

View File

@@ -362,9 +362,6 @@ PKG_CHECK_MODULES(OSTREE, [ostree-1 >= $OSTREE_REQS])
PKG_CHECK_MODULES(JSON, [json-glib-1.0])
PKG_CHECK_MODULES(APPSTREAM, [appstream >= 0.12.0])
PKG_CHECK_MODULES(APPSTREAM_0_14_0, appstream >= 0.14.0,
[AC_DEFINE([HAVE_APPSTREAM_0_14_0], [1], [Define if appstream >= 0.14.0 is available])],
[true])
PKG_CHECK_MODULES(GDK_PIXBUF, [gdk-pixbuf-2.0])