1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-26 10:03:40 +03:00

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.

(cherry picked from commit 3f5225d7f301f70c9418122cf1e1989ccb33ea76)
(cherry picked from commit e2a07cdac6c2750c4d2d771da8c708cb1626b314)
This commit is contained in:
Daan De Meyer 2022-10-14 14:21:43 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent b81d1613ad
commit bad202a76c
2 changed files with 13 additions and 3 deletions

View File

@ -1292,7 +1292,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"
@ -18,10 +19,19 @@ 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,
const char *s;
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) {