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.
This commit is contained in:
Daan De Meyer 2022-10-14 14:21:43 +02:00
parent d388f3d723
commit 3f5225d7f3
2 changed files with 12 additions and 3 deletions

View file

@ -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

View file

@ -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) {