summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-21 17:02:31 +0100
committerAndras Timar <andras.timar@collabora.com>2020-09-24 13:12:57 +0200
commit96a8c7b3ad21db406407a141eab1c52341273721 (patch)
tree30951e63ae299c17d1355884bcca47dccaae67d7
parent5fec456a765f09337f39b94166bce28668438205 (diff)
add an explicit --disable-qrcodegen configure optionco-6.4-5
Change-Id: If8e965fa955aecdb9e7011bdddc690de9cad0c4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103120 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103158 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--RepositoryExternal.mk9
-rw-r--r--config_host.mk.in1
-rw-r--r--config_host/config_qrcodegen.h.in17
-rw-r--r--configure.ac52
-rw-r--r--cui/source/dialogs/QrCodeGenDialog.cxx24
-rw-r--r--distro-configs/LibreOfficeOssFuzz.conf1
-rw-r--r--external/qrcodegen/Module_qrcodegen.mk4
7 files changed, 86 insertions, 22 deletions
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 9c97d3af05f9..884bececcf08 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -4163,6 +4163,8 @@ gb_ExternalProject__use_qrcodegen :=
else # !SYSTEM_QRCODEGEN
+ifneq ($(ENABLE_QRCODEGEN),)
+
define gb_LinkTarget__use_qrcodegen
$(call gb_LinkTarget_use_unpacked,$(1),qrcodegen)
$(call gb_LinkTarget_set_include,$(1),\
@@ -4180,6 +4182,13 @@ $(call gb_ExternalProject_use_static_libraries,$(1),qrcodegen)
endef
+else # !ENABLE_QRCODEGEN
+
+define gb_LinkTarget__use_qrcodegen
+endef
+
+endif # ENABLE_QRCODEGEN
+
endif # SYSTEM_QRCODEGEN
$(eval $(call gb_Helper_register_packages_for_install,ucrt_binarytable,\
diff --git a/config_host.mk.in b/config_host.mk.in
index de1e44dc657b..95971e70ba99 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -464,6 +464,7 @@ export PYTHON_LIBS=$(gb_SPACE)@PYTHON_LIBS@
export PYTHON_VERSION=@PYTHON_VERSION@
export PYTHON_VERSION_MAJOR=@PYTHON_VERSION_MAJOR@
export PYTHON_VERSION_MINOR=@PYTHON_VERSION_MINOR@
+export ENABLE_QRCODEGEN=@ENABLE_QRCODEGEN@
export QRCODEGEN_CFLAGS=$(gb_SPACE)@QRCODEGEN_CFLAGS@
export QRCODEGEN_LIBS=$(gb_SPACE)@QRCODEGEN_LIBS@
export QT5_CFLAGS=$(gb_SPACE)@QT5_CFLAGS@
diff --git a/config_host/config_qrcodegen.h.in b/config_host/config_qrcodegen.h.in
new file mode 100644
index 000000000000..63388651699f
--- /dev/null
+++ b/config_host/config_qrcodegen.h.in
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_CONFIG_QRCODEGEN_H
+#define INCLUDED_CONFIG_QRCODEGEN_H
+
+#define ENABLE_QRCODEGEN 0
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/configure.ac b/configure.ac
index bc027616295d..bcf41f4ce668 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1949,6 +1949,10 @@ AC_ARG_WITH(system-hunspell,
[Use libhunspell already on system.]),,
[with_system_hunspell="$with_system_libs"])
+libo_FUZZ_ARG_ENABLE(qrcodegen,
+ AS_HELP_STRING([--disable-qrcodegen],
+ [Disable use of qrcodegen external library.]))
+
AC_ARG_WITH(system-qrcodegen,
AS_HELP_STRING([--with-system-qrcodegen],
[Use libqrcodegen already on system.]),,
@@ -10105,26 +10109,39 @@ AC_SUBST(HUNSPELL_LIBS)
dnl ===================================================================
dnl Check for system qrcodegen
dnl ===================================================================
-AC_MSG_CHECKING([which libqrcodegen to use])
-if test "$with_system_qrcodegen" = "yes"; then
- AC_MSG_RESULT([external])
- SYSTEM_QRCODEGEN=TRUE
- AC_LANG_PUSH([C++])
- AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
- [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
- AC_CHECK_LIB([qrcodegencpp], [main], [:],
- [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
- QRCODEGEN_LIBS=-lqrcodegencpp
- AC_LANG_POP([C++])
- QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
- FilterLibs "${QRCODEGEN_LIBS}"
- QRCODEGEN_LIBS="${filteredlibs}"
-else
- AC_MSG_RESULT([internal])
+AC_MSG_CHECKING([whether to use libqrcodegen])
+if test "$enable_libqrcodegen" = "no"; then
+ AC_MSG_RESULT([no])
+ ENABLE_QRCODEGEN=
SYSTEM_QRCODEGEN=
- BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
+else
+ AC_MSG_RESULT([yes])
+ ENABLE_QRCODEGEN=TRUE
+ AC_MSG_CHECKING([which libqrcodegen to use])
+ if test "$with_system_qrcodegen" = "yes"; then
+ AC_MSG_RESULT([external])
+ SYSTEM_QRCODEGEN=TRUE
+ AC_LANG_PUSH([C++])
+ AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
+ [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
+ AC_CHECK_LIB([qrcodegencpp], [main], [:],
+ [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
+ QRCODEGEN_LIBS=-lqrcodegencpp
+ AC_LANG_POP([C++])
+ QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
+ FilterLibs "${QRCODEGEN_LIBS}"
+ QRCODEGEN_LIBS="${filteredlibs}"
+ else
+ AC_MSG_RESULT([internal])
+ SYSTEM_QRCODEGEN=
+ BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
+ fi
+ if test "$ENABLE_QRCODEGEN" = TRUE; then
+ AC_DEFINE(ENABLE_QRCODEGEN)
+ fi
fi
AC_SUBST(SYSTEM_QRCODEGEN)
+AC_SUBST(ENABLE_QRCODEGEN)
AC_SUBST(QRCODEGEN_CFLAGS)
AC_SUBST(QRCODEGEN_LIBS)
@@ -13001,6 +13018,7 @@ AC_CONFIG_HEADERS([config_host/config_mpl.h])
AC_CONFIG_HEADERS([config_host/config_oox.h])
AC_CONFIG_HEADERS([config_host/config_options.h])
AC_CONFIG_HEADERS([config_host/config_options_calc.h])
+AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
AC_CONFIG_HEADERS([config_host/config_typesizes.h])
AC_CONFIG_HEADERS([config_host/config_vendor.h])
AC_CONFIG_HEADERS([config_host/config_vcl.h])
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx
index d936219f7209..6277e767ae43 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -16,11 +16,15 @@
#include <vcl/weld.hxx>
#include <sal/log.hxx>
+#include <config_qrcodegen.h>
+
+#if ENABLE_QRCODEGEN
#if defined(SYSTEM_QRCODEGEN)
#include <qrcodegen/QrCode.hpp>
#else
#include <QrCode.hpp>
#endif
+#endif
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
@@ -58,7 +62,9 @@ using namespace css::sheet;
using namespace css::text;
using namespace css::drawing;
using namespace css::graphic;
+#if ENABLE_QRCODEGEN
using namespace qrcodegen;
+#endif
QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel,
bool bEditExisting)
@@ -105,14 +111,19 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
short QrCodeGenDialog::run()
{
+#if ENABLE_QRCODEGEN
short nRet = GenericDialogController::run();
if (nRet == RET_OK)
Apply();
return nRet;
+#else
+ return RET_CANCEL;
+#endif
}
void QrCodeGenDialog::Apply()
{
+#if ENABLE_QRCODEGEN
css::drawing::QRCode aQRCode;
aQRCode.Payload = m_xEdittext->get_text();
@@ -232,13 +243,12 @@ void QrCodeGenDialog::Apply()
throw uno::RuntimeException("Not implemented");
}
}
+#endif
}
OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRBorder)
{
-#if ENABLE_FUZZERS
- return OUString();
-#else
+#if ENABLE_QRCODEGEN
//Select ECC:: value from aQrECC
qrcodegen::QrCode::Ecc bqrEcc = qrcodegen::QrCode::Ecc::LOW;
@@ -274,8 +284,12 @@ OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRB
qrcodegen::QrCode qr0 = qrcodegen::QrCode::encodeText(qrtext, bqrEcc);
std::string svg = qr0.toSvgString(aQRBorder);
//cstring to OUString
- char* cstr = &svg[0];
- return OUString::createFromAscii(cstr);
+ return OUString::createFromAscii(svg.c_str());
+#else
+ (void)aQRText;
+ (void)aQRECC;
+ (void)aQRBorder;
+ return OUString();
#endif
}
diff --git a/distro-configs/LibreOfficeOssFuzz.conf b/distro-configs/LibreOfficeOssFuzz.conf
index ab9ec3b3b01e..60fec4bc4c44 100644
--- a/distro-configs/LibreOfficeOssFuzz.conf
+++ b/distro-configs/LibreOfficeOssFuzz.conf
@@ -15,5 +15,6 @@
--disable-dbus
--disable-cups
--disable-odk
+--disable-qrcodegen
--without-java
--enable-ld=gold
diff --git a/external/qrcodegen/Module_qrcodegen.mk b/external/qrcodegen/Module_qrcodegen.mk
index 34be04cc52d9..09c771d0d535 100644
--- a/external/qrcodegen/Module_qrcodegen.mk
+++ b/external/qrcodegen/Module_qrcodegen.mk
@@ -13,8 +13,12 @@ $(eval $(call gb_Module_add_targets,qrcodegen,\
UnpackedTarball_qrcodegen \
))
+ifeq ($(ENABLE_QRCODEGEN),TRUE)
+
$(eval $(call gb_Module_add_targets,qrcodegen,\
StaticLibrary_qrcodegen \
))
+endif
+
# vim: set noet sw=4 ts=4: