128 lines
4.1 KiB
Diff
128 lines
4.1 KiB
Diff
|
From d3afade220ddb307e16a6dd4f2b0ec88b2af91e7 Mon Sep 17 00:00:00 2001
|
||
|
From: Stephan Hartmann <stha09@googlemail.com>
|
||
|
Date: Tue, 28 Jan 2020 18:16:54 +0000
|
||
|
Subject: [PATCH] Fix building with unbundled libxml
|
||
|
|
||
|
Add new targets to libxml.gn that were added in
|
||
|
https://chromium-review.googlesource.com/c/chromium/src/+/1894877
|
||
|
Adjust includes to use system libxml headers too
|
||
|
|
||
|
Bug: 1043042
|
||
|
Change-Id: I948c063e212e49b9e7f42fed2b8bf7f4af042ca7
|
||
|
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007110
|
||
|
Reviewed-by: Robert Sesek <rsesek@chromium.org>
|
||
|
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
|
||
|
Reviewed-by: Nico Weber <thakis@chromium.org>
|
||
|
Commit-Queue: Robert Sesek <rsesek@chromium.org>
|
||
|
Cr-Commit-Position: refs/heads/master@{#735957}
|
||
|
---
|
||
|
build/linux/unbundle/libxml.gn | 41 ++++++++++++++++++++--
|
||
|
third_party/libxml/chromium/libxml_utils.h | 4 +--
|
||
|
third_party/libxml/chromium/xml_reader.cc | 3 +-
|
||
|
third_party/libxml/chromium/xml_writer.cc | 3 +-
|
||
|
4 files changed, 45 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/build/linux/unbundle/libxml.gn b/build/linux/unbundle/libxml.gn
|
||
|
index c481bd3547b..3587881eea8 100644
|
||
|
--- a/build/linux/unbundle/libxml.gn
|
||
|
+++ b/build/linux/unbundle/libxml.gn
|
||
|
@@ -8,11 +8,48 @@ pkg_config("system_libxml") {
|
||
|
packages = [ "libxml-2.0" ]
|
||
|
}
|
||
|
|
||
|
-static_library("libxml") {
|
||
|
+source_set("libxml") {
|
||
|
+ public_configs = [ ":system_libxml" ]
|
||
|
+}
|
||
|
+
|
||
|
+static_library("libxml_utils") {
|
||
|
+ # Do not expand this visibility list without first consulting with the
|
||
|
+ # Security Team.
|
||
|
+ visibility = [
|
||
|
+ ":xml_reader",
|
||
|
+ ":xml_writer",
|
||
|
+ "//base/test:test_support",
|
||
|
+ "//services/data_decoder:xml_parser_fuzzer",
|
||
|
+ ]
|
||
|
sources = [
|
||
|
"chromium/libxml_utils.cc",
|
||
|
"chromium/libxml_utils.h",
|
||
|
]
|
||
|
-
|
||
|
public_configs = [ ":system_libxml" ]
|
||
|
}
|
||
|
+
|
||
|
+static_library("xml_reader") {
|
||
|
+ # Do not expand this visibility list without first consulting with the
|
||
|
+ # Security Team.
|
||
|
+ visibility = [
|
||
|
+ "//base/test:test_support",
|
||
|
+ "//components/policy/core/common:unit_tests",
|
||
|
+ "//services/data_decoder:*",
|
||
|
+ "//tools/traffic_annotation/auditor:auditor_sources",
|
||
|
+ ]
|
||
|
+ sources = [
|
||
|
+ "chromium/xml_reader.cc",
|
||
|
+ "chromium/xml_reader.h",
|
||
|
+ ]
|
||
|
+ deps = [ ":libxml_utils" ]
|
||
|
+}
|
||
|
+
|
||
|
+static_library("xml_writer") {
|
||
|
+ # The XmlWriter is considered safe to use from any target.
|
||
|
+ visibility = [ "*" ]
|
||
|
+ sources = [
|
||
|
+ "chromium/xml_writer.cc",
|
||
|
+ "chromium/xml_writer.h",
|
||
|
+ ]
|
||
|
+ deps = [ ":libxml_utils" ]
|
||
|
+}
|
||
|
diff --git a/third_party/libxml/chromium/libxml_utils.h b/third_party/libxml/chromium/libxml_utils.h
|
||
|
index ff969fab540..8b2383f9c8b 100644
|
||
|
--- a/third_party/libxml/chromium/libxml_utils.h
|
||
|
+++ b/third_party/libxml/chromium/libxml_utils.h
|
||
|
@@ -5,9 +5,9 @@
|
||
|
#ifndef THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
|
||
|
#define THIRD_PARTY_LIBXML_CHROMIUM_LIBXML_UTILS_H_
|
||
|
|
||
|
-#include <string>
|
||
|
+#include <libxml/xmlreader.h>
|
||
|
|
||
|
-#include "third_party/libxml/src/include/libxml/xmlreader.h"
|
||
|
+#include <string>
|
||
|
|
||
|
// libxml uses a global error function pointer for reporting errors.
|
||
|
// A ScopedXmlErrorFunc object lets you change the global error pointer
|
||
|
diff --git a/third_party/libxml/chromium/xml_reader.cc b/third_party/libxml/chromium/xml_reader.cc
|
||
|
index 92464f4cbcc..899ccefb7c8 100644
|
||
|
--- a/third_party/libxml/chromium/xml_reader.cc
|
||
|
+++ b/third_party/libxml/chromium/xml_reader.cc
|
||
|
@@ -4,10 +4,11 @@
|
||
|
|
||
|
#include "third_party/libxml/chromium/xml_reader.h"
|
||
|
|
||
|
+#include <libxml/xmlreader.h>
|
||
|
+
|
||
|
#include <vector>
|
||
|
|
||
|
#include "third_party/libxml/chromium/libxml_utils.h"
|
||
|
-#include "third_party/libxml/src/include/libxml/xmlreader.h"
|
||
|
|
||
|
using internal::XmlStringToStdString;
|
||
|
|
||
|
diff --git a/third_party/libxml/chromium/xml_writer.cc b/third_party/libxml/chromium/xml_writer.cc
|
||
|
index 51fce8ebeb1..7c58031fe2d 100644
|
||
|
--- a/third_party/libxml/chromium/xml_writer.cc
|
||
|
+++ b/third_party/libxml/chromium/xml_writer.cc
|
||
|
@@ -4,8 +4,9 @@
|
||
|
|
||
|
#include "third_party/libxml/chromium/xml_writer.h"
|
||
|
|
||
|
+#include <libxml/xmlwriter.h>
|
||
|
+
|
||
|
#include "third_party/libxml/chromium/libxml_utils.h"
|
||
|
-#include "third_party/libxml/src/include/libxml/xmlwriter.h"
|
||
|
|
||
|
XmlWriter::XmlWriter() : writer_(nullptr), buffer_(nullptr) {}
|
||
|
|