Kaydet (Commit) 0d8c6707 authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Andras Timar

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/68602Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
Tested-by: 's avatarAndras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/68842
Tested-by: Jenkins
üst cac705fe
...@@ -231,7 +231,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,gnome, \ ...@@ -231,7 +231,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,gnome, \
)) ))
endif endif
ifneq ($(ENABLE_PDFIMPORT),) ifneq ($(ENABLE_POPPLER),)
$(eval $(call gb_Helper_register_executables_for_install,OOO,pdfimport, \ $(eval $(call gb_Helper_register_executables_for_install,OOO,pdfimport, \
xpdfimport \ xpdfimport \
)) ))
...@@ -1004,7 +1004,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ogltrans,\ ...@@ -1004,7 +1004,7 @@ $(eval $(call gb_Helper_register_packages_for_install,ogltrans,\
slideshow_opengl_shader \ slideshow_opengl_shader \
)) ))
ifneq ($(ENABLE_PDFIMPORT),) ifneq ($(ENABLE_POPPLER),)
$(eval $(call gb_Helper_register_packages_for_install,pdfimport, \ $(eval $(call gb_Helper_register_packages_for_install,pdfimport, \
sdext_pdfimport_pdf \ sdext_pdfimport_pdf \
)) ))
......
...@@ -2780,6 +2780,8 @@ endef ...@@ -2780,6 +2780,8 @@ endef
endif # ENABLE_VALGRIND endif # ENABLE_VALGRIND
ifeq ($(ENABLE_POPPLER),TRUE)
ifneq ($(SYSTEM_POPPLER),) ifneq ($(SYSTEM_POPPLER),)
define gb_LinkTarget__use_poppler define gb_LinkTarget__use_poppler
...@@ -2829,6 +2831,8 @@ endef ...@@ -2829,6 +2831,8 @@ endef
endif # SYSTEM_POPPLER endif # SYSTEM_POPPLER
endif # ENABLE_POPPLER
ifneq ($(SYSTEM_CLUCENE),) ifneq ($(SYSTEM_CLUCENE),)
......
...@@ -164,6 +164,7 @@ export ENABLE_OPTIMIZED=@ENABLE_OPTIMIZED@ ...@@ -164,6 +164,7 @@ export ENABLE_OPTIMIZED=@ENABLE_OPTIMIZED@
export ENABLE_PCH=@ENABLE_PCH@ export ENABLE_PCH=@ENABLE_PCH@
export ENABLE_PDFIMPORT=@ENABLE_PDFIMPORT@ export ENABLE_PDFIMPORT=@ENABLE_PDFIMPORT@
export ENABLE_PDFIUM=@ENABLE_PDFIUM@ export ENABLE_PDFIUM=@ENABLE_PDFIUM@
export ENABLE_POPPLER=@ENABLE_POPPLER@
export ENABLE_QT5=@ENABLE_QT5@ export ENABLE_QT5=@ENABLE_QT5@
export ENABLE_KDE5=@ENABLE_KDE5@ export ENABLE_KDE5=@ENABLE_KDE5@
export ENABLE_GTK3_KDE5=@ENABLE_GTK3_KDE5@ export ENABLE_GTK3_KDE5=@ENABLE_GTK3_KDE5@
......
...@@ -158,6 +158,11 @@ ...@@ -158,6 +158,11 @@
*/ */
#define HAVE_FEATURE_PDFIUM 0 #define HAVE_FEATURE_PDFIUM 0
/*
* Whether poppler is available
*/
#define HAVE_FEATURE_POPPLER 0
/* /*
* Whether extra fonts are available * Whether extra fonts are available
*/ */
......
...@@ -1725,6 +1725,11 @@ AC_ARG_WITH(system-openldap, ...@@ -1725,6 +1725,11 @@ AC_ARG_WITH(system-openldap,
[Use the OpenLDAP LDAP SDK already on system.]),, [Use the OpenLDAP LDAP SDK already on system.]),,
[with_system_openldap="$with_system_libs"]) [with_system_openldap="$with_system_libs"])
libo_FUZZ_ARG_ENABLE(poppler,
AS_HELP_STRING([--disable-poppler],
[Disable building Poppler.])
)
AC_ARG_WITH(system-poppler, AC_ARG_WITH(system-poppler,
AS_HELP_STRING([--with-system-poppler], AS_HELP_STRING([--with-system-poppler],
[Use system poppler (only needed for PDF import).]),, [Use system poppler (only needed for PDF import).]),,
...@@ -10644,6 +10649,33 @@ AC_SUBST([DCONF_CFLAGS]) ...@@ -10644,6 +10649,33 @@ AC_SUBST([DCONF_CFLAGS])
AC_SUBST([DCONF_LIBS]) AC_SUBST([DCONF_LIBS])
AC_SUBST([ENABLE_DCONF]) 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? # pdf import?
AC_MSG_CHECKING([whether to build the PDF import feature]) AC_MSG_CHECKING([whether to build the PDF import feature])
ENABLE_PDFIMPORT= ENABLE_PDFIMPORT=
...@@ -10651,7 +10683,11 @@ if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_ ...@@ -10651,7 +10683,11 @@ if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
ENABLE_PDFIMPORT=TRUE ENABLE_PDFIMPORT=TRUE
AC_DEFINE(HAVE_FEATURE_PDFIMPORT) AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
else
AC_MSG_RESULT([no])
fi
if test $ENABLE_PDFIMPORT == TRUE -a $ENABLE_POPPLER == TRUE; then
dnl =================================================================== dnl ===================================================================
dnl Check for system poppler dnl Check for system poppler
dnl =================================================================== dnl ===================================================================
...@@ -10682,27 +10718,12 @@ if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_ ...@@ -10682,27 +10718,12 @@ if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_
AC_DEFINE([HAVE_POPPLER_VERSION_H], 1) AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
fi fi
AC_DEFINE([ENABLE_PDFIMPORT],1) AC_DEFINE([ENABLE_PDFIMPORT],1)
else
AC_MSG_RESULT([no])
fi fi
AC_SUBST(ENABLE_PDFIMPORT) AC_SUBST(ENABLE_PDFIMPORT)
AC_SUBST(SYSTEM_POPPLER) AC_SUBST(SYSTEM_POPPLER)
AC_SUBST(POPPLER_CFLAGS) AC_SUBST(POPPLER_CFLAGS)
AC_SUBST(POPPLER_LIBS) 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= SYSTEM_GPGMEPP=
if test "$build_for_ios" = "YES"; then if test "$build_for_ios" = "YES"; then
......
...@@ -89,7 +89,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_activex_controls_tests,\ ...@@ -89,7 +89,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_activex_controls_tests,\
sd/util/sd \ sd/util/sd \
sd/util/sdfilt \ sd/util/sdfilt \
sd/util/sdd \ sd/util/sdd \
$(if $(ENABLE_PDFIMPORT),sdext/source/pdfimport/pdfimport) \ $(if $(ENABLE_POPPLER),sdext/source/pdfimport/pdfimport) \
sfx2/util/sfx \ sfx2/util/sfx \
sot/util/sot \ sot/util/sot \
svl/source/fsstor/fsstorage \ svl/source/fsstor/fsstorage \
......
...@@ -93,7 +93,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\ ...@@ -93,7 +93,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_import_tests,\
sd/util/sd \ sd/util/sd \
sd/util/sdfilt \ sd/util/sdfilt \
sd/util/sdd \ sd/util/sdd \
$(if $(ENABLE_PDFIMPORT),sdext/source/pdfimport/pdfimport) \ $(if $(ENABLE_POPPLER),sdext/source/pdfimport/pdfimport) \
sfx2/util/sfx \ sfx2/util/sfx \
sot/util/sot \ sot/util/sot \
svl/source/fsstor/fsstorage \ svl/source/fsstor/fsstorage \
...@@ -122,7 +122,7 @@ $(eval $(call gb_CppunitTest_use_packages,sd_import_tests,\ ...@@ -122,7 +122,7 @@ $(eval $(call gb_CppunitTest_use_packages,sd_import_tests,\
oox_customshapes \ oox_customshapes \
)) ))
ifneq ($(ENABLE_PDFIMPORT),) ifneq ($(ENABLE_POPPLER),)
$(eval $(call gb_CppunitTest_use_executable,sd_import_tests,xpdfimport)) $(eval $(call gb_CppunitTest_use_executable,sd_import_tests,xpdfimport))
endif endif
......
...@@ -20,10 +20,15 @@ $(eval $(call gb_Module_add_targets,sdext,\ ...@@ -20,10 +20,15 @@ $(eval $(call gb_Module_add_targets,sdext,\
ifeq ($(ENABLE_PDFIMPORT),TRUE) ifeq ($(ENABLE_PDFIMPORT),TRUE)
$(eval $(call gb_Module_add_targets,sdext,\ $(eval $(call gb_Module_add_targets,sdext,\
CustomTarget_pdfimport \ CustomTarget_pdfimport \
Executable_xpdfimport \
Library_pdfimport \ Library_pdfimport \
))
ifeq ($(ENABLE_POPPLER),TRUE)
$(eval $(call gb_Module_add_targets,sdext,\
Executable_xpdfimport \
Package_pdfimport_xpdfimport \ Package_pdfimport_xpdfimport \
)) ))
endif
$(eval $(call gb_Module_add_check_targets,sdext,\ $(eval $(call gb_Module_add_check_targets,sdext,\
CppunitTest_sdext_pdfimport \ CppunitTest_sdext_pdfimport \
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <config_features.h>
#include <zlib.h> #include <zlib.h>
#include "outputwrap.hxx" #include "outputwrap.hxx"
...@@ -453,6 +454,7 @@ namespace ...@@ -453,6 +454,7 @@ namespace
public: public:
void testXPDFParser() void testXPDFParser()
{ {
#if HAVE_FEATURE_POPPLER
std::shared_ptr<TestSink> pSink( new TestSink() ); std::shared_ptr<TestSink> pSink( new TestSink() );
CPPUNIT_ASSERT( CPPUNIT_ASSERT(
pdfi::xpdf_ImportFromFile( pdfi::xpdf_ImportFromFile(
...@@ -462,10 +464,12 @@ namespace ...@@ -462,10 +464,12 @@ namespace
OUString(), OUString(),
getComponentContext(), "" ) ); getComponentContext(), "" ) );
pSink->check(); pSink->check();
#endif
} }
void testOdfDrawExport() void testOdfDrawExport()
{ {
#if HAVE_FEATURE_POPPLER
rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) ); rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) );
xAdaptor->setTreeVisitorFactory( createDrawTreeVisitorFactory() ); xAdaptor->setTreeVisitorFactory( createDrawTreeVisitorFactory() );
...@@ -477,10 +481,12 @@ namespace ...@@ -477,10 +481,12 @@ namespace
new OutputWrap(tempFileURL), new OutputWrap(tempFileURL),
nullptr )); nullptr ));
osl::File::remove( tempFileURL ); osl::File::remove( tempFileURL );
#endif
} }
void testOdfWriterExport() void testOdfWriterExport()
{ {
#if HAVE_FEATURE_POPPLER
rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) ); rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) );
xAdaptor->setTreeVisitorFactory( createWriterTreeVisitorFactory() ); xAdaptor->setTreeVisitorFactory( createWriterTreeVisitorFactory() );
...@@ -492,10 +498,12 @@ namespace ...@@ -492,10 +498,12 @@ namespace
new OutputWrap(tempFileURL), new OutputWrap(tempFileURL),
nullptr )); nullptr ));
osl::File::remove( tempFileURL ); osl::File::remove( tempFileURL );
#endif
} }
void testTdf96993() void testTdf96993()
{ {
#if HAVE_FEATURE_POPPLER
rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory()); xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
...@@ -506,10 +514,12 @@ namespace ...@@ -506,10 +514,12 @@ namespace
nullptr)); nullptr));
// This ensures that the imported image arrives properly flipped // 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); CPPUNIT_ASSERT(aOutput.indexOf("draw:transform=\"matrix(18520.8333333333 0 0 26281.9444444444 0 0)\"") != -1);
#endif
} }
void testTdf98421() void testTdf98421()
{ {
#if HAVE_FEATURE_POPPLER
rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory()); xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
...@@ -521,10 +531,12 @@ namespace ...@@ -521,10 +531,12 @@ namespace
// This ensures that the imported image arrives properly flipped // 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("draw:transform=\"scale( 1.0 -1.0 ) translate( 0mm 0mm )\"") != -1);
CPPUNIT_ASSERT(aOutput.indexOf("svg:height=\"-262.82mm\"") != -1); CPPUNIT_ASSERT(aOutput.indexOf("svg:height=\"-262.82mm\"") != -1);
#endif
} }
void testTdf105536() void testTdf105536()
{ {
#if HAVE_FEATURE_POPPLER
rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext())); rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory()); xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
...@@ -535,6 +547,7 @@ namespace ...@@ -535,6 +547,7 @@ namespace
nullptr)); nullptr));
// This ensures that the imported image arrives properly flipped // 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); CPPUNIT_ASSERT(aOutput.indexOf("draw:transform=\"matrix(-21488.4 0 0 -27978.1 21488.4 27978.1)\"") != -1);
#endif
} }
CPPUNIT_TEST_SUITE(PDFITest); CPPUNIT_TEST_SUITE(PDFITest);
......
...@@ -721,11 +721,21 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed ) ...@@ -721,11 +721,21 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
{ {
// Experimental PDF importing using PDFium. This is currently enabled for LOK only and // Experimental PDF importing using PDFium. This is currently enabled for LOK only and
// we handle it not via XmlFilterAdaptor but a new SdPdfFiler. // we handle it not via XmlFilterAdaptor but a new SdPdfFiler.
const bool bPdfiumImport = (comphelper::LibreOfficeKit::isActive() || getenv("LO_IMPORT_USE_PDFIUM")) && pMedium->GetFilter() && #if !HAVE_FEATURE_POPPLER
(pMedium->GetFilter()->GetFilterName() == "draw_pdf_import"); 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->nLoadedFlags = SfxLoadedFlags::NONE;
pImpl->bModelInitialized = false; 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 ); uno::Reference < beans::XPropertySet > xSet( GetModel(), uno::UNO_QUERY );
const OUString sLockUpdates("LockUpdates"); const OUString sLockUpdates("LockUpdates");
......
...@@ -48,7 +48,7 @@ $(eval $(call gb_CppunitTest_use_rdb,xmlsecurity_pdfsigning,services)) ...@@ -48,7 +48,7 @@ $(eval $(call gb_CppunitTest_use_rdb,xmlsecurity_pdfsigning,services))
$(eval $(call gb_CppunitTest_use_configuration,xmlsecurity_pdfsigning)) $(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)) $(eval $(call gb_CppunitTest_use_executable,xmlsecurity_pdfsigning,xpdfimport))
endif endif
......
...@@ -48,7 +48,7 @@ $(eval $(call gb_CppunitTest_use_rdb,xmlsecurity_signing,services)) ...@@ -48,7 +48,7 @@ $(eval $(call gb_CppunitTest_use_rdb,xmlsecurity_signing,services))
$(eval $(call gb_CppunitTest_use_configuration,xmlsecurity_signing)) $(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)) $(eval $(call gb_CppunitTest_use_executable,xmlsecurity_signing,xpdfimport))
endif endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment