summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-21 17:02:31 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-10-01 09:54:38 +0200
commit77960eb573e548816064690c5b1de5ca18ae9cbd (patch)
tree21507a1fcf5289ea29704377bab9c5b2ab848cd8
parent0f77b8a44e7ee5541c97304d37f0c52cd8275cba (diff)
add an explicit --disable-qrcodegen configure option
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/+/103157 Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-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.cxx21
-rw-r--r--cui/source/inc/QrCodeGenDialog.hxx4
-rw-r--r--distro-configs/LibreOfficeOssFuzz.conf1
-rw-r--r--external/qrcodegen/Module_qrcodegen.mk4
8 files changed, 89 insertions, 20 deletions
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 7f623ac80404..09e860a4987d 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -4194,6 +4194,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),\
@@ -4211,6 +4213,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
define gb_LinkTarget__use_dtoa
diff --git a/config_host.mk.in b/config_host.mk.in
index a14fb823c94c..dc3da7e01f60 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -490,6 +490,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 745fe9567773..0e9323283195 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1956,6 +1956,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.]),,
@@ -10233,26 +10237,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_qrcodegen" = "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)
@@ -13462,6 +13479,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_skia.h])
AC_CONFIG_HEADERS([config_host/config_typesizes.h])
AC_CONFIG_HEADERS([config_host/config_vendor.h])
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx
index 85ed9309df9c..7f3f6a806cf5 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -17,11 +17,13 @@
#include <utility>
#include <vcl/svapp.hxx>
+#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>
@@ -56,7 +58,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)
@@ -68,7 +72,9 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
m_xBuilder->weld_radio_button("button_quartile"),
m_xBuilder->weld_radio_button("button_high") }
, m_xSpinBorder(m_xBuilder->weld_spin_button("edit_border"))
+#if ENABLE_QRCODEGEN
, mpParent(pParent)
+#endif
{
if (!bEditExisting)
{
@@ -104,6 +110,7 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
short QrCodeGenDialog::run()
{
+#if ENABLE_QRCODEGEN
short nRet;
while (true)
{
@@ -127,10 +134,14 @@ short QrCodeGenDialog::run()
break;
}
return nRet;
+#else
+ return RET_CANCEL;
+#endif
}
void QrCodeGenDialog::Apply()
{
+#if ENABLE_QRCODEGEN
css::drawing::QRCode aQRCode;
aQRCode.Payload = m_xEdittext->get_text();
@@ -250,13 +261,12 @@ void QrCodeGenDialog::Apply()
//Not implemented for math,base and other apps.
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;
@@ -293,6 +303,11 @@ OUString QrCodeGenDialog::GenerateQRCode(OUString aQRText, long aQRECC, int aQRB
std::string svg = qr0.toSvgString(aQRBorder);
//cstring to OUString
return OUString::createFromAscii(svg.c_str());
+#else
+ (void)aQRText;
+ (void)aQRECC;
+ (void)aQRBorder;
+ return OUString();
#endif
}
diff --git a/cui/source/inc/QrCodeGenDialog.hxx b/cui/source/inc/QrCodeGenDialog.hxx
index 563182d7a043..832662837d57 100644
--- a/cui/source/inc/QrCodeGenDialog.hxx
+++ b/cui/source/inc/QrCodeGenDialog.hxx
@@ -9,6 +9,8 @@
#ifndef INCLUDED_CUI_INC_QRCODEGENDIALOG_HXX
#define INCLUDED_CUI_INC_QRCODEGENDIALOG_HXX
+#include <config_qrcodegen.h>
+
#include <vcl/weld.hxx>
#include <com/sun/star/frame/XModel.hpp>
@@ -32,7 +34,9 @@ private:
std::unique_ptr<weld::Entry> m_xEdittext;
std::unique_ptr<weld::RadioButton> m_xECC[4];
std::unique_ptr<weld::SpinButton> m_xSpinBorder;
+#if ENABLE_QRCODEGEN
weld::Widget* mpParent;
+#endif
css::uno::Reference<css::beans::XPropertySet> m_xExistingShapeProperties;
diff --git a/distro-configs/LibreOfficeOssFuzz.conf b/distro-configs/LibreOfficeOssFuzz.conf
index 77f021112dd7..99b62453af6d 100644
--- a/distro-configs/LibreOfficeOssFuzz.conf
+++ b/distro-configs/LibreOfficeOssFuzz.conf
@@ -16,5 +16,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: