summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2023-05-03 07:15:03 +0200
committerMichal Klocek <michal.klocek@qt.io>2023-05-05 13:22:59 +0000
commit95e07600c1df512543c82e6e6070e6c1447df91e (patch)
treed68ec7e329e29f6292af083607462974cbb1f08f
parentdbb0d0bdcf58d44531e0039d692c8c37ad3061ff (diff)
downloadqtwebengine-chromium-95e07600c1df512543c82e6e6070e6c1447df91e.tar.gz
Add pdfium_use_system_libtiff build option
This change is based on: https://pdfium-review.googlesource.com/c/pdfium/+/105650 Compared to original change it is however fixed to really use system headers and not just compile against embedded tiff library headers and link to system libtiff. Note that pdfium/thirdparty/tiffiop.h is a private header which is not going to be present as system include, therefore fix implementation to use public header instead tiffio.h Task-number: QTBUG-111626 Change-Id: I21ac717361c7fc43c1ab2b5158d758b766026c64 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/475877 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/BUILD.gn2
-rw-r--r--chromium/third_party/pdfium/core/fxcodec/tiff/tiff_decoder.cpp8
-rw-r--r--chromium/third_party/pdfium/pdfium.gni3
-rw-r--r--chromium/third_party/pdfium/third_party/BUILD.gn117
4 files changed, 76 insertions, 54 deletions
diff --git a/chromium/third_party/pdfium/core/fxcodec/BUILD.gn b/chromium/third_party/pdfium/core/fxcodec/BUILD.gn
index 9f263313508..3027621e820 100644
--- a/chromium/third_party/pdfium/core/fxcodec/BUILD.gn
+++ b/chromium/third_party/pdfium/core/fxcodec/BUILD.gn
@@ -130,7 +130,7 @@ source_set("fxcodec") {
"tiff/tiff_decoder.cpp",
"tiff/tiff_decoder.h",
]
- deps += [ "../../third_party:fx_tiff" ]
+ deps += [ "../../third_party:tiff" ]
}
}
diff --git a/chromium/third_party/pdfium/core/fxcodec/tiff/tiff_decoder.cpp b/chromium/third_party/pdfium/core/fxcodec/tiff/tiff_decoder.cpp
index e4dc603b9d3..808a4c71cc0 100644
--- a/chromium/third_party/pdfium/core/fxcodec/tiff/tiff_decoder.cpp
+++ b/chromium/third_party/pdfium/core/fxcodec/tiff/tiff_decoder.cpp
@@ -23,7 +23,11 @@
#include "third_party/base/numerics/safe_conversions.h"
extern "C" {
-#include "third_party/libtiff/tiffiop.h"
+#ifdef USE_SYSTEM_LIBTIFF
+#include <tiffio.h>
+#else
+#include "third_party/libtiff/tiffio.h"
+#endif
} // extern C
namespace {
@@ -190,7 +194,7 @@ TIFF* tiff_open(void* context, const char* mode) {
tiff_write, tiff_seek, tiff_close, tiff_get_size,
tiff_map, tiff_unmap);
if (tif) {
- tif->tif_fd = (int)(intptr_t)context;
+ TIFFSetFileno(tif, (int)(intptr_t)context);
}
return tif;
}
diff --git a/chromium/third_party/pdfium/pdfium.gni b/chromium/third_party/pdfium/pdfium.gni
index e32464744d3..4a0b86ec5cf 100644
--- a/chromium/third_party/pdfium/pdfium.gni
+++ b/chromium/third_party/pdfium/pdfium.gni
@@ -69,6 +69,9 @@ declare_args() {
# Don't build against bundled libpng.
pdfium_use_system_libpng = false
+ # Don't build against bundled libtiff
+ pdfium_use_system_libtiff = false
+
# Enable SSE2 for MSVC builds. Ignored if it's not a MSVC build.
msvc_use_sse2 = true
diff --git a/chromium/third_party/pdfium/third_party/BUILD.gn b/chromium/third_party/pdfium/third_party/BUILD.gn
index 57bd69e2068..5695e271214 100644
--- a/chromium/third_party/pdfium/third_party/BUILD.gn
+++ b/chromium/third_party/pdfium/third_party/BUILD.gn
@@ -520,58 +520,73 @@ source_set("fx_lpng") {
}
if (pdf_enable_xfa_tiff) {
- source_set("fx_tiff") {
- configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [
- "//build/config/compiler:no_chromium_code",
- ":pdfium_third_party_config",
- ]
- if (is_win) {
- # Need to undefine the macro since it is redefined in tif_jpeg.c.
- configs -= [ "//build/config/win:lean_and_mean" ]
+ if (pdfium_use_system_libtiff) {
+ config("system_tiff_config") {
+ defines = [ "USE_SYSTEM_LIBTIFF" ]
+ libs = [ "tiff" ]
+ }
+ } else {
+ source_set("fx_tiff") {
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+ ":pdfium_third_party_config",
+ ]
+ if (is_win) {
+ # Need to undefine the macro since it is redefined in tif_jpeg.c.
+ configs -= [ "//build/config/win:lean_and_mean" ]
+ }
+ deps = [
+ ":zlib",
+ "../core/fxcrt",
+ "//third_party:jpeg",
+ ]
+ sources = [
+ "libtiff/tif_aux.c",
+ "libtiff/tif_close.c",
+ "libtiff/tif_codec.c",
+ "libtiff/tif_color.c",
+ "libtiff/tif_compress.c",
+ "libtiff/tif_dir.c",
+ "libtiff/tif_dirinfo.c",
+ "libtiff/tif_dirread.c",
+ "libtiff/tif_dirwrite.c",
+ "libtiff/tif_dumpmode.c",
+ "libtiff/tif_error.c",
+ "libtiff/tif_extension.c",
+ "libtiff/tif_fax3.c",
+ "libtiff/tif_fax3sm.c",
+ "libtiff/tif_flush.c",
+ "libtiff/tif_getimage.c",
+ "libtiff/tif_jpeg.c",
+ "libtiff/tif_luv.c",
+ "libtiff/tif_lzw.c",
+ "libtiff/tif_next.c",
+ "libtiff/tif_open.c",
+ "libtiff/tif_packbits.c",
+ "libtiff/tif_pixarlog.c",
+ "libtiff/tif_predict.c",
+ "libtiff/tif_print.c",
+ "libtiff/tif_read.c",
+ "libtiff/tif_strip.c",
+ "libtiff/tif_swab.c",
+ "libtiff/tif_thunder.c",
+ "libtiff/tif_tile.c",
+ "libtiff/tif_version.c",
+ "libtiff/tif_warning.c",
+ "libtiff/tif_write.c",
+ "libtiff/tiffiop.h",
+ "libtiff/tiffvers.h",
+ ]
+ }
+ }
+
+ group("tiff") {
+ if (pdfium_use_system_libtiff) {
+ public_configs = [ ":system_tiff_config" ]
+ } else {
+ public_deps = [ ":fx_tiff" ]
}
- deps = [
- ":zlib",
- "../core/fxcrt",
- "//third_party:jpeg",
- ]
- sources = [
- "libtiff/tif_aux.c",
- "libtiff/tif_close.c",
- "libtiff/tif_codec.c",
- "libtiff/tif_color.c",
- "libtiff/tif_compress.c",
- "libtiff/tif_dir.c",
- "libtiff/tif_dirinfo.c",
- "libtiff/tif_dirread.c",
- "libtiff/tif_dirwrite.c",
- "libtiff/tif_dumpmode.c",
- "libtiff/tif_error.c",
- "libtiff/tif_extension.c",
- "libtiff/tif_fax3.c",
- "libtiff/tif_fax3sm.c",
- "libtiff/tif_flush.c",
- "libtiff/tif_getimage.c",
- "libtiff/tif_jpeg.c",
- "libtiff/tif_luv.c",
- "libtiff/tif_lzw.c",
- "libtiff/tif_next.c",
- "libtiff/tif_open.c",
- "libtiff/tif_packbits.c",
- "libtiff/tif_pixarlog.c",
- "libtiff/tif_predict.c",
- "libtiff/tif_print.c",
- "libtiff/tif_read.c",
- "libtiff/tif_strip.c",
- "libtiff/tif_swab.c",
- "libtiff/tif_thunder.c",
- "libtiff/tif_tile.c",
- "libtiff/tif_version.c",
- "libtiff/tif_warning.c",
- "libtiff/tif_write.c",
- "libtiff/tiffiop.h",
- "libtiff/tiffvers.h",
- ]
}
}