Repository.mk | 4 - RepositoryExternal.mk | 4 + config_host.mk.in | 1 config_host/config_features.h.in | 5 ++ configure.ac | 51 +++++++++++++++------- sd/CppunitTest_sd_activex_controls_tests.mk | 2 sd/CppunitTest_sd_import_tests.mk | 4 - sdext/Module_sdext.mk | 7 ++- sdext/source/pdfimport/test/tests.cxx | 13 +++++ sfx2/source/doc/objstor.cxx | 16 +++++- xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk | 2 xmlsecurity/CppunitTest_xmlsecurity_signing.mk | 2 12 files changed, 85 insertions(+), 26 deletions(-)
New commits: commit 5b8e16a8ce7738a659fcf8bbe92d6b590dcd3027 Author: Ashod Nakashian <[email protected]> AuthorDate: Wed Mar 6 22:06:35 2019 -0500 Commit: Andras Timar <[email protected]> CommitDate: Thu Mar 7 09:10:27 2019 +0100 build: support disabling poppler This adds --enable-poppler configure option. Poppler can be enabled/disabled by setting this parameter to yes or no. Change-Id: I42ba2d27de7b5014d28523394310616d20073b71 Reviewed-on: https://gerrit.libreoffice.org/68602 Reviewed-by: Andras Timar <[email protected]> Tested-by: Andras Timar <[email protected]> diff --git a/Repository.mk b/Repository.mk index 2632b700b202..dbd46426e5d5 100644 --- a/Repository.mk +++ b/Repository.mk @@ -224,7 +224,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,gnome, \ )) endif -ifneq ($(ENABLE_PDFIMPORT),) +ifneq ($(ENABLE_POPPLER),) $(eval $(call gb_Helper_register_executables_for_install,OOO,pdfimport, \ xpdfimport \ )) @@ -1001,7 +1001,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ogltrans,\ slideshow_opengl_shader \ )) -ifneq ($(ENABLE_PDFIMPORT),) +ifneq ($(ENABLE_POPPLER),) $(eval $(call gb_Helper_register_packages_for_install,pdfimport, \ sdext_pdfimport_pdf \ )) diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 78b511a3f124..360929378cc1 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -2717,6 +2717,8 @@ endef endif # ENABLE_VALGRIND +ifeq ($(ENABLE_POPPLER),TRUE) + ifneq ($(SYSTEM_POPPLER),) define gb_LinkTarget__use_poppler @@ -2766,6 +2768,8 @@ endef endif # SYSTEM_POPPLER +endif # ENABLE_POPPLER + ifneq ($(SYSTEM_CLUCENE),) diff --git a/config_host.mk.in b/config_host.mk.in index 802b8e45d353..4b42b38f3d64 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -154,6 +154,7 @@ export ENABLE_OPTIMIZED=@ENABLE_OPTIMIZED@ export ENABLE_PCH=@ENABLE_PCH@ export ENABLE_PDFIMPORT=@ENABLE_PDFIMPORT@ export ENABLE_PDFIUM=@ENABLE_PDFIUM@ +export ENABLE_POPPLER=@ENABLE_POPPLER@ export ENABLE_QT5=@ENABLE_QT5@ export ENABLE_RANDR=@ENABLE_RANDR@ export ENABLE_RELEASE_BUILD=@ENABLE_RELEASE_BUILD@ diff --git a/config_host/config_features.h.in b/config_host/config_features.h.in index 75845dcf3286..d22f7dbb072a 100644 --- a/config_host/config_features.h.in +++ b/config_host/config_features.h.in @@ -175,6 +175,11 @@ #define HAVE_FEATURE_PDFIUM 0 /* + * Whether poppler is available + */ +#define HAVE_FEATURE_POPPLER 0 + +/* * Whether extra fonts are available */ #define HAVE_MORE_FONTS 0 diff --git a/configure.ac b/configure.ac index c5408b97ccff..9c8f50d5b5e7 100644 --- a/configure.ac +++ b/configure.ac @@ -1620,6 +1620,11 @@ AC_ARG_WITH(system-openldap, [Use the OpenLDAP LDAP SDK already on system.]),, [with_system_openldap="$with_system_libs"]) +libo_FUZZ_ARG_ENABLE(poppler, + AS_HELP_STRING([--disable-poppler], + [Disable building Poppler.]) +) + AC_ARG_WITH(system-poppler, AS_HELP_STRING([--with-system-poppler], [Use system poppler (only needed for PDF import).]),, @@ -10039,6 +10044,33 @@ AC_SUBST([DCONF_CFLAGS]) AC_SUBST([DCONF_LIBS]) AC_SUBST([ENABLE_DCONF]) +# Pdfium? +AC_MSG_CHECKING([whether to build PDFium]) +ENABLE_PDFIUM= +if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then + AC_MSG_RESULT([yes]) + ENABLE_PDFIUM=TRUE + AC_DEFINE(HAVE_FEATURE_PDFIUM) + BUILD_TYPE="$BUILD_TYPE PDFIUM" +else + AC_MSG_RESULT([no]) +fi +AC_SUBST(ENABLE_PDFIUM) + +dnl =================================================================== +dnl Check for poppler +dnl =================================================================== +ENABLE_POPPLER= +AC_MSG_CHECKING([enable poppler]) +if test -z "$enable_poppler" -o "$enable_poppler" = yes; then + AC_MSG_RESULT([yes]) + ENABLE_POPPLER=TRUE + AC_DEFINE(HAVE_FEATURE_POPPLER) +else + AC_MSG_RESULT([no]) +fi +AC_SUBST(ENABLE_POPPLER) + # pdf import? AC_MSG_CHECKING([whether to build the PDF import feature]) ENABLE_PDFIMPORT= @@ -10046,7 +10078,11 @@ if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_ AC_MSG_RESULT([yes]) ENABLE_PDFIMPORT=TRUE AC_DEFINE(HAVE_FEATURE_PDFIMPORT) +else + AC_MSG_RESULT([no]) +fi +if test $ENABLE_PDFIMPORT == TRUE -a $ENABLE_POPPLER == TRUE; then dnl =================================================================== dnl Check for system poppler dnl =================================================================== @@ -10077,27 +10113,12 @@ if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_ AC_DEFINE([HAVE_POPPLER_VERSION_H], 1) fi AC_DEFINE([ENABLE_PDFIMPORT],1) -else - AC_MSG_RESULT([no]) fi AC_SUBST(ENABLE_PDFIMPORT) AC_SUBST(SYSTEM_POPPLER) AC_SUBST(POPPLER_CFLAGS) AC_SUBST(POPPLER_LIBS) -# pdf import? -AC_MSG_CHECKING([whether to build PDFium]) -ENABLE_PDFIUM= -if test -z "$enable_pdfium" -o "$enable_pdfium" = yes; then - AC_MSG_RESULT([yes]) - ENABLE_PDFIUM=TRUE - AC_DEFINE(HAVE_FEATURE_PDFIUM) - BUILD_TYPE="$BUILD_TYPE PDFIUM" -else - AC_MSG_RESULT([no]) -fi -AC_SUBST(ENABLE_PDFIUM) - SYSTEM_GPGMEPP= if test "$build_for_ios" = "YES"; then diff --git a/sd/CppunitTest_sd_activex_controls_tests.mk b/sd/CppunitTest_sd_activex_controls_tests.mk index 2b42afc1087b..4325651880b5 100755 --- a/sd/CppunitTest_sd_activex_controls_tests.mk +++ b/sd/CppunitTest_sd_activex_controls_tests.mk @@ -89,7 +89,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_activex_controls_tests,\ sd/util/sd \ sd/util/sdfilt \ sd/util/sdd \ - $(if $(ENABLE_PDFIMPORT),sdext/source/pdfimport/pdfimport) \ + $(if $(ENABLE_POPPLER),sdext/source/pdfimport/pdfimport) \ sfx2/util/sfx \ sot/util/sot \ svl/source/fsstor/fsstorage \ diff --git a/sd/CppunitTest_sd_import_tests.mk b/sd/CppunitTest_sd_import_tests.mk index 0307580ac9d7..6e278a5e9530 100644 --- a/sd/CppunitTest_sd_import_tests.mk +++ b/sd/CppunitTest_sd_import_tests.mk @@ -91,7 +91,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ sd/util/sd \ sd/util/sdfilt \ sd/util/sdd \ - $(if $(ENABLE_PDFIMPORT),sdext/source/pdfimport/pdfimport) \ + $(if $(ENABLE_POPPLER),sdext/source/pdfimport/pdfimport) \ sfx2/util/sfx \ sot/util/sot \ svl/source/fsstor/fsstorage \ @@ -117,7 +117,7 @@ $(eval $(call gb_CppunitTest_use_packages,sd_import_tests,\ oox_customshapes \ )) -ifneq ($(ENABLE_PDFIMPORT),) +ifneq ($(ENABLE_POPPLER),) $(eval $(call gb_CppunitTest_use_executable,sd_import_tests,xpdfimport)) endif diff --git a/sdext/Module_sdext.mk b/sdext/Module_sdext.mk index 44ccba59a754..fd1d191b4939 100644 --- a/sdext/Module_sdext.mk +++ b/sdext/Module_sdext.mk @@ -20,10 +20,15 @@ $(eval $(call gb_Module_add_targets,sdext,\ ifeq ($(ENABLE_PDFIMPORT),TRUE) $(eval $(call gb_Module_add_targets,sdext,\ CustomTarget_pdfimport \ - Executable_xpdfimport \ Library_pdfimport \ +)) + +ifeq ($(ENABLE_POPPLER),TRUE) +$(eval $(call gb_Module_add_targets,sdext,\ + Executable_xpdfimport \ Package_pdfimport_xpdfimport \ )) +endif $(eval $(call gb_Module_add_check_targets,sdext,\ CppunitTest_sdext_pdfimport \ diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index bbc0a008c7b8..8fb2e87c5da8 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <config_features.h> #include <zlib.h> #include "outputwrap.hxx" @@ -452,6 +453,7 @@ namespace public: void testXPDFParser() { +#if HAVE_FEATURE_POPPLER std::shared_ptr<TestSink> pSink( new TestSink() ); CPPUNIT_ASSERT( pdfi::xpdf_ImportFromFile( @@ -461,10 +463,12 @@ namespace OUString(), getComponentContext(), "" ) ); pSink->check(); +#endif } void testOdfDrawExport() { +#if HAVE_FEATURE_POPPLER rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) ); xAdaptor->setTreeVisitorFactory( createDrawTreeVisitorFactory() ); @@ -476,10 +480,12 @@ namespace new OutputWrap(tempFileURL), nullptr )); osl::File::remove( tempFileURL ); +#endif } void testOdfWriterExport() { +#if HAVE_FEATURE_POPPLER rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) ); xAdaptor->setTreeVisitorFactory( createWriterTreeVisitorFactory() ); @@ -491,10 +497,12 @@ namespace new OutputWrap(tempFileURL), nullptr )); osl::File::remove( tempFileURL ); +#endif } void testTdf96993() { +#if HAVE_FEATURE_POPPLER rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory()); @@ -505,10 +513,12 @@ namespace nullptr)); // This ensures that the imported image arrives properly flipped CPPUNIT_ASSERT(aOutput.indexOf("draw:transform=\"matrix(18520.8333333333 0 0 26281.9444444444 0 0)\"") != -1); +#endif } void testTdf98421() { +#if HAVE_FEATURE_POPPLER rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory()); @@ -520,10 +530,12 @@ namespace // This ensures that the imported image arrives properly flipped CPPUNIT_ASSERT(aOutput.indexOf("draw:transform=\"scale( 1.0 -1.0 ) translate( 0mm 0mm )\"") != -1); CPPUNIT_ASSERT(aOutput.indexOf("svg:height=\"-262.82mm\"") != -1); +#endif } void testTdf105536() { +#if HAVE_FEATURE_POPPLER rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory()); @@ -534,6 +546,7 @@ namespace nullptr)); // This ensures that the imported image arrives properly flipped CPPUNIT_ASSERT(aOutput.indexOf("draw:transform=\"matrix(-21488.4 0 0 -27978.1 21488.4 27978.1)\"") != -1); +#endif } CPPUNIT_TEST_SUITE(PDFITest); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index ad0ffb937416..79b85e480508 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -750,11 +750,21 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) { // Experimental PDF importing using PDFium. This is currently enabled for LOK only and // we handle it not via XmlFilterAdaptor but a new SdPdfFiler. - const bool bPdfiumImport = (comphelper::LibreOfficeKit::isActive() || getenv("LO_IMPORT_USE_PDFIUM")) && pMedium->GetFilter() && - (pMedium->GetFilter()->GetFilterName() == "draw_pdf_import"); +#if !HAVE_FEATURE_POPPLER + constexpr bool bUsePdfium = true; +#else + const bool bUsePdfium + = comphelper::LibreOfficeKit::isActive() || getenv("LO_IMPORT_USE_PDFIUM"); +#endif + const bool bPdfiumImport + = bUsePdfium && pMedium->GetFilter() + && (pMedium->GetFilter()->GetFilterName() == "draw_pdf_import"); + pImpl->nLoadedFlags = SfxLoadedFlags::NONE; pImpl->bModelInitialized = false; - if ( pMedium->GetFilter() && ( pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER ) && !bPdfiumImport ) + if (pMedium->GetFilter() + && (pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER) + && !bPdfiumImport) { uno::Reference < beans::XPropertySet > xSet( GetModel(), uno::UNO_QUERY ); const OUString sLockUpdates("LockUpdates"); diff --git a/xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk b/xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk index 021ab8dbe99f..f2500b5d3100 100644 --- a/xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk +++ b/xmlsecurity/CppunitTest_xmlsecurity_pdfsigning.mk @@ -48,7 +48,7 @@ $(eval $(call gb_CppunitTest_use_rdb,xmlsecurity_pdfsigning,services)) $(eval $(call gb_CppunitTest_use_configuration,xmlsecurity_pdfsigning)) -ifeq ($(ENABLE_PDFIMPORT),TRUE) +ifeq ($(ENABLE_POPPLER),TRUE) $(eval $(call gb_CppunitTest_use_executable,xmlsecurity_pdfsigning,xpdfimport)) endif diff --git a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk index 2f3ed41e2dfb..435674b64e0c 100644 --- a/xmlsecurity/CppunitTest_xmlsecurity_signing.mk +++ b/xmlsecurity/CppunitTest_xmlsecurity_signing.mk @@ -48,7 +48,7 @@ $(eval $(call gb_CppunitTest_use_rdb,xmlsecurity_signing,services)) $(eval $(call gb_CppunitTest_use_configuration,xmlsecurity_signing)) -ifeq ($(ENABLE_PDFIMPORT),TRUE) +ifeq ($(ENABLE_POPPLER),TRUE) $(eval $(call gb_CppunitTest_use_executable,xmlsecurity_signing,xpdfimport)) endif _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
