From: Daan De Meyer Date: Fri, 14 Oct 2022 12:21:43 +0000 (+0200) Subject: qrcode-util: Add support for libqrencode 3.0 X-Git-Tag: v252-rc2~22^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f5225d7f301f70c9418122cf1e1989ccb33ea76;p=thirdparty%2Fsystemd.git qrcode-util: Add support for libqrencode 3.0 They didn't actually change API between major versions, so let's support the previous version as well so we can add CentOS 8 Stream back to CI. --- diff --git a/meson.build b/meson.build index 2c6a061a90a..dfe18f7e7b0 100644 --- a/meson.build +++ b/meson.build @@ -1388,7 +1388,7 @@ conf.set10('HAVE_LIBIPTC', have) want_qrencode = get_option('qrencode') if want_qrencode != 'false' and not skip_deps libqrencode = dependency('libqrencode', - version : '>= 4', + version : '>= 3', required : want_qrencode == 'true') have = libqrencode.found() else diff --git a/src/shared/qrcode-util.c b/src/shared/qrcode-util.c index 1ad3474b3f2..4a33c28bf26 100644 --- a/src/shared/qrcode-util.c +++ b/src/shared/qrcode-util.c @@ -8,6 +8,7 @@ #include "dlfcn-util.h" #include "locale-util.h" #include "log.h" +#include "strv.h" #include "terminal-util.h" #define ANSI_WHITE_ON_BLACK "\033[40;37;1m" @@ -21,10 +22,18 @@ static QRcode* (*sym_QRcode_encodeString)(const char *string, int version, QRecL static void (*sym_QRcode_free)(QRcode *qrcode) = NULL; int dlopen_qrencode(void) { - return dlopen_many_sym_or_warn( - &qrcode_dl, "libqrencode.so.4", LOG_DEBUG, + int r; + + FOREACH_STRING(s, "libqrencode.so.4", "libqrencode.so.3") { + r = dlopen_many_sym_or_warn( + &qrcode_dl, s, LOG_DEBUG, DLSYM_ARG(QRcode_encodeString), DLSYM_ARG(QRcode_free)); + if (r >= 0) + break; + } + + return r; } static void print_border(FILE *output, unsigned width) {