summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-04-13 10:09:06 +0200
committerChromium commit bot <commit-bot@chromium.org>2017-04-13 09:13:44 +0000
commit36c5b170e722362d4b5f7cb6e4e0099ed227a307 (patch)
tree18a2a9ecec3ce38bf50d84397e5c48877cea90f5
parente0b592236db902e3e8cbca7ec64f8e2b192e1935 (diff)
downloadpdfium-36c5b170e722362d4b5f7cb6e4e0099ed227a307.tar.xz
core: allow building against system zlib
In a way similar to the existing USE_SYSTEM_LIBJPEG. The default is of course still the DEPS-based zlib checkout. Change-Id: I649e75beb1a19c4cf7abda42fa10ebe5babfe946 Reviewed-on: https://pdfium-review.googlesource.com/4070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--AUTHORS1
-rw-r--r--BUILD.gn2
-rw-r--r--core/fxcodec/codec/fx_codec_flate.cpp5
-rw-r--r--skia/BUILD.gn2
-rw-r--r--third_party/BUILD.gn21
5 files changed, 27 insertions, 4 deletions
diff --git a/AUTHORS b/AUTHORS
index 6c2a295990..7499c1094c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -36,6 +36,7 @@ Robert Sesek <rsesek@chromium.org>
Sam Clegg <sbc@chromium.org>
Thomas Sepez <tsepez@chromium.org>
+Collabora Ltd. <*@collabora.co.uk>
DocsCorp Pty Ltd. <*@docscorp.com>
Foxit Software Inc <*@foxitsoftware.com>
Google Inc. <*@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 1d8f3530ec..77bdeb5e77 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -703,7 +703,7 @@ static_library("fxcodec") {
"third_party:fx_lcms2",
"third_party:fx_libopenjpeg",
"//third_party:jpeg",
- "//third_party/zlib:zlib",
+ "//third_party:zlib",
]
if (pdf_enable_xfa) {
diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp
index ef78248217..3747b20cc3 100644
--- a/core/fxcodec/codec/fx_codec_flate.cpp
+++ b/core/fxcodec/codec/fx_codec_flate.cpp
@@ -15,7 +15,12 @@
#include "core/fxcrt/fx_ext.h"
#include "third_party/base/numerics/safe_conversions.h"
#include "third_party/base/ptr_util.h"
+
+#if defined(USE_SYSTEM_ZLIB)
+#include <zlib.h>
+#else
#include "third_party/zlib/zlib.h"
+#endif
extern "C" {
diff --git a/skia/BUILD.gn b/skia/BUILD.gn
index 31a851d576..a129ef9d59 100644
--- a/skia/BUILD.gn
+++ b/skia/BUILD.gn
@@ -317,7 +317,7 @@ component("skia") {
deps = [
":skia_opts",
"//:freetype_common",
- "//third_party/zlib:zlib",
+ "//third_party:zlib",
]
if (is_linux) {
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index c270a1063a..17c9c22832 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -288,6 +288,8 @@ if (!build_with_chromium) {
# Uses libjpeg_turbo as the jpeg implementation. Has no effect if
# use_system_libjpeg is set.
use_libjpeg_turbo = true
+
+ use_system_zlib = false
}
config("system_libjpeg_config") {
@@ -316,6 +318,21 @@ if (!build_with_chromium) {
]
}
}
+
+ config("system_zlib_config") {
+ libs = [ "z" ]
+ defines = [ "USE_SYSTEM_ZLIB" ]
+ }
+
+ group("zlib") {
+ if (use_system_zlib) {
+ public_configs = [ ":system_zlib_config" ]
+ } else {
+ public_deps = [
+ "//third_party/zlib",
+ ]
+ }
+ }
}
config("fx_libopenjpeg_warnings") {
@@ -395,7 +412,7 @@ static_library("fx_lpng") {
defines = []
cflags = []
deps = [
- "//third_party/zlib",
+ "//third_party:zlib",
]
if (current_cpu == "x86" || current_cpu == "x64") {
@@ -435,7 +452,7 @@ if (pdf_enable_xfa) {
}
deps = [
"//third_party:jpeg",
- "//third_party/zlib",
+ "//third_party:zlib",
]
sources = [
"libtiff/tif_aux.c",