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, \
))
endif
ifneq ($(ENABLE_PDFIMPORT),)
ifneq ($(ENABLE_POPPLER),)
$(eval $(call gb_Helper_register_executables_for_install,OOO,pdfimport, \
xpdfimport \
))
......@@ -1004,7 +1004,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 \
))
......
......@@ -2780,6 +2780,8 @@ endef
endif # ENABLE_VALGRIND
ifeq ($(ENABLE_POPPLER),TRUE)
ifneq ($(SYSTEM_POPPLER),)
define gb_LinkTarget__use_poppler
......@@ -2829,6 +2831,8 @@ endef
endif # SYSTEM_POPPLER
endif # ENABLE_POPPLER
ifneq ($(SYSTEM_CLUCENE),)
......
......@@ -164,6 +164,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_KDE5=@ENABLE_KDE5@
export ENABLE_GTK3_KDE5=@ENABLE_GTK3_KDE5@
......
......@@ -158,6 +158,11 @@
*/
#define HAVE_FEATURE_PDFIUM 0
/*
* Whether poppler is available
*/
#define HAVE_FEATURE_POPPLER 0
/*
* Whether extra fonts are available
*/
......
......@@ -1725,6 +1725,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).]),,
......@@ -10644,6 +10649,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=
......@@ -10651,7 +10683,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 ===================================================================
......@@ -10682,27 +10718,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
......
......@@ -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 \
......
......@@ -93,7 +93,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 \
......@@ -122,7 +122,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
......
......@@ -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 \
......
......@@ -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"
......@@ -453,6 +454,7 @@ namespace
public:
void testXPDFParser()
{
#if HAVE_FEATURE_POPPLER
std::shared_ptr<TestSink> pSink( new TestSink() );
CPPUNIT_ASSERT(
pdfi::xpdf_ImportFromFile(
......@@ -462,10 +464,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() );
......@@ -477,10 +481,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() );
......@@ -492,10 +498,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());
......@@ -506,10 +514,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());
......@@ -521,10 +531,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());
......@@ -535,6 +547,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);
......
......@@ -721,11 +721,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");
......
......@@ -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
......
......@@ -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
......
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