summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-02-08 13:55:03 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-05-03 16:01:34 +0200
commit5b013a28e18ffceb6cc8a832aa3ff1a3a61e37ab (patch)
tree34f9131601ba6c856ebda15b0691e2f14085ad47
parent3dea2fa42d472b9263480dbbb3f195f0c998d761 (diff)
downloadqtwebengine-chromium-5b013a28e18ffceb6cc8a832aa3ff1a3a61e37ab.tar.gz
Unbundle Linux system libraries for GN
Adds unbundling on linux for the zlib, minizip, libpng, libwebp, libevent, libxml, libxslt and snappy libraries. Change-Id: I7bc8f418669a9908f0c1bc9393771e233f9f491a Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--chromium/base/third_party/libevent/BUILD.gn27
-rw-r--r--chromium/build/config/compiler/BUILD.gn2
-rw-r--r--chromium/build/shim_headers.gni2
-rw-r--r--chromium/third_party/libpng/BUILD.gn39
-rw-r--r--chromium/third_party/libwebp/BUILD.gn38
-rw-r--r--chromium/third_party/libxml/BUILD.gn25
-rw-r--r--chromium/third_party/libxslt/BUILD.gn20
-rw-r--r--chromium/third_party/snappy/BUILD.gn31
-rw-r--r--chromium/third_party/zlib/BUILD.gn63
9 files changed, 220 insertions, 27 deletions
diff --git a/chromium/base/third_party/libevent/BUILD.gn b/chromium/base/third_party/libevent/BUILD.gn
index e934454a10f..625dfea3b81 100644
--- a/chromium/base/third_party/libevent/BUILD.gn
+++ b/chromium/base/third_party/libevent/BUILD.gn
@@ -3,8 +3,13 @@
# found in the LICENSE file.
import("//build/config/nacl/config.gni")
+import("//build/shim_headers.gni")
-static_library("libevent") {
+declare_args() {
+ use_system_libevent = false
+}
+
+static_library("bundled_libevent") {
sources = [
"buffer.c",
"evbuffer.c",
@@ -78,3 +83,23 @@ static_library("libevent") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
+
+shim_headers("libevent_shim") {
+ root_path = "."
+ headers = [ "event.h" ]
+}
+
+source_set("system_libevent") {
+ deps = [
+ ":libevent_shim",
+ ]
+ libs = [ "event" ]
+}
+
+group("libevent") {
+ if (use_system_libevent) {
+ public_deps = [ ":system_libevent" ]
+ } else {
+ public_deps = [ ":bundled_libevent" ]
+ }
+}
diff --git a/chromium/build/config/compiler/BUILD.gn b/chromium/build/config/compiler/BUILD.gn
index d249b842128..2d2db0078d8 100644
--- a/chromium/build/config/compiler/BUILD.gn
+++ b/chromium/build/config/compiler/BUILD.gn
@@ -131,8 +131,8 @@ if (use_debug_fission == "default") {
# this and specify their own include paths.
config("default_include_dirs") {
include_dirs = [
- "//",
root_gen_dir,
+ "//",
]
}
diff --git a/chromium/build/shim_headers.gni b/chromium/build/shim_headers.gni
index a37bd4a1d8d..88f795b4160 100644
--- a/chromium/build/shim_headers.gni
+++ b/chromium/build/shim_headers.gni
@@ -5,7 +5,7 @@
template("shim_headers") {
action_name = "gen_${target_name}"
config_name = "${target_name}_config"
- shim_headers_path = "${root_gen_dir}/shim_headers/${target_name}"
+ shim_headers_path = "${root_gen_dir}"
config(config_name) {
include_dirs = [ shim_headers_path ]
diff --git a/chromium/third_party/libpng/BUILD.gn b/chromium/third_party/libpng/BUILD.gn
index 88a28cfaec2..b53bd668c54 100644
--- a/chromium/third_party/libpng/BUILD.gn
+++ b/chromium/third_party/libpng/BUILD.gn
@@ -5,6 +5,10 @@
import("//build/config/chromecast_build.gni")
import("//build/config/arm.gni")
+declare_args() {
+ use_system_libpng = false
+}
+
config("libpng_config") {
include_dirs = [ "." ]
@@ -101,16 +105,35 @@ source_set("libpng_sources") {
configs += [ ":clang_warnings" ]
}
-if (is_win) {
- component("libpng") {
- public_deps = [
- ":libpng_sources",
- ]
+if (!use_system_libpng) {
+ if (is_win) {
+ component("libpng") {
+ public_deps = [
+ ":libpng_sources",
+ ]
+ }
+ } else {
+ group("libpng") {
+ public_deps = [
+ ":libpng_sources",
+ ]
+ }
}
} else {
- group("libpng") {
- public_deps = [
- ":libpng_sources",
+ import("//build/config/linux/pkg_config.gni")
+ import("//build/shim_headers.gni")
+ pkg_config("system_libpng") {
+ packages = [ "libpng" ]
+ }
+ shim_headers("libpng_shim") {
+ root_path = "."
+ headers = [
+ "png.h",
+ "pngconf.h",
]
}
+ source_set("libpng") {
+ deps = [ ":libpng_shim" ]
+ public_configs = [ ":system_libpng" ]
+ }
}
diff --git a/chromium/third_party/libwebp/BUILD.gn b/chromium/third_party/libwebp/BUILD.gn
index 470bd2926c6..e478d3a206c 100644
--- a/chromium/third_party/libwebp/BUILD.gn
+++ b/chromium/third_party/libwebp/BUILD.gn
@@ -4,6 +4,11 @@
import("//build/config/arm.gni")
import("//build/config/sanitizers/sanitizers.gni")
+import("//build/config/linux/pkg_config.gni")
+
+declare_args() {
+ use_system_libwebp = false
+}
config("libwebp_config") {
include_dirs = [ "." ]
@@ -290,16 +295,27 @@ static_library("libwebp_utils") {
public_configs = [ ":libwebp_utils_warnings" ]
}
-group("libwebp") {
- deps = [
- ":libwebp_dec",
- ":libwebp_demux",
- ":libwebp_dsp",
- ":libwebp_enc",
- ":libwebp_utils",
- ]
- public_configs = [ ":libwebp_config" ]
- if (use_dsp_neon) {
- deps += [ ":libwebp_dsp_neon" ]
+if (!use_system_libwebp) {
+ group("libwebp") {
+ deps = [
+ ":libwebp_dec",
+ ":libwebp_demux",
+ ":libwebp_dsp",
+ ":libwebp_enc",
+ ":libwebp_utils",
+ ]
+ public_configs = [ ":libwebp_config" ]
+ if (use_dsp_neon) {
+ deps += [ ":libwebp_dsp_neon" ]
+ }
+ }
+}
+
+if (use_system_libwebp) {
+ pkg_config("system_libwebp") {
+ packages = [ "libwebp", "libwebpdemux" ]
+ }
+ group("libwebp") {
+ public_configs = [ ":system_libwebp" ]
}
}
diff --git a/chromium/third_party/libxml/BUILD.gn b/chromium/third_party/libxml/BUILD.gn
index 70b66ab53b3..383157ca896 100644
--- a/chromium/third_party/libxml/BUILD.gn
+++ b/chromium/third_party/libxml/BUILD.gn
@@ -12,6 +12,10 @@ if (is_linux || is_android || is_nacl) {
os_include = "win32"
}
+declare_args() {
+ use_system_libxml = false
+}
+
config("libxml_config") {
# Define LIBXML_STATIC as nothing to match how libxml.h (an internal header)
# defines LIBXML_STATIC, otherwise we get the macro redefined warning from
@@ -63,7 +67,7 @@ config("libxml_warnings") {
}
}
-static_library("libxml") {
+static_library("bundled_libxml") {
output_name = "libxml2"
sources = [
"chromium/libxml_utils.cc",
@@ -208,3 +212,22 @@ static_library("libxml") {
include_dirs = [ "$os_include" ]
}
+
+if (use_system_libxml) {
+ import("//build/config/linux/pkg_config.gni")
+ pkg_config("system_libxml") {
+ packages = [ "libxml-2.0" ]
+ }
+ source_set("libxml") {
+ sources = [
+ "chromium/libxml_utils.cc",
+ "chromium/libxml_utils.h",
+ ]
+
+ public_configs = [ ":system_libxml" ]
+ }
+} else {
+ group("libxml") {
+ public_deps = [ ":bundled_libxml" ]
+ }
+}
diff --git a/chromium/third_party/libxslt/BUILD.gn b/chromium/third_party/libxslt/BUILD.gn
index 6e8dcc980a2..7678d7f0c44 100644
--- a/chromium/third_party/libxslt/BUILD.gn
+++ b/chromium/third_party/libxslt/BUILD.gn
@@ -2,6 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+declare_args() {
+ use_system_libxslt = false
+}
+
config("libxslt_config") {
defines = [ "LIBXSLT_STATIC" ]
include_dirs = [ "." ]
@@ -20,7 +24,7 @@ config("libxslt_warnings") {
}
}
-static_library("libxslt") {
+static_library("bundled_libxslt") {
sources = [
"libxslt/attributes.c",
"libxslt/attributes.h",
@@ -101,3 +105,17 @@ static_library("libxslt") {
"//third_party/libxml",
]
}
+
+if (use_system_libxslt) {
+ import("//build/config/linux/pkg_config.gni")
+ pkg_config("system_libxslt") {
+ packages = [ "libxslt" ]
+ }
+ source_set("libxslt") {
+ public_configs = [ ":system_libxslt" ]
+ }
+} else {
+ group("libxslt") {
+ public_deps = [ ":bundled_libxslt" ]
+ }
+}
diff --git a/chromium/third_party/snappy/BUILD.gn b/chromium/third_party/snappy/BUILD.gn
index 7eabb7b19e9..821ed297f90 100644
--- a/chromium/third_party/snappy/BUILD.gn
+++ b/chromium/third_party/snappy/BUILD.gn
@@ -2,6 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+declare_args() {
+ use_system_snappy = false
+}
+
config("snappy_config") {
include_dirs = [ "src" ]
@@ -24,7 +28,7 @@ config("snappy_warnings") {
}
}
-static_library("snappy") {
+static_library("bundled_snappy") {
sources = [
"src/snappy-internal.h",
"src/snappy-sinksource.cc",
@@ -54,3 +58,28 @@ static_library("snappy") {
configs -= [ "//build/config/clang:extra_warnings" ]
}
}
+
+if (use_system_snappy) {
+ import("//build/shim_headers.gni")
+
+ shim_headers("snappy_shim") {
+ root_path = "src"
+ headers = [
+ "snappy-c.h",
+ "snappy-sinksource.h",
+ "snappy-stubs-public.h",
+ "snappy.h",
+ ]
+ }
+
+ source_set("snappy") {
+ deps = [
+ ":snappy_shim",
+ ]
+ libs = [ "snappy" ]
+ }
+} else {
+ group("snappy") {
+ public_deps = [ ":bundled_snappy" ]
+ }
+}
diff --git a/chromium/third_party/zlib/BUILD.gn b/chromium/third_party/zlib/BUILD.gn
index 5086563cf55..ff7462ba1f5 100644
--- a/chromium/third_party/zlib/BUILD.gn
+++ b/chromium/third_party/zlib/BUILD.gn
@@ -2,6 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/shim_headers.gni")
+
+declare_args() {
+ use_system_zlib = false
+ use_system_minizip = false
+}
+
config("zlib_config") {
include_dirs = [ "." ]
}
@@ -34,7 +41,7 @@ config("zlib_warnings") {
}
}
-static_library("zlib") {
+static_library("bundled_zlib") {
if (!is_win) {
# Don't stomp on "libzlib" on other platforms.
output_name = "chrome_zlib"
@@ -89,6 +96,31 @@ static_library("zlib") {
]
}
+shim_headers("zlib_shim") {
+ root_path = "."
+ headers = [ "zlib.h" ]
+}
+
+config("use_system_zlib") {
+ defines = [ "USE_SYSTEM_ZLIB=1" ]
+}
+
+source_set("system_zlib") {
+ deps = [
+ ":zlib_shim",
+ ]
+ libs = [ "z" ]
+ public_configs = [ ":use_system_zlib" ]
+}
+
+group("zlib") {
+ if (use_system_zlib) {
+ public_deps = [ ":system_zlib" ]
+ } else {
+ public_deps = [ ":bundled_zlib" ]
+ }
+}
+
config("minizip_warnings") {
visibility = [ ":*" ]
if (is_clang) {
@@ -97,7 +129,7 @@ config("minizip_warnings") {
}
}
-static_library("minizip") {
+static_library("bundled_minizip") {
sources = [
"contrib/minizip/ioapi.c",
"contrib/minizip/ioapi.h",
@@ -135,6 +167,33 @@ static_library("minizip") {
public_configs = [ ":zlib_config" ]
}
+shim_headers("minizip_shim") {
+ root_path = "contrib"
+ headers = [
+ "minizip/crypt.h",
+ "minizip/ioapi.h",
+ "minizip/iowin32.h",
+ "minizip/mztools.h",
+ "minizip/unzip.h",
+ "minizip/zip.h",
+ ]
+}
+
+source_set("system_minizip") {
+ deps = [
+ ":minizip_shim",
+ ]
+ libs = [ "minizip" ]
+}
+
+group("minizip") {
+ if (use_system_minizip) {
+ public_deps = [ ":system_minizip" ]
+ } else {
+ public_deps = [ ":bundled_minizip" ]
+ }
+}
+
static_library("zip") {
sources = [
"google/zip.cc",