CMakeLists.txt | 19 ++++++++++++++----- config.h.cmake | 3 +++ configure.ac | 20 +++++++++++++++++++- poppler/Form.cc | 7 ++++++- poppler/Makefile.am | 28 ++++++++++++++++++++++------ utils/CMakeLists.txt | 16 +++++++++------- utils/Makefile.am | 5 ++++- 7 files changed, 77 insertions(+), 21 deletions(-)
New commits: commit 5570c70a20ae62a9b3341372fafc64e916774adb Author: André Guerreiro <[email protected]> Date: Mon Oct 5 16:50:30 2015 +0200 NSS conditional build diff --git a/CMakeLists.txt b/CMakeLists.txt index ce16d53..ca71630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,7 @@ endif(WITH_FONTCONFIGURATION_FONTCONFIG) macro_optional_find_package(JPEG) macro_optional_find_package(PNG) macro_optional_find_package(TIFF) -find_package(NSS3 REQUIRED) +macro_optional_find_package(NSS3) if(JPEG_FOUND) set(ENABLE_LIBJPEG ${JPEG_FOUND}) endif(JPEG_FOUND) @@ -203,8 +203,6 @@ if(ENABLE_LIBCURL) set(POPPLER_HAS_CURL_SUPPORT ON) endif(ENABLE_LIBCURL) -add_definitions(${NSS3_CFLAGS}) - add_definitions(-DHAVE_CONFIG_H=1) if(MINGW) # Use mingw's ansi stdio extensions @@ -237,6 +235,11 @@ endif(CMAKE_USE_PTHREADS_INIT) if(ENABLE_ZLIB) include_directories(${ZLIB_INCLUDE_DIR}) endif(ENABLE_ZLIB) + +if (NSS3_FOUND) + add_definitions(${NSS3_CFLAGS}) + set(ENABLE_NSS3 ON) +endif(NSS3_FOUND) if(JPEG_FOUND) include_directories(${JPEG_INCLUDE_DIR}) set(ENABLE_LIBJPEG ON) @@ -367,7 +370,6 @@ set(poppler_SRCS poppler/ProfileData.cc poppler/PreScanOutputDev.cc poppler/PSTokenizer.cc - poppler/SignatureHandler.cc poppler/SignatureInfo.cc poppler/Stream.cc poppler/StructTreeRoot.cc @@ -417,7 +419,7 @@ endif(ENABLE_SPLASH) if(FONTCONFIG_FOUND) set(poppler_LIBS ${poppler_LIBS} ${FONTCONFIG_LIBRARIES}) endif(FONTCONFIG_FOUND) -set(poppler_LIBS ${poppler_LIBS} ${NSS3_LIBRARIES}) + if(JPEG_FOUND) set(poppler_SRCS ${poppler_SRCS} poppler/DCTStream.cc @@ -437,6 +439,12 @@ if(ENABLE_LIBCURL) ) set(poppler_LIBS ${poppler_LIBS} ${CURL_LIBRARIES}) endif(ENABLE_LIBCURL) +if (ENABLE_NSS3) + set(poppler_SRCS ${poppler_SRCS} + poppler/SignatureHandler.cc + ) + set(poppler_LIBS ${poppler_LIBS} ${NSS3_LIBRARIES}) +endif(ENABLE_NSS3) if(LIBOPENJPEG_FOUND) set(poppler_SRCS ${poppler_SRCS} poppler/JPEG2000Stream.cc @@ -725,6 +733,7 @@ show_end_message_yesno("use libjpeg" ENABLE_LIBJPEG) show_end_message_yesno("use libpng" ENABLE_LIBPNG) show_end_message_yesno("use libtiff" ENABLE_LIBTIFF) show_end_message_yesno("use zlib" ENABLE_ZLIB) +show_end_message_yesno("use nss3" ENABLE_NSS3) show_end_message_yesno("use curl" ENABLE_LIBCURL) show_end_message_yesno("use libopenjpeg" WITH_OPENJPEG) if(USE_OPENJPEG1) diff --git a/config.h.cmake b/config.h.cmake index 400b16b..b62994f 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -21,6 +21,9 @@ /* Use zlib instead of builtin zlib decoder. */ #cmakedefine ENABLE_ZLIB 1 +/* Build against libnss3 for digital signature validation */ +#cmakedefine ENABLE_NSS3 1 + /* Use cairo for rendering. */ #cmakedefine HAVE_CAIRO 1 diff --git a/configure.ac b/configure.ac index 741001d..da18b23 100644 --- a/configure.ac +++ b/configure.ac @@ -264,12 +264,29 @@ else enable_libopenjpeg=no fi -PKG_CHECK_MODULES(NSS3, nss, [], []) +dnl Test for NSS +AC_ARG_ENABLE(libnss, + AC_HELP_STRING([--disable-nss], + [Do not build against libnss3.]), + enable_libnss=$enableval, + enable_libnss="try") + +if test x$enable_libnss != xno; then + PKG_CHECK_MODULES(NSS3, nss, [enable_nss="yes"], + [enable_nss="no"]) +fi + +if test x$enable_nss = xyes; then + AC_DEFINE(ENABLE_NSS3, 1, [Build against NSS.]) +fi AM_CONDITIONAL(BUILD_LIBOPENJPEG, test x$openjpeg1 = xyes || test x$openjpeg2 = xyes) AH_TEMPLATE([ENABLE_LIBOPENJPEG], [Use libopenjpeg instead of builtin jpeg2000 decoder.]) +AM_CONDITIONAL(BUILD_NSS, test x$enable_nss = xyes) +AH_TEMPLATE([ENABLE_NSS3], [Build Poppler against NSS for digital signature support.]) + dnl ##### Test for libtiff AC_ARG_ENABLE(libtiff, AC_HELP_STRING([--disable-libtiff], @@ -1007,6 +1024,7 @@ echo " use libjpeg: $enable_libjpeg" echo " use libpng: $enable_libpng" echo " use libtiff: $enable_libtiff" echo " use zlib: $enable_zlib" +echo " use nss $enable_nss" echo " use libcurl: $enable_libcurl" echo " use libopenjpeg: $enable_libopenjpeg" if test x$enable_libopenjpeg = xyes;then diff --git a/poppler/Form.cc b/poppler/Form.cc index a2fd0cf..42ef2c1 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc @@ -39,7 +39,10 @@ #include "Form.h" #include "PDFDoc.h" #include "DateInfo.h" +#ifdef ENABLE_NSS3 #include "SignatureHandler.h" +#endif +#include "SignatureInfo.h" #include "XRef.h" #include "PDFDocEncoding.h" #include "Annot.h" @@ -1380,6 +1383,7 @@ FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& re : FormField(docA, dict, ref, parent, usedParents, formSignature) { signature = NULL; + signature_info = new SignatureInfo(); parseInfo(); } @@ -1433,7 +1437,7 @@ void FormFieldSignature::parseInfo() SignatureInfo *FormFieldSignature::validateSignature(bool doVerifyCert, bool forceRevalidation) { - +#ifdef ENABLE_NSS3 if (!signature_info->isSubfilterSupported()) { error(errUnimplemented, 0, "Unable to validate this type of signature"); return signature_info; @@ -1498,6 +1502,7 @@ SignatureInfo *FormFieldSignature::validateSignature(bool doVerifyCert, bool for cert_val_state = signature_handler.validateCertificate(); signature_info->setCertificateValStatus(SignatureHandler::NSS_CertTranslate(cert_val_state)); +#endif return signature_info; } diff --git a/poppler/Makefile.am b/poppler/Makefile.am index 2d8c5e6..1b6500f 100644 --- a/poppler/Makefile.am +++ b/poppler/Makefile.am @@ -78,6 +78,22 @@ libjpeg2000_sources = \ endif +if BUILD_NSS + +nss_sources = \ + SignatureHandler.cc + +nss_libs = \ + $(NSS3_LIBS) + +nss_includes = \ + $(NSS3_CFLAGS) + +nss_headers = + SignatureHandler.h + +endif + if BUILD_ZLIB @@ -119,6 +135,7 @@ poppler_includedir = $(includedir)/poppler poppler_include_HEADERS = \ $(splash_headers) \ $(curl_headers) \ + $(nss_headers) \ Annot.h \ Array.h \ BuiltinFont.h \ @@ -166,8 +183,7 @@ poppler_include_HEADERS = \ PreScanOutputDev.h \ PSTokenizer.h \ Rendition.h \ - SignatureHandler.h \ - SignatureInfo.h \ + SignatureInfo.h \ StdinCachedFile.h \ StdinPDFDocBuilder.h \ Stream-CCITT.h \ @@ -202,6 +218,7 @@ libpoppler_la_SOURCES = \ $(splash_sources) \ $(libjpeg_sources) \ $(zlib_sources) \ + $(nss_sources) \ $(libjpeg2000_sources) \ $(curl_sources) \ Annot.cc \ @@ -249,8 +266,7 @@ libpoppler_la_SOURCES = \ PreScanOutputDev.cc \ PSTokenizer.cc \ Rendition.cc \ - SignatureHandler.cc \ - SignatureInfo.cc \ + SignatureInfo.cc \ StdinCachedFile.cc \ StdinPDFDocBuilder.cc \ Stream.cc \ @@ -279,7 +295,7 @@ libpoppler_la_CPPFLAGS = \ $(libjpeg2000_includes) \ $(libpng_includes) \ $(libcurl_includes) \ - $(NSS3_CFLAGS) \ + $(nss_includes) \ $(FREETYPE_CFLAGS) \ $(FONTCONFIG_CFLAGS) \ $(AM_CPPFLAGS) @@ -294,8 +310,8 @@ libpoppler_la_LIBADD = \ $(libpng_libs) \ $(zlib_libs) \ $(libcurl_libs) \ + $(nss_libs) \ $(libjpeg2000_libs) \ - $(NSS3_LIBS) \ $(FREETYPE_LIBS) \ $(FONTCONFIG_LIBS) \ $(PTHREAD_LIBS) \ diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index ea56bd2..8155cb2 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -89,13 +89,15 @@ target_link_libraries(pdfinfo ${common_libs}) install(TARGETS pdfinfo DESTINATION bin) install(FILES pdfinfo.1 DESTINATION ${SHARE_INSTALL_DIR}/man/man1) -# pdfsigverify -set(pdfsigverify_SOURCES ${common_srcs} - pdfsigverify.cc -) -add_executable(pdfsigverify ${pdfsigverify_SOURCES}) -target_link_libraries(pdfsigverify ${common_libs}) -install(TARGETS pdfsigverify DESTINATION bin) +if (ENABLE_NSS3) + # pdfsigverify + set(pdfsigverify_SOURCES ${common_srcs} + pdfsigverify.cc + ) + add_executable(pdfsigverify ${pdfsigverify_SOURCES}) + target_link_libraries(pdfsigverify ${common_libs}) + install(TARGETS pdfsigverify DESTINATION bin) +endif (ENABLE_NSS3) # pdftops set(pdftops_SOURCES ${common_srcs} diff --git a/utils/Makefile.am b/utils/Makefile.am index 318cfb6..2ddcca0 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -23,9 +23,12 @@ bin_PROGRAMS = \ pdftotext \ pdftohtml \ pdfseparate \ - pdfsigverify \ pdfunite +if BUILD_NSS +bin_PROGRAMS += pdfsigverify +endif + if BUILD_SPLASH_OUTPUT bin_PROGRAMS += pdftoppm endif
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
