mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-06 00:48:18 -07:00
dev-util/electron: Distribute patches in a tarball.
FILESDIR has grown rather large, so move the patches to SRC. Closes: https://bugs.gentoo.org/640750 Closes: https://github.com/gentoo/gentoo/pull/6537 Package-Manager: Portage-2.3.13, Repoman-2.3.3
This commit is contained in:
committed by
Michał Górny
parent
246b544b7d
commit
4eb576c92c
@@ -9,4 +9,5 @@ DIST electron-grit-9536fb6429147d27ef1563088341825db0a893cd.tar.gz 378461 BLAKE2
|
||||
DIST electron-libchromiumcontent-a9b88fab38a8162bb485cc5854973f71ea0bc7a6.tar.gz 427806 BLAKE2B 21274045953499b7656366520d93acb63515995e7d6614afa5bba097e80bf833611fd715f0a8782dbdcb3c7c11ce2c4f5c2789483d4847e5bd73567123022dfd SHA512 da23b6119aa39d2ebc39b20280e2b6c0c26eba3e45271a3b8b196149ae8fb17f7ae63b97821ecdbc74c8d28617e361a3570e89c716d560a3b0caa7fa1f673f09
|
||||
DIST electron-native-mate-fd0e7dc4ab778f0d1ccda6c9640464ea06ee771e.tar.gz 23926 BLAKE2B 72ec5ee020ac18c5b3a8b6552698ed845cb0c401c0b02a4627479c98c581018658471df95de9d242db85ac9a4588b5f80b488180049271322545d69ecbf01123 SHA512 8715c417473340163ca3db2754ab10619679ac72378ff5c7f63899fe891d5c83e7b3db6832af885de63eb5a732ed54f393bcc3aeb8ddd38569e74023c46f72ac
|
||||
DIST electron-node-9b1683e7000481ec6214eafa3eef7ac4594eb410.tar.gz 46194500 BLAKE2B 36537f40a597f9ed969abe385de8cf58fd2f48526021461ab5feb0e061a2dc0d4a49109191254e69b685101f6aa79d1c870091f0eae251ba8b3bc0b3e6a975e6 SHA512 f258cf5597154e976e1e4c0b81f6b63e9b344e4a28492137b80d59dc841490d4ad69e6bab2456a6334a42e51dfe2862cc389e837a4baac90a698ff60e5b08ab4
|
||||
DIST electron-patches-1.6.15.tar.gz 28591 BLAKE2B 98654829e882874f4470d7bdb906f7cebde6c61c28568c06650464ecd8779cafd028b03711c063445387dd158804a7b9bac5aca836f56f2285b50fcaf3ee56b0 SHA512 c18e53bdf86246376fdac505481e4aa364438b703a47fb82b695d874dabf9a945df5381042b1a0cef102142f0482db51017a031647f8f8ffde3e8d1f629e2f9f
|
||||
DIST electron-pdf-viewer-a050a339cfeabcfb5f07c313161d2ee27b6c3a39.tar.gz 38431 BLAKE2B 962b1eeaa74544d57a5664fc6965b9f43e6d94671a08be024bb3001d7cf7e3ee02b2c63c2074e2ed4d6484dc5db7515cb170bf7432a8d11ccf595716e5c4500e SHA512 a028b67c0644d4ddcfc5aee4e2abb305648eb666082ea2c151cb6b9b3972503093cadb32b102aa19b04c8e863c2ac55bb20cccbf2abbf7832f9cfd3c3618612e
|
||||
|
||||
@@ -35,6 +35,7 @@ LIBCHROMIUMCONTENT_COMMIT="a9b88fab38a8162bb485cc5854973f71ea0bc7a6"
|
||||
ASAR_VERSION="0.13.0"
|
||||
BROWSERIFY_VERSION="14.0.0"
|
||||
|
||||
PATCHES_P="gentoo-electron-patches-${P}"
|
||||
CHROMIUM_P="chromium-${CHROMIUM_VERSION}"
|
||||
BREAKPAD_P="chromium-breakpad-${BREAKPAD_COMMIT}"
|
||||
BREAKPAD_SRC_P="breakpad-${BREAKPAD_SRC_COMMIT}"
|
||||
@@ -48,7 +49,7 @@ ASAR_P="asar-${ASAR_VERSION}"
|
||||
BROWSERIFY_P="browserify-${BROWSERIFY_VERSION}"
|
||||
|
||||
DESCRIPTION="Cross platform application development framework based on web technologies"
|
||||
HOMEPAGE="http://electron.atom.io/"
|
||||
HOMEPAGE="https://electronjs.org/"
|
||||
SRC_URI="
|
||||
https://commondatastorage.googleapis.com/chromium-browser-official/${CHROMIUM_P}.tar.xz
|
||||
https://github.com/electron/electron/archive/v${PV}.tar.gz -> ${P}.tar.gz
|
||||
@@ -62,6 +63,7 @@ SRC_URI="
|
||||
https://github.com/electron/libchromiumcontent/archive/${LIBCHROMIUMCONTENT_COMMIT}.tar.gz -> electron-${LIBCHROMIUMCONTENT_P}.tar.gz
|
||||
https://github.com/elprans/asar/releases/download/v${ASAR_VERSION}-gentoo/asar-build.tar.gz -> ${ASAR_P}.tar.gz
|
||||
https://github.com/elprans/node-browserify/releases/download/${BROWSERIFY_VERSION}-gentoo/browserify-build.tar.gz -> ${BROWSERIFY_P}.tar.gz
|
||||
https://github.com/elprans/gentoo-electron-patches/archive/${P}.tar.gz -> electron-patches-${PV}.tar.gz
|
||||
"
|
||||
|
||||
S="${WORKDIR}/${P}"
|
||||
@@ -178,23 +180,6 @@ DEPEND="${COMMON_DEPEND}
|
||||
')
|
||||
"
|
||||
|
||||
CHROMIUM_PATCHES="
|
||||
chromium-FORTIFY_SOURCE.patch
|
||||
chromium-gcc-7-r0.patch
|
||||
chromium-glibc-2.24.patch
|
||||
chromium-56-gcc4.patch
|
||||
chromium-system-ffmpeg-r4.patch
|
||||
chromium-system-icu-r0.patch
|
||||
chromium-icu-59-r0.patch
|
||||
chromium-icu-60-r0.patch
|
||||
chromium-v8-icu-59-r0.patch
|
||||
chromium-disable-widevine.patch
|
||||
chromium-remove-gardiner-mod-font-r1.patch
|
||||
chromium-shared-v8-r2.patch
|
||||
chromium-lto-fixes-r3.patch
|
||||
chromium-python3-compat-r0.patch
|
||||
"
|
||||
|
||||
# Keep this in sync with the python_gen_any_dep call.
|
||||
python_check_deps() {
|
||||
has_version --host-root "dev-python/beautifulsoup:python-2[${PYTHON_USEDEP}]" &&
|
||||
@@ -339,15 +324,8 @@ src_prepare() {
|
||||
rsync -a "${WORKDIR}/${BROWSERIFY_P}/node_modules/" \
|
||||
"${S}/node_modules/" || die
|
||||
|
||||
# electron patches
|
||||
cd "${ELECTRON_S}" || die
|
||||
eapply "${FILESDIR}/${P}.patch"
|
||||
eapply "${FILESDIR}/${PN}-system-icu-r0.patch"
|
||||
|
||||
# node patches
|
||||
cd "${NODE_S}" || die
|
||||
eapply "${FILESDIR}/${P}-vendor-node.patch"
|
||||
eapply "${FILESDIR}/${PN}-vendor-node-external-snapshots-r2.patch"
|
||||
# make sure node uses the correct version of v8
|
||||
rm -r deps/v8 || die
|
||||
ln -s "${CHROMIUM_S}/v8" deps/ || die
|
||||
@@ -371,22 +349,9 @@ src_prepare() {
|
||||
sed -i -e "s/'lib'/'${LIBDIR}'/" lib/module.js || die
|
||||
sed -i -e "s|\"lib\"|\"${LIBDIR}\"|" deps/npm/lib/npm.js || die
|
||||
|
||||
# brightray patches
|
||||
cd "${BRIGHTRAY_S}" || die
|
||||
eapply "${FILESDIR}/${P}-vendor-brightray.patch"
|
||||
|
||||
# libchromiumcontent patches
|
||||
cd "${LIBCC_S}" || die
|
||||
eapply "${FILESDIR}/${P}-vendor-libchromiumcontent.patch"
|
||||
|
||||
# breakpad patches
|
||||
cd "${BREAKPAD_S}" || die
|
||||
eapply "${FILESDIR}/${P}-vendor-breakpad.patch"
|
||||
|
||||
# chromium patches
|
||||
cd "${CHROMIUM_S}" || die
|
||||
|
||||
# libcc chromium patches
|
||||
# Apply libcc Chromium patches.
|
||||
_unnest_patches "${LIBCC_S}/patches"
|
||||
|
||||
EPATCH_SOURCE="${LIBCC_S}/patches" \
|
||||
@@ -395,11 +360,16 @@ src_prepare() {
|
||||
EPATCH_MULTI_MSG="Applying libchromiumcontent patches..." \
|
||||
epatch
|
||||
|
||||
# Apply Gentoo-specific Chromium patches
|
||||
local p
|
||||
for p in ${CHROMIUM_PATCHES}; do
|
||||
eapply "${FILESDIR}/${p}"
|
||||
done
|
||||
cd "${S}" || die
|
||||
|
||||
# Apply Gentoo patches
|
||||
_unnest_patches "${WORKDIR}/${PATCHES_P}/${PV}"
|
||||
|
||||
EPATCH_SOURCE="${WORKDIR}/${PATCHES_P}/${PV}" \
|
||||
EPATCH_SUFFIX="patch" \
|
||||
EPATCH_FORCE="yes" \
|
||||
EPATCH_MULTI_MSG="Applying Gentoo patches..." \
|
||||
epatch
|
||||
|
||||
# Merge chromiumcontent component into chromium source tree.
|
||||
mkdir -p "${CHROMIUM_S}/chromiumcontent" || die
|
||||
@@ -526,6 +496,8 @@ src_prepare() {
|
||||
keeplibs+=( third_party/ffmpeg )
|
||||
fi
|
||||
|
||||
cd "${CHROMIUM_S}" || die
|
||||
|
||||
# Remove most bundled libraries. Some are still needed.
|
||||
ebegin "Unbundling libraries"
|
||||
build/linux/unbundle/remove_bundled_libraries.py \
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
From 888874f761fdd69bb9448b3905627289b5fd66dd Mon Sep 17 00:00:00 2001
|
||||
From: floppymaster <floppymaster@gmail.com>
|
||||
Date: Thu, 19 Jan 2017 20:20:45 -0800
|
||||
Subject: [PATCH] Allow GCC 4.9 to compile Chromium
|
||||
|
||||
In order to implicit cast an lvalue to an rvalue when returning
|
||||
from a function, the return type and type of variable in the return
|
||||
statement previously had to be exactly the same. When this was not
|
||||
the case, std::move was required. For instance, when returning a
|
||||
std::unique_ptr<Derived> variable in a function with a
|
||||
std::unique_ptr<Base> return type, std::move is required.
|
||||
|
||||
DR 1579 changed this, and allows for implicitly converting
|
||||
to the return type, if the return type has a constructor(T&&), where
|
||||
T is the type of the local variable being returned. DR 1579 was
|
||||
implemented in GCC 5, but not in GCC 4.9 and below. By explicitly
|
||||
qualifying the local variable with std::move, we allow for compiling
|
||||
with GCC 4.9 and incur no performance penalty. The code is still
|
||||
absolutely correct to the word of C++11.
|
||||
|
||||
BUG=chromium:682965
|
||||
|
||||
See also:
|
||||
* https://bugs.gentoo.org/show_bug.cgi?id=600288
|
||||
* https://stackoverflow.com/questions/22018115/converting-stdunique-ptrderived-to-stdunique-ptrbase#comment33375875_22018521
|
||||
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3833.html#1579
|
||||
|
||||
Review-Url: https://codereview.webrtc.org/2642053003
|
||||
Cr-Commit-Position: refs/heads/master@{#16175}
|
||||
---
|
||||
AUTHORS | 1 +
|
||||
webrtc/modules/desktop_capture/screen_capturer_x11.cc | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/third_party/webrtc/modules/desktop_capture/screen_capturer_x11.cc
|
||||
+++ b/third_party/webrtc/modules/desktop_capture/screen_capturer_x11.cc
|
||||
@@ -412,7 +412,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
- return capturer;
|
||||
+ return std::move(capturer);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
Drop _FORTIFY_SOURCE=2 from defines
|
||||
|
||||
Gentoo toolchains enable this by default. Removing this prevents spammy
|
||||
warnings about the macro being redefined.
|
||||
|
||||
--- a/build/config/compiler/BUILD.gn
|
||||
+++ b/build/config/compiler/BUILD.gn
|
||||
@@ -1069,19 +1069,6 @@ config("chromium_code") {
|
||||
"__STDC_FORMAT_MACROS",
|
||||
]
|
||||
|
||||
- if (!is_debug && !using_sanitizer &&
|
||||
- (!is_linux || !is_clang || is_official_build)) {
|
||||
- # _FORTIFY_SOURCE isn't really supported by Clang now, see
|
||||
- # http://llvm.org/bugs/show_bug.cgi?id=16821.
|
||||
- # It seems to work fine with Ubuntu 12 headers though, so use it in
|
||||
- # official builds.
|
||||
- #
|
||||
- # Non-chromium code is not guaranteed to compile cleanly with
|
||||
- # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are
|
||||
- # disabled, so only do that for Release build.
|
||||
- defines += [ "_FORTIFY_SOURCE=2" ]
|
||||
- }
|
||||
-
|
||||
if (is_mac || is_ios) {
|
||||
cflags_objc = [ "-Wobjc-missing-property-synthesis" ]
|
||||
cflags_objcc = [ "-Wobjc-missing-property-synthesis" ]
|
||||
@@ -1,9 +0,0 @@
|
||||
--- a/third_party/widevine/cdm/stub/widevine_cdm_version.h
|
||||
+++ b/third_party/widevine/cdm/stub/widevine_cdm_version.h
|
||||
@@ -10,6 +10,5 @@
|
||||
|
||||
#include "third_party/widevine/cdm/widevine_cdm_common.h"
|
||||
|
||||
-#define WIDEVINE_CDM_AVAILABLE
|
||||
|
||||
#endif // WIDEVINE_CDM_VERSION_H_
|
||||
@@ -1,114 +0,0 @@
|
||||
From 19597ff341e55fef78c7fae794574785bfde9acd Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Thu, 7 Dec 2017 09:25:03 -0500
|
||||
Subject: [PATCH] GCC-7 compatibility
|
||||
|
||||
---
|
||||
.../Source/platform/graphics/gpu/SharedGpuContext.h | 1 +
|
||||
third_party/WebKit/Source/wtf/LinkedHashSet.h | 1 +
|
||||
v8/src/objects-body-descriptors.h | 2 +-
|
||||
v8/src/objects-inl.h | 19 +++++++++++++++++++
|
||||
v8/src/objects.h | 20 ++++----------------
|
||||
5 files changed, 26 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h
|
||||
index 7c32007346..dd2d637085 100644
|
||||
--- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h
|
||||
+++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "platform/PlatformExport.h"
|
||||
#include "wtf/ThreadSpecific.h"
|
||||
|
||||
+#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace gpu {
|
||||
diff --git a/third_party/WebKit/Source/wtf/LinkedHashSet.h b/third_party/WebKit/Source/wtf/LinkedHashSet.h
|
||||
index 65f5100a8f..7c6c9fc5d8 100644
|
||||
--- a/third_party/WebKit/Source/wtf/LinkedHashSet.h
|
||||
+++ b/third_party/WebKit/Source/wtf/LinkedHashSet.h
|
||||
@@ -630,6 +630,7 @@ inline LinkedHashSet<T, U, V, W>& LinkedHashSet<T, U, V, W>::operator=(
|
||||
return *this;
|
||||
}
|
||||
|
||||
+inline void swapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b);
|
||||
template <typename T, typename U, typename V, typename W>
|
||||
inline void LinkedHashSet<T, U, V, W>::swap(LinkedHashSet& other) {
|
||||
m_impl.swap(other.m_impl);
|
||||
diff --git a/v8/src/objects-body-descriptors.h b/v8/src/objects-body-descriptors.h
|
||||
index 91cb8883be..a1c3634bd7 100644
|
||||
--- a/v8/src/objects-body-descriptors.h
|
||||
+++ b/v8/src/objects-body-descriptors.h
|
||||
@@ -99,7 +99,7 @@ class FixedBodyDescriptor final : public BodyDescriptorBase {
|
||||
|
||||
template <typename StaticVisitor>
|
||||
static inline void IterateBody(HeapObject* obj, int object_size) {
|
||||
- IterateBody(obj);
|
||||
+ IterateBody<StaticVisitor>(obj);
|
||||
}
|
||||
};
|
||||
|
||||
diff --git a/v8/src/objects-inl.h b/v8/src/objects-inl.h
|
||||
index 1a8274cbf1..6c4b13c0d0 100644
|
||||
--- a/v8/src/objects-inl.h
|
||||
+++ b/v8/src/objects-inl.h
|
||||
@@ -39,6 +39,25 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
+template <typename Derived, typename Shape, typename Key>
|
||||
+uint32_t HashTable<Derived, Shape, Key>::Hash(Key key) {
|
||||
+ if (Shape::UsesSeed) {
|
||||
+ return Shape::SeededHash(key, GetHeap()->HashSeed());
|
||||
+ } else {
|
||||
+ return Shape::Hash(key);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+template <typename Derived, typename Shape, typename Key>
|
||||
+uint32_t HashTable<Derived, Shape, Key>::HashForObject(Key key,
|
||||
+ Object* object) {
|
||||
+ if (Shape::UsesSeed) {
|
||||
+ return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
|
||||
+ } else {
|
||||
+ return Shape::HashForObject(key, object);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
PropertyDetails::PropertyDetails(Smi* smi) {
|
||||
value_ = smi->value();
|
||||
}
|
||||
diff --git a/v8/src/objects.h b/v8/src/objects.h
|
||||
index 747a4f0511..b9279640e2 100644
|
||||
--- a/v8/src/objects.h
|
||||
+++ b/v8/src/objects.h
|
||||
@@ -3531,22 +3531,10 @@ class HashTable : public HashTableBase {
|
||||
public:
|
||||
typedef Shape ShapeT;
|
||||
|
||||
- // Wrapper methods
|
||||
- inline uint32_t Hash(Key key) {
|
||||
- if (Shape::UsesSeed) {
|
||||
- return Shape::SeededHash(key, GetHeap()->HashSeed());
|
||||
- } else {
|
||||
- return Shape::Hash(key);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- inline uint32_t HashForObject(Key key, Object* object) {
|
||||
- if (Shape::UsesSeed) {
|
||||
- return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
|
||||
- } else {
|
||||
- return Shape::HashForObject(key, object);
|
||||
- }
|
||||
- }
|
||||
+ // Wrapper methods. Defined in src/objects-inl.h
|
||||
+ // to break a cycle with src/heap/heap.h.
|
||||
+ inline uint32_t Hash(Key key);
|
||||
+ inline uint32_t HashForObject(Key key, Object* object);
|
||||
|
||||
// Returns a new HashTable object.
|
||||
MUST_USE_RESULT static Handle<Derived> New(
|
||||
--
|
||||
2.14.3
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--- a/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.orig 2017-01-05 20:50:56.329369189 +0000
|
||||
+++ b/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp 2017-01-05 20:51:32.926099779 +0000
|
||||
@@ -242,6 +242,12 @@
|
||||
ASSERT(!(len & kSystemPageOffsetMask));
|
||||
#if OS(POSIX)
|
||||
int ret = madvise(addr, len, MADV_FREE);
|
||||
+ if (ret != 0 && errno == EINVAL) {
|
||||
+ // MADV_FREE only works on Linux 4.5+ . If request failed,
|
||||
+ // retry with older MADV_DONTNEED . Note that MADV_FREE
|
||||
+ // being defined at compile time doesn't imply runtime support.
|
||||
+ ret = madvise(addr, len, MADV_DONTNEED);
|
||||
+ }
|
||||
RELEASE_ASSERT(!ret);
|
||||
#else
|
||||
setSystemPagesInaccessible(addr, len);
|
||||
@@ -1,582 +0,0 @@
|
||||
From f041627ec383536d124002b81301c80b7a1757f7 Mon Sep 17 00:00:00 2001
|
||||
From: jshin <jshin@chromium.org>
|
||||
Date: Thu, 23 Mar 2017 02:57:16 -0700
|
||||
Subject: [PATCH] Prepare Chromium and Blink for ICU 59
|
||||
|
||||
ICU 59 uses char16_t as UChar instead of {wchar_t, uint16_t}.
|
||||
As a result, char16_t is not compatible with char16 any more.
|
||||
When constructing string16 from UnicodeString/UChar buffer, we need to
|
||||
reinterpret_cast with a barrier (to avoid an anti-aliasing optimzation
|
||||
by some compilers).
|
||||
|
||||
Add UnicodeStringToString16() to base/i18n that utilizes ICU 59-to-be's
|
||||
helper for the casting regardless of anti-aliasing optimization.
|
||||
|
||||
And, refactor UnicodeString->string16->UTF8 string to UnicodeString->UTF8
|
||||
in a few places.
|
||||
|
||||
For ICU C API "clients", UChar will be configured to be {wchar_t, uint16_t}
|
||||
so that there's little to be changed.
|
||||
|
||||
This was tested with an ICU branch with char16_t as UChar.
|
||||
|
||||
http://source.icu-project.org/repos/icu/branches/markus/ucharptr2/
|
||||
|
||||
BUG=693640
|
||||
TEST=trybots are all green.
|
||||
|
||||
Review-Url: https://codereview.chromium.org/2740673002
|
||||
Cr-Commit-Position: refs/heads/master@{#459034}
|
||||
---
|
||||
ash/common/system/date/date_view.cc | 30 ++------------------
|
||||
base/BUILD.gn | 1 +
|
||||
base/i18n/message_formatter.cc | 5 ++--
|
||||
base/i18n/number_formatting.cc | 5 ++--
|
||||
base/i18n/string_compare.cc | 5 ++--
|
||||
base/i18n/time_formatting.cc | 9 +++---
|
||||
base/i18n/time_formatting_unittest.cc | 3 +-
|
||||
base/i18n/timezone.cc | 4 +--
|
||||
base/i18n/unicodestring.h | 32 ++++++++++++++++++++++
|
||||
chrome/browser/chromeos/system/timezone_util.cc | 6 ++--
|
||||
.../webui/md_downloads/downloads_list_tracker.cc | 4 +--
|
||||
chromeos/settings/timezone_settings.cc | 4 +--
|
||||
.../core/browser/autofill_profile_comparator.cc | 3 +-
|
||||
components/autofill/core/browser/credit_card.cc | 7 +++--
|
||||
.../browser/android/date_time_chooser_android.cc | 4 +--
|
||||
content/renderer/android/email_detector.cc | 4 +--
|
||||
ios/chrome/browser/notification_promo_unittest.cc | 10 ++-----
|
||||
net/ftp/ftp_util.cc | 5 ++--
|
||||
.../Source/core/html/forms/EmailInputType.cpp | 13 +++++++--
|
||||
19 files changed, 88 insertions(+), 66 deletions(-)
|
||||
create mode 100644 base/i18n/unicodestring.h
|
||||
|
||||
diff --git a/ash/common/system/date/date_view.cc b/ash/common/system/date/date_view.cc
|
||||
index 41aa1919a980..8d9c416fd392 100644
|
||||
--- a/ash/common/system/date/date_view.cc
|
||||
+++ b/ash/common/system/date/date_view.cc
|
||||
@@ -57,43 +57,19 @@ bool UseMd() {
|
||||
return MaterialDesignController::IsSystemTrayMenuMaterial();
|
||||
}
|
||||
|
||||
-base::string16 FormatDateWithPattern(const base::Time& time,
|
||||
- const char* pattern) {
|
||||
- UErrorCode status = U_ZERO_ERROR;
|
||||
- std::unique_ptr<icu::DateTimePatternGenerator> generator(
|
||||
- icu::DateTimePatternGenerator::createInstance(status));
|
||||
- DCHECK(U_SUCCESS(status));
|
||||
- icu::UnicodeString generated_pattern =
|
||||
- generator->getBestPattern(icu::UnicodeString(pattern), status);
|
||||
- DCHECK(U_SUCCESS(status));
|
||||
- icu::SimpleDateFormat simple_formatter(generated_pattern, status);
|
||||
- DCHECK(U_SUCCESS(status));
|
||||
- icu::UnicodeString date_string;
|
||||
- simple_formatter.format(static_cast<UDate>(time.ToDoubleT() * 1000),
|
||||
- date_string, status);
|
||||
- DCHECK(U_SUCCESS(status));
|
||||
- return base::string16(date_string.getBuffer(),
|
||||
- static_cast<size_t>(date_string.length()));
|
||||
-}
|
||||
-
|
||||
base::string16 FormatDate(const base::Time& time) {
|
||||
if (UseMd()) {
|
||||
// Use 'short' month format (e.g., "Oct") followed by non-padded day of
|
||||
// month (e.g., "2", "10").
|
||||
- return FormatDateWithPattern(time, "LLLd");
|
||||
+ return base::TimeFormatWithPattern(time, "LLLd");
|
||||
} else {
|
||||
- icu::UnicodeString date_string;
|
||||
- std::unique_ptr<icu::DateFormat> formatter(
|
||||
- icu::DateFormat::createDateInstance(icu::DateFormat::kMedium));
|
||||
- formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string);
|
||||
- return base::string16(date_string.getBuffer(),
|
||||
- static_cast<size_t>(date_string.length()));
|
||||
+ return base::TimeFormatShortDate(time);
|
||||
}
|
||||
}
|
||||
|
||||
base::string16 FormatDayOfWeek(const base::Time& time) {
|
||||
// Use 'short' day of week format (e.g., "Wed").
|
||||
- return FormatDateWithPattern(time, "EEE");
|
||||
+ return base::TimeFormatWithPattern(time, "EEE");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
diff --git a/base/BUILD.gn b/base/BUILD.gn
|
||||
index 3754be5f383f..29a60c1a265f 100644
|
||||
--- a/base/BUILD.gn
|
||||
+++ b/base/BUILD.gn
|
||||
@@ -1564,6 +1564,7 @@ component("i18n") {
|
||||
"i18n/time_formatting.h",
|
||||
"i18n/timezone.cc",
|
||||
"i18n/timezone.h",
|
||||
+ "i18n/unicodestring.h",
|
||||
"i18n/utf8_validator_tables.cc",
|
||||
"i18n/utf8_validator_tables.h",
|
||||
]
|
||||
diff --git a/base/i18n/message_formatter.cc b/base/i18n/message_formatter.cc
|
||||
index 702e51b94aaa..6962a2829755 100644
|
||||
--- a/base/i18n/message_formatter.cc
|
||||
+++ b/base/i18n/message_formatter.cc
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "base/i18n/message_formatter.h"
|
||||
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/numerics/safe_conversions.h"
|
||||
#include "base/time/time.h"
|
||||
@@ -91,7 +92,7 @@ string16 MessageFormatter::FormatWithNumberedArgs(
|
||||
<< u_errorName(error);
|
||||
return string16();
|
||||
}
|
||||
- return string16(formatted.getBuffer(), formatted.length());
|
||||
+ return i18n::UnicodeStringToString16(formatted);
|
||||
}
|
||||
|
||||
string16 MessageFormatter::FormatWithNamedArgs(
|
||||
@@ -134,7 +135,7 @@ string16 MessageFormatter::FormatWithNamedArgs(
|
||||
<< u_errorName(error);
|
||||
return string16();
|
||||
}
|
||||
- return string16(formatted.getBuffer(), formatted.length());
|
||||
+ return i18n::UnicodeStringToString16(formatted);
|
||||
}
|
||||
|
||||
} // namespace i18n
|
||||
diff --git a/base/i18n/number_formatting.cc b/base/i18n/number_formatting.cc
|
||||
index b51083348460..5a0503f77de1 100644
|
||||
--- a/base/i18n/number_formatting.cc
|
||||
+++ b/base/i18n/number_formatting.cc
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "base/format_macros.h"
|
||||
#include "base/i18n/message_formatter.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@@ -60,7 +61,7 @@ string16 FormatNumber(int64_t number) {
|
||||
icu::UnicodeString ustr;
|
||||
number_format->format(number, ustr);
|
||||
|
||||
- return string16(ustr.getBuffer(), static_cast<size_t>(ustr.length()));
|
||||
+ return i18n::UnicodeStringToString16(ustr);
|
||||
}
|
||||
|
||||
string16 FormatDouble(double number, int fractional_digits) {
|
||||
@@ -76,7 +77,7 @@ string16 FormatDouble(double number, int fractional_digits) {
|
||||
icu::UnicodeString ustr;
|
||||
number_format->format(number, ustr);
|
||||
|
||||
- return string16(ustr.getBuffer(), static_cast<size_t>(ustr.length()));
|
||||
+ return i18n::UnicodeStringToString16(ustr);
|
||||
}
|
||||
|
||||
string16 FormatPercent(int number) {
|
||||
diff --git a/base/i18n/string_compare.cc b/base/i18n/string_compare.cc
|
||||
index 2851e7d2dce1..649c28119fe3 100644
|
||||
--- a/base/i18n/string_compare.cc
|
||||
+++ b/base/i18n/string_compare.cc
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
+#include "third_party/icu/source/common/unicode/unistr.h"
|
||||
|
||||
namespace base {
|
||||
namespace i18n {
|
||||
@@ -17,8 +18,8 @@ UCollationResult CompareString16WithCollator(const icu::Collator& collator,
|
||||
const string16& rhs) {
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
UCollationResult result = collator.compare(
|
||||
- static_cast<const UChar*>(lhs.c_str()), static_cast<int>(lhs.length()),
|
||||
- static_cast<const UChar*>(rhs.c_str()), static_cast<int>(rhs.length()),
|
||||
+ icu::UnicodeString(FALSE, lhs.c_str(), static_cast<int>(lhs.length())),
|
||||
+ icu::UnicodeString(FALSE, rhs.c_str(), static_cast<int>(rhs.length())),
|
||||
error);
|
||||
DCHECK(U_SUCCESS(error));
|
||||
return result;
|
||||
diff --git a/base/i18n/time_formatting.cc b/base/i18n/time_formatting.cc
|
||||
index 024b86510b5a..ae1c59eb411a 100644
|
||||
--- a/base/i18n/time_formatting.cc
|
||||
+++ b/base/i18n/time_formatting.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/time/time.h"
|
||||
@@ -26,8 +27,7 @@ string16 TimeFormat(const icu::DateFormat* formatter,
|
||||
icu::UnicodeString date_string;
|
||||
|
||||
formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string);
|
||||
- return string16(date_string.getBuffer(),
|
||||
- static_cast<size_t>(date_string.length()));
|
||||
+ return i18n::UnicodeStringToString16(date_string);
|
||||
}
|
||||
|
||||
string16 TimeFormatWithoutAmPm(const icu::DateFormat* formatter,
|
||||
@@ -46,8 +46,7 @@ string16 TimeFormatWithoutAmPm(const icu::DateFormat* formatter,
|
||||
begin--;
|
||||
time_string.removeBetween(begin, ampm_field.getEndIndex());
|
||||
}
|
||||
- return string16(time_string.getBuffer(),
|
||||
- static_cast<size_t>(time_string.length()));
|
||||
+ return i18n::UnicodeStringToString16(time_string);
|
||||
}
|
||||
|
||||
icu::SimpleDateFormat CreateSimpleDateFormatter(const char* pattern) {
|
||||
@@ -168,7 +167,7 @@ string16 TimeDurationFormat(const TimeDelta& time,
|
||||
icu::UnicodeString formatted;
|
||||
icu::FieldPosition ignore(icu::FieldPosition::DONT_CARE);
|
||||
measure_format.formatMeasures(measures, 2, formatted, ignore, status);
|
||||
- return base::string16(formatted.getBuffer(), formatted.length());
|
||||
+ return i18n::UnicodeStringToString16(formatted);
|
||||
}
|
||||
|
||||
HourClockType GetHourClockType() {
|
||||
diff --git a/base/i18n/time_formatting_unittest.cc b/base/i18n/time_formatting_unittest.cc
|
||||
index 51a48513aca6..eca8ea2cdaea 100644
|
||||
--- a/base/i18n/time_formatting_unittest.cc
|
||||
+++ b/base/i18n/time_formatting_unittest.cc
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/i18n/rtl.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/test/icu_test_util.h"
|
||||
#include "base/time/time.h"
|
||||
@@ -37,7 +38,7 @@ base::string16 GetShortTimeZone(const Time& time) {
|
||||
zone_formatter->format(UTZFMT_STYLE_SPECIFIC_SHORT, *zone,
|
||||
static_cast<UDate>(time.ToDoubleT() * 1000),
|
||||
name, nullptr);
|
||||
- return base::string16(name.getBuffer(), name.length());
|
||||
+ return i18n::UnicodeStringToString16(name);
|
||||
}
|
||||
|
||||
#if defined(OS_ANDROID)
|
||||
diff --git a/base/i18n/timezone.cc b/base/i18n/timezone.cc
|
||||
index e881c9d680f8..95e7aee34c4c 100644
|
||||
--- a/base/i18n/timezone.cc
|
||||
+++ b/base/i18n/timezone.cc
|
||||
@@ -610,9 +610,9 @@ std::string CountryCodeForCurrentTimezone() {
|
||||
std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
|
||||
icu::UnicodeString id;
|
||||
zone->getID(id);
|
||||
- string16 olson_code(id.getBuffer(), id.length());
|
||||
+ std::string olson_code;
|
||||
return TimezoneMap::GetInstance()->CountryCodeForTimezone(
|
||||
- UTF16ToUTF8(olson_code));
|
||||
+ id.toUTF8String(olson_code));
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
diff --git a/base/i18n/unicodestring.h b/base/i18n/unicodestring.h
|
||||
new file mode 100644
|
||||
index 000000000000..b62c5264deb4
|
||||
--- /dev/null
|
||||
+++ b/base/i18n/unicodestring.h
|
||||
@@ -0,0 +1,32 @@
|
||||
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#ifndef BASE_I18N_UNICODESTRING_H_
|
||||
+#define BASE_I18N_UNICODESTRING_H_
|
||||
+
|
||||
+#include "base/strings/string16.h"
|
||||
+#include "third_party/icu/source/common/unicode/unistr.h"
|
||||
+#include "third_party/icu/source/common/unicode/uvernum.h"
|
||||
+
|
||||
+#if U_ICU_VERSION_MAJOR_NUM >= 59
|
||||
+#include "third_party/icu/source/common/unicode/char16ptr.h"
|
||||
+#endif
|
||||
+
|
||||
+namespace base {
|
||||
+namespace i18n {
|
||||
+
|
||||
+inline string16 UnicodeStringToString16(const icu::UnicodeString& unistr) {
|
||||
+#if U_ICU_VERSION_MAJOR_NUM >= 59
|
||||
+ return base::string16(icu::toUCharPtr(unistr.getBuffer()),
|
||||
+ static_cast<size_t>(unistr.length()));
|
||||
+#else
|
||||
+ return base::string16(unistr.getBuffer(),
|
||||
+ static_cast<size_t>(unistr.length()));
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+} // namespace i18n
|
||||
+} // namespace base
|
||||
+
|
||||
+#endif // BASE_UNICODESTRING_H_
|
||||
diff --git a/chrome/browser/chromeos/system/timezone_util.cc b/chrome/browser/chromeos/system/timezone_util.cc
|
||||
index 6c41a052197a..d01f60e03b9f 100644
|
||||
--- a/chrome/browser/chromeos/system/timezone_util.cc
|
||||
+++ b/chrome/browser/chromeos/system/timezone_util.cc
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "base/i18n/rtl.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@@ -77,7 +78,7 @@ base::string16 GetExemplarCity(const icu::TimeZone& zone) {
|
||||
if (!U_FAILURE(status)) {
|
||||
city = icu::ures_getUnicodeStringByKey(zone_item.get(), "ec", &status);
|
||||
if (U_SUCCESS(status))
|
||||
- return base::string16(city.getBuffer(), city.length());
|
||||
+ return base::i18n::UnicodeStringToString16(city);
|
||||
}
|
||||
|
||||
// Fallback case in case of failure.
|
||||
@@ -135,8 +136,7 @@ base::string16 GetTimezoneName(const icu::TimeZone& timezone) {
|
||||
}
|
||||
base::string16 result(l10n_util::GetStringFUTF16(
|
||||
IDS_OPTIONS_SETTINGS_TIMEZONE_DISPLAY_TEMPLATE,
|
||||
- base::ASCIIToUTF16(offset_str),
|
||||
- base::string16(name.getBuffer(), name.length()),
|
||||
+ base::ASCIIToUTF16(offset_str), base::i18n::UnicodeStringToString16(name),
|
||||
GetExemplarCity(timezone)));
|
||||
base::i18n::AdjustStringForLocaleDirection(&result);
|
||||
return result;
|
||||
diff --git a/chrome/browser/ui/webui/md_downloads/downloads_list_tracker.cc b/chrome/browser/ui/webui/md_downloads/downloads_list_tracker.cc
|
||||
index caf07f69197c..38ed53586d6a 100644
|
||||
--- a/chrome/browser/ui/webui/md_downloads/downloads_list_tracker.cc
|
||||
+++ b/chrome/browser/ui/webui/md_downloads/downloads_list_tracker.cc
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "base/bind.h"
|
||||
#include "base/bind_helpers.h"
|
||||
#include "base/i18n/rtl.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/strings/string16.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/time/time.h"
|
||||
@@ -74,8 +75,7 @@ base::string16 TimeFormatLongDate(const base::Time& time) {
|
||||
icu::DateFormat::createDateInstance(icu::DateFormat::kLong));
|
||||
icu::UnicodeString date_string;
|
||||
formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string);
|
||||
- return base::string16(date_string.getBuffer(),
|
||||
- static_cast<size_t>(date_string.length()));
|
||||
+ return base::i18n::UnicodeStringToString16(date_string);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
diff --git a/chromeos/settings/timezone_settings.cc b/chromeos/settings/timezone_settings.cc
|
||||
index 38ea65d653ac..63aa4c02f260 100644
|
||||
--- a/chromeos/settings/timezone_settings.cc
|
||||
+++ b/chromeos/settings/timezone_settings.cc
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "base/bind.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/file_util.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/location.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
@@ -478,8 +479,7 @@ TimezoneSettings* TimezoneSettings::GetInstance() {
|
||||
// static
|
||||
base::string16 TimezoneSettings::GetTimezoneID(const icu::TimeZone& timezone) {
|
||||
icu::UnicodeString id;
|
||||
- timezone.getID(id);
|
||||
- return base::string16(id.getBuffer(), id.length());
|
||||
+ return base::i18n::UnicodeStringToString16(timezone.getID(id));
|
||||
}
|
||||
|
||||
} // namespace system
|
||||
diff --git a/components/autofill/core/browser/autofill_profile_comparator.cc b/components/autofill/core/browser/autofill_profile_comparator.cc
|
||||
index edfe2450d679..227a5901c683 100644
|
||||
--- a/components/autofill/core/browser/autofill_profile_comparator.cc
|
||||
+++ b/components/autofill/core/browser/autofill_profile_comparator.cc
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "base/i18n/case_conversion.h"
|
||||
#include "base/i18n/char_iterator.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
@@ -128,7 +129,7 @@ base::string16 AutofillProfileComparator::NormalizeForComparison(
|
||||
|
||||
icu::UnicodeString value = icu::UnicodeString(result.data(), result.length());
|
||||
transliterator_->transliterate(value);
|
||||
- return base::string16(value.getBuffer(), value.length());
|
||||
+ return base::i18n::UnicodeStringToString16(value);
|
||||
}
|
||||
|
||||
bool AutofillProfileComparator::AreMergeable(const AutofillProfile& p1,
|
||||
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc
|
||||
index 75a34c75a260..76867e0391c2 100644
|
||||
--- a/components/autofill/core/browser/credit_card.cc
|
||||
+++ b/components/autofill/core/browser/credit_card.cc
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <string>
|
||||
|
||||
#include "base/guid.h"
|
||||
+#include "base/i18n/time_formatting.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
@@ -806,7 +808,8 @@ bool CreditCard::ConvertMonth(const base::string16& month,
|
||||
int32_t num_months;
|
||||
const icu::UnicodeString* months = date_format_symbols.getMonths(num_months);
|
||||
for (int32_t i = 0; i < num_months; ++i) {
|
||||
- const base::string16 icu_month(months[i].getBuffer(), months[i].length());
|
||||
+ const base::string16 icu_month(
|
||||
+ base::i18n::UnicodeStringToString16(months[i]));
|
||||
if (compare.StringsEqual(icu_month, month)) {
|
||||
*num = i + 1; // Adjust from 0-indexed to 1-indexed.
|
||||
return true;
|
||||
@@ -819,7 +822,7 @@ bool CreditCard::ConvertMonth(const base::string16& month,
|
||||
base::string16 trimmed_month;
|
||||
base::TrimString(month, ASCIIToUTF16("."), &trimmed_month);
|
||||
for (int32_t i = 0; i < num_months; ++i) {
|
||||
- base::string16 icu_month(months[i].getBuffer(), months[i].length());
|
||||
+ base::string16 icu_month(base::i18n::UnicodeStringToString16(months[i]));
|
||||
base::TrimString(icu_month, ASCIIToUTF16("."), &icu_month);
|
||||
if (compare.StringsEqual(icu_month, trimmed_month)) {
|
||||
*num = i + 1; // Adjust from 0-indexed to 1-indexed.
|
||||
diff --git a/content/browser/android/date_time_chooser_android.cc b/content/browser/android/date_time_chooser_android.cc
|
||||
index ba20ad53bd5c..28b6d03344f0 100644
|
||||
--- a/content/browser/android/date_time_chooser_android.cc
|
||||
+++ b/content/browser/android/date_time_chooser_android.cc
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "base/android/jni_android.h"
|
||||
#include "base/android/jni_string.h"
|
||||
#include "base/i18n/char_iterator.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "content/common/date_time_suggestion.h"
|
||||
#include "content/common/view_messages.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
@@ -36,8 +37,7 @@ base::string16 SanitizeSuggestionString(const base::string16& string) {
|
||||
sanitized.append(c);
|
||||
sanitized_iterator.Advance();
|
||||
}
|
||||
- return base::string16(sanitized.getBuffer(),
|
||||
- static_cast<size_t>(sanitized.length()));
|
||||
+ return base::i18n::UnicodeStringToString16(sanitized);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
diff --git a/content/renderer/android/email_detector.cc b/content/renderer/android/email_detector.cc
|
||||
index 564f3417305f..1a0db8b07a85 100644
|
||||
--- a/content/renderer/android/email_detector.cc
|
||||
+++ b/content/renderer/android/email_detector.cc
|
||||
@@ -62,8 +62,8 @@ bool EmailDetector::FindContent(const base::string16::const_iterator& begin,
|
||||
DCHECK(U_SUCCESS(status));
|
||||
icu::UnicodeString content_ustr(matcher->group(status));
|
||||
DCHECK(U_SUCCESS(status));
|
||||
- base::UTF16ToUTF8(content_ustr.getBuffer(), content_ustr.length(),
|
||||
- content_text);
|
||||
+ content_text->clear();
|
||||
+ content_ustr.toUTF8String(*content_text);
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/ios/chrome/browser/notification_promo_unittest.cc b/ios/chrome/browser/notification_promo_unittest.cc
|
||||
index 830d9c5f65a0..d5356e8e6dcb 100644
|
||||
--- a/ios/chrome/browser/notification_promo_unittest.cc
|
||||
+++ b/ios/chrome/browser/notification_promo_unittest.cc
|
||||
@@ -34,18 +34,14 @@ bool YearFromNow(double* date_epoch, std::string* date_string) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
icu::SimpleDateFormat simple_formatter(icu::UnicodeString(kDateFormat),
|
||||
icu::Locale("en_US"), status);
|
||||
- if (!U_SUCCESS(status))
|
||||
- return false;
|
||||
-
|
||||
icu::UnicodeString date_unicode_string;
|
||||
simple_formatter.format(static_cast<UDate>(*date_epoch * 1000),
|
||||
date_unicode_string, status);
|
||||
- if (!U_SUCCESS(status))
|
||||
+ if (U_FAILURE(status))
|
||||
return false;
|
||||
|
||||
- return base::UTF16ToUTF8(date_unicode_string.getBuffer(),
|
||||
- static_cast<size_t>(date_unicode_string.length()),
|
||||
- date_string);
|
||||
+ date_unicode_string.toUTF8String(*date_string);
|
||||
+ return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc
|
||||
index 00b23b7c10b7..e9331ab3818b 100644
|
||||
--- a/net/ftp/ftp_util.cc
|
||||
+++ b/net/ftp/ftp_util.cc
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "base/i18n/case_conversion.h"
|
||||
#include "base/i18n/char_iterator.h"
|
||||
+#include "base/i18n/unicodestring.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/singleton.h"
|
||||
@@ -175,8 +176,8 @@ class AbbreviatedMonthsMap {
|
||||
format_symbols.getShortMonths(months_count);
|
||||
|
||||
for (int32_t month = 0; month < months_count; month++) {
|
||||
- base::string16 month_name(months[month].getBuffer(),
|
||||
- static_cast<size_t>(months[month].length()));
|
||||
+ base::string16 month_name(
|
||||
+ base::i18n::UnicodeStringToString16(months[month]));
|
||||
|
||||
// Ignore the case of the month names. The simplest way to handle that
|
||||
// is to make everything lowercase.
|
||||
diff --git a/third_party/WebKit/Source/core/html/forms/EmailInputType.cpp b/third_party/WebKit/Source/core/html/forms/EmailInputType.cpp
|
||||
index 07d10a31ffde..4dab06aa19a5 100644
|
||||
--- a/third_party/WebKit/Source/core/html/forms/EmailInputType.cpp
|
||||
+++ b/third_party/WebKit/Source/core/html/forms/EmailInputType.cpp
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
#include "core/html/forms/EmailInputType.h"
|
||||
|
||||
+#include <unicode/idna.h>
|
||||
+#include <unicode/unistr.h>
|
||||
+#include <unicode/uvernum.h>
|
||||
#include "bindings/core/v8/ScriptRegexp.h"
|
||||
#include "core/InputTypeNames.h"
|
||||
#include "core/html/HTMLInputElement.h"
|
||||
@@ -31,8 +34,10 @@
|
||||
#include "platform/text/PlatformLocale.h"
|
||||
#include "public/platform/Platform.h"
|
||||
#include "wtf/text/StringBuilder.h"
|
||||
-#include <unicode/idna.h>
|
||||
-#include <unicode/unistr.h>
|
||||
+
|
||||
+#if U_ICU_VERSION_MAJOR_NUM >= 59
|
||||
+#include <unicode/char16ptr.h>
|
||||
+#endif
|
||||
|
||||
namespace blink {
|
||||
|
||||
@@ -87,7 +92,11 @@ String EmailInputType::convertEmailAddressToASCII(const ScriptRegexp& regexp,
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append(address, 0, atPosition + 1);
|
||||
+#if U_ICU_VERSION_MAJOR_NUM >= 59
|
||||
+ builder.append(icu::toUCharPtr(domainName.getBuffer()), domainName.length());
|
||||
+#else
|
||||
builder.append(domainName.getBuffer(), domainName.length());
|
||||
+#endif
|
||||
String asciiEmail = builder.toString();
|
||||
return isValidEmailAddress(regexp, asciiEmail) ? asciiEmail : address;
|
||||
}
|
||||
diff --git a/third_party/sfntly/src/cpp/src/sample/chromium/subsetter_impl.cc b/third_party/sfntly/src/cpp/src/sample/chromium/subsetter_impl.cc
|
||||
index c53e607..17452e1 100644
|
||||
--- a/third_party/sfntly/src/cpp/src/sample/chromium/subsetter_impl.cc
|
||||
+++ b/third_party/sfntly/src/cpp/src/sample/chromium/subsetter_impl.cc
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
+#include <unicode/unistr.h>
|
||||
+
|
||||
#include "sfntly/table/bitmap/eblc_table.h"
|
||||
#include "sfntly/table/bitmap/ebdt_table.h"
|
||||
#include "sfntly/table/bitmap/index_sub_table.h"
|
||||
--
|
||||
2.14.3
|
||||
@@ -1,66 +0,0 @@
|
||||
From 020c458932087a7da9b514563c3926be5a406d55 Mon Sep 17 00:00:00 2001
|
||||
From: Jungshik Shin <jshin@chromium.org>
|
||||
Date: Mon, 4 Dec 2017 09:42:01 -0500
|
||||
Subject: [PATCH] Disallow 5 aspirational scripts in IDN display
|
||||
|
||||
UTS 31 (http://www.unicode.org/reports/tr31/#Aspirational_Use_Scripts )
|
||||
used to list 5 scripts in Table 6 as 'aspirational scripts', but it
|
||||
deprecated the category and moved 5 scripts to Table 7 for limited use
|
||||
scripts.
|
||||
|
||||
Given this, there's no basis to treat those 5 scripts differently from
|
||||
other limited use scripts. Note that Mozilla stopped allowding those 5
|
||||
scripts in IDN display a while ago.
|
||||
|
||||
This is also necessary for updating ICU to version 60.
|
||||
---
|
||||
components/url_formatter/url_formatter.cc | 33 -------------------------------
|
||||
1 file changed, 33 deletions(-)
|
||||
|
||||
diff --git a/components/url_formatter/url_formatter.cc b/components/url_formatter/url_formatter.cc
|
||||
index a93bf1154c..6b000c3480 100644
|
||||
--- a/components/url_formatter/url_formatter.cc
|
||||
+++ b/components/url_formatter/url_formatter.cc
|
||||
@@ -426,39 +426,6 @@ void IDNSpoofChecker::SetAllowedUnicodeSet(UErrorCode* status) {
|
||||
const icu::UnicodeSet* inclusion_set = uspoof_getInclusionUnicodeSet(status);
|
||||
allowed_set.addAll(*inclusion_set);
|
||||
|
||||
- // Five aspirational scripts are taken from UTR 31 Table 6 at
|
||||
- // http://www.unicode.org/reports/tr31/#Aspirational_Use_Scripts .
|
||||
- // Not all the characters of aspirational scripts are suitable for
|
||||
- // identifiers. Therefore, only characters belonging to
|
||||
- // [:Identifier_Type=Aspirational:] (listed in 'Status/Type=Aspirational'
|
||||
- // section at
|
||||
- // http://www.unicode.org/Public/security/latest/xidmodifications.txt) are
|
||||
- // are added to the allowed set. The list has to be updated when a new
|
||||
- // version of Unicode is released. The current version is 9.0.0 and ICU 60
|
||||
- // will have Unicode 10.0 data.
|
||||
-#if U_ICU_VERSION_MAJOR_NUM < 60
|
||||
- const icu::UnicodeSet aspirational_scripts(
|
||||
- icu::UnicodeString(
|
||||
- // Unified Canadian Syllabics
|
||||
- "[\\u1401-\\u166C\\u166F-\\u167F"
|
||||
- // Mongolian
|
||||
- "\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA"
|
||||
- // Unified Canadian Syllabics
|
||||
- "\\u18B0-\\u18F5"
|
||||
- // Tifinagh
|
||||
- "\\u2D30-\\u2D67\\u2D7F"
|
||||
- // Yi
|
||||
- "\\uA000-\\uA48C"
|
||||
- // Miao
|
||||
- "\\U00016F00-\\U00016F44\\U00016F50-\\U00016F7E"
|
||||
- "\\U00016F8F-\\U00016F9F]",
|
||||
- -1, US_INV),
|
||||
- *status);
|
||||
- allowed_set.addAll(aspirational_scripts);
|
||||
-#else
|
||||
-#error "Update aspirational_scripts per Unicode 10.0"
|
||||
-#endif
|
||||
-
|
||||
// U+0338 is included in the recommended set, while U+05F4 and U+2027 are in
|
||||
// the inclusion set. However, they are blacklisted as a part of Mozilla's
|
||||
// IDN blacklist (http://kb.mozillazine.org/Network.IDN.blacklist_chars).
|
||||
--
|
||||
2.14.3
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
From 2f2028a19fd12477fcd9050ea354174f33b68b46 Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Mon, 21 Aug 2017 10:16:44 -0400
|
||||
Subject: [PATCH] LTO fixes
|
||||
|
||||
---
|
||||
build/config/compiler/BUILD.gn | 35 +++++++++++++++++++++++++----------
|
||||
build/config/posix/BUILD.gn | 2 +-
|
||||
build/toolchain/gcc_ar_wrapper.py | 12 +++++++++++-
|
||||
3 files changed, 37 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
|
||||
index d0510b8..583f186 100644
|
||||
--- a/build/config/compiler/BUILD.gn
|
||||
+++ b/build/config/compiler/BUILD.gn
|
||||
@@ -448,20 +448,35 @@ config("compiler") {
|
||||
} else {
|
||||
# Note: ThinLTO does not currently have this feature implemented
|
||||
# For Full LTO, it provides a measurable runtime speedup of Chrome.
|
||||
- cflags += [
|
||||
- "-flto",
|
||||
- "-fwhole-program-vtables",
|
||||
- ]
|
||||
- ldflags += [
|
||||
- "-flto",
|
||||
- "-fwhole-program-vtables",
|
||||
- ]
|
||||
+ if (is_clang) {
|
||||
+ cflags += [
|
||||
+ "-flto",
|
||||
+ "-fwhole-program-vtables"
|
||||
+ ]
|
||||
+ ldflags += [
|
||||
+ "-flto",
|
||||
+ "-fwhole-program-vtables"
|
||||
+ ]
|
||||
+ } else {
|
||||
+ cflags += [
|
||||
+ "-flto=4",
|
||||
+ "-fno-fat-lto-objects",
|
||||
+ "-fuse-linker-plugin",
|
||||
+ "--param=lto-partitions=1",
|
||||
+ ]
|
||||
+ ldflags += [
|
||||
+ "-flto=4",
|
||||
+ "-fno-fat-lto-objects",
|
||||
+ "-fuse-linker-plugin",
|
||||
+ "--param=lto-partitions=1",
|
||||
+ ]
|
||||
+ }
|
||||
|
||||
# Apply a lower LTO optimization level as the default is too slow.
|
||||
if (is_linux) {
|
||||
if (use_lld) {
|
||||
ldflags += [ "-Wl,--lto-O1" ]
|
||||
- } else {
|
||||
+ } else if (is_clang) {
|
||||
ldflags += [ "-Wl,-plugin-opt,O1" ]
|
||||
}
|
||||
} else if (is_mac) {
|
||||
@@ -478,7 +493,7 @@ config("compiler") {
|
||||
# targeting ARM, without this flag, LTO produces a .text section that is
|
||||
# larger than the maximum call displacement, preventing the linker from
|
||||
# relocating calls (http://llvm.org/PR22999).
|
||||
- if (is_linux) {
|
||||
+ if (is_linux && is_clang) {
|
||||
ldflags += [ "-Wl,-plugin-opt,-function-sections" ]
|
||||
}
|
||||
}
|
||||
diff --git a/build/config/posix/BUILD.gn b/build/config/posix/BUILD.gn
|
||||
index d7e917a..fc68864 100644
|
||||
--- a/build/config/posix/BUILD.gn
|
||||
+++ b/build/config/posix/BUILD.gn
|
||||
@@ -21,7 +21,7 @@ config("compiler") {
|
||||
if ((allow_posix_link_time_opt || is_cfi) && !is_nacl) {
|
||||
arflags = [
|
||||
"--plugin",
|
||||
- rebase_path("$clang_base_path/lib/LLVMgold.so", root_build_dir),
|
||||
+ "auto"
|
||||
]
|
||||
}
|
||||
}
|
||||
diff --git a/build/toolchain/gcc_ar_wrapper.py b/build/toolchain/gcc_ar_wrapper.py
|
||||
index de53df0..39c7b56 100755
|
||||
--- a/build/toolchain/gcc_ar_wrapper.py
|
||||
+++ b/build/toolchain/gcc_ar_wrapper.py
|
||||
@@ -47,7 +47,17 @@ def main():
|
||||
|
||||
command = [args.ar, args.operation]
|
||||
if args.plugin is not None:
|
||||
- command += ['--plugin', args.plugin]
|
||||
+ if args.plugin == 'auto':
|
||||
+ gcc = os.environ.get('CC', '/usr/bin/cc')
|
||||
+ gcc_ver = subprocess.check_output([gcc, '-dumpversion'],
|
||||
+ universal_newlines=True)
|
||||
+ gcc_ver = gcc_ver.strip(' \n')
|
||||
+ plugin = '/usr/libexec/gcc/x86_64-pc-linux-gnu/{}/liblto_plugin.so'. \
|
||||
+ format(gcc_ver)
|
||||
+ else:
|
||||
+ plugin = args.plugin
|
||||
+
|
||||
+ command += ['--plugin', plugin]
|
||||
command.append(args.output)
|
||||
command += args.inputs
|
||||
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
diff --git a/v8/gypfiles/detect_v8_host_arch.py b/v8/gypfiles/detect_v8_host_arch.py
|
||||
index 89e8286..cc61946 100644
|
||||
--- a/v8/gypfiles/detect_v8_host_arch.py
|
||||
+++ b/v8/gypfiles/detect_v8_host_arch.py
|
||||
@@ -28,13 +28,15 @@
|
||||
|
||||
"""Outputs host CPU architecture in format recognized by gyp."""
|
||||
|
||||
+from __future__ import print_function
|
||||
+
|
||||
import platform
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
- print DoMain([])
|
||||
+ print(DoMain([]))
|
||||
return 0
|
||||
|
||||
def DoMain(_):
|
||||
diff --git a/v8/gypfiles/toolchain.gypi b/v8/gypfiles/toolchain.gypi
|
||||
index 95eb1d9..1ec652a 100644
|
||||
--- a/v8/gypfiles/toolchain.gypi
|
||||
+++ b/v8/gypfiles/toolchain.gypi
|
||||
@@ -40,7 +40,7 @@
|
||||
'has_valgrind%': 0,
|
||||
'coverage%': 0,
|
||||
'v8_target_arch%': '<(target_arch)',
|
||||
- 'v8_host_byteorder%': '<!(python -c "import sys; print sys.byteorder")',
|
||||
+ 'v8_host_byteorder%': '<!(python -c "from __future__ import print_function; import sys; print(sys.byteorder)")',
|
||||
'force_dynamic_crt%': 0,
|
||||
|
||||
# Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/components/test_runner/BUILD.gn~ b/components/test_runner/BUILD.gn
|
||||
index 3ac8955..6a968cb 100644
|
||||
--- a/components/test_runner/BUILD.gn~
|
||||
+++ b/components/test_runner/BUILD.gn
|
||||
@@ -155,8 +155,6 @@ if (use_x11) {
|
||||
copy("copy_x11_fonts") {
|
||||
visibility = [ ":*" ]
|
||||
sources = [
|
||||
- "//third_party/gardiner_mod/GardinerModBug.ttf",
|
||||
- "//third_party/gardiner_mod/GardinerModCat.ttf",
|
||||
"resources/fonts/fonts.conf",
|
||||
]
|
||||
outputs = [
|
||||
@@ -1,19 +0,0 @@
|
||||
diff --git a/v8/gni/v8.gni.orig b/v8/gni/v8.gni
|
||||
index 264c1de..df17239 100644
|
||||
--- a/v8/gni/v8.gni.orig
|
||||
+++ b/v8/gni/v8.gni
|
||||
@@ -114,13 +114,7 @@ template("v8_executable") {
|
||||
}
|
||||
|
||||
template("v8_component") {
|
||||
- if (is_electron_build && !is_component_build &&
|
||||
- (target_name == "v8_libbase" || target_name == "v8_libplatform")) {
|
||||
- v8_component = "source_set"
|
||||
- } else {
|
||||
- v8_component = component_electron
|
||||
- }
|
||||
- target(v8_component, target_name) {
|
||||
+ component(target_name) {
|
||||
forward_variables_from(invoker, "*", [ "configs" ])
|
||||
configs += invoker.configs
|
||||
configs -= v8_remove_configs
|
||||
@@ -1,48 +0,0 @@
|
||||
--- a/media/ffmpeg/ffmpeg_common.h.orig 2016-09-09 13:16:07.757294768 +0000
|
||||
+++ b/media/ffmpeg/ffmpeg_common.h 2016-09-09 13:16:41.705989273 +0000
|
||||
@@ -22,10 +22,6 @@
|
||||
|
||||
// Include FFmpeg header files.
|
||||
extern "C" {
|
||||
-// Disable deprecated features which result in spammy compile warnings. This
|
||||
-// list of defines must mirror those in the 'defines' section of FFmpeg's
|
||||
-// BUILD.gn file or the headers below will generate different structures!
|
||||
-#define FF_API_CONVERGENCE_DURATION 0
|
||||
// Upstream libavcodec/utils.c still uses the deprecated
|
||||
// av_dup_packet(), causing deprecation warnings.
|
||||
// The normal fix for such things is to disable the feature as below,
|
||||
@@ -35,7 +35,6 @@
|
||||
MSVC_PUSH_DISABLE_WARNING(4244);
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
-#include <libavformat/internal.h>
|
||||
#include <libavformat/avio.h>
|
||||
#include <libavutil/avutil.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
--- a/media/filters/ffmpeg_demuxer.cc.orig 2016-09-09 14:21:40.185828912 +0000
|
||||
+++ b/media/filters/ffmpeg_demuxer.cc 2016-09-09 14:21:52.894089352 +0000
|
||||
@@ -1185,24 +1185,6 @@
|
||||
// If no estimate is found, the stream entry will be kInfiniteDuration.
|
||||
std::vector<base::TimeDelta> start_time_estimates(format_context->nb_streams,
|
||||
kInfiniteDuration);
|
||||
- const AVFormatInternal* internal = format_context->internal;
|
||||
- if (internal && internal->packet_buffer &&
|
||||
- format_context->start_time != static_cast<int64_t>(AV_NOPTS_VALUE)) {
|
||||
- struct AVPacketList* packet_buffer = internal->packet_buffer;
|
||||
- while (packet_buffer != internal->packet_buffer_end) {
|
||||
- DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index),
|
||||
- start_time_estimates.size());
|
||||
- const AVStream* stream =
|
||||
- format_context->streams[packet_buffer->pkt.stream_index];
|
||||
- if (packet_buffer->pkt.pts != static_cast<int64_t>(AV_NOPTS_VALUE)) {
|
||||
- const base::TimeDelta packet_pts =
|
||||
- ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts);
|
||||
- if (packet_pts < start_time_estimates[stream->index])
|
||||
- start_time_estimates[stream->index] = packet_pts;
|
||||
- }
|
||||
- packet_buffer = packet_buffer->next;
|
||||
- }
|
||||
- }
|
||||
|
||||
std::unique_ptr<MediaTracks> media_tracks(new MediaTracks());
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
From 520c62f2b87a42bf4f8f8820f6bcde15e342fe4a Mon Sep 17 00:00:00 2001
|
||||
From: floppymaster <floppymaster@gmail.com>
|
||||
Date: Mon, 12 Jun 2017 09:44:54 -0700
|
||||
Subject: [PATCH] ICU unbundling fixes
|
||||
|
||||
Update instructions to generate ICU header lists
|
||||
Update header list for unbundling ICU 59
|
||||
|
||||
Bug: https://bugs.gentoo.org/619796#c2
|
||||
Review-Url: https://codereview.chromium.org/2935603002
|
||||
Cr-Commit-Position: refs/heads/master@{#478662}
|
||||
---
|
||||
build/linux/unbundle/icu.gn | 29 +++++++++++++++++------------
|
||||
1 file changed, 17 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/build/linux/unbundle/icu.gn b/build/linux/unbundle/icu.gn
|
||||
index f3734b7a01a3..5bdd91555df7 100644
|
||||
--- a/build/linux/unbundle/icu.gn
|
||||
+++ b/build/linux/unbundle/icu.gn
|
||||
@@ -16,6 +16,7 @@ config("icu_config") {
|
||||
defines = [
|
||||
"USING_SYSTEM_ICU=1",
|
||||
"ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
|
||||
+ "UCHAR_TYPE=uint16_t",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -50,10 +51,9 @@ source_set("icuuc") {
|
||||
shim_headers("icui18n_shim") {
|
||||
root_path = "source/i18n"
|
||||
headers = [
|
||||
- # This list can easily be updated using the command below:
|
||||
- # find third_party/icu/source/i18n/unicode \
|
||||
- # -iname '*.h' -printf '"%p",\n' | \
|
||||
- # sed -e 's|third_party/icu/i18n/common/||' | sort -u
|
||||
+ # This list can easily be updated using the commands below:
|
||||
+ # cd third_party/icu/source/i18n
|
||||
+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
|
||||
"unicode/alphaindex.h",
|
||||
"unicode/basictz.h",
|
||||
"unicode/calendar.h",
|
||||
@@ -78,7 +78,6 @@ shim_headers("icui18n_shim") {
|
||||
"unicode/fpositer.h",
|
||||
"unicode/gender.h",
|
||||
"unicode/gregocal.h",
|
||||
- "unicode/locdspnm.h",
|
||||
"unicode/measfmt.h",
|
||||
"unicode/measunit.h",
|
||||
"unicode/measure.h",
|
||||
@@ -113,15 +112,12 @@ shim_headers("icui18n_shim") {
|
||||
"unicode/ucol.h",
|
||||
"unicode/ucoleitr.h",
|
||||
"unicode/ucsdet.h",
|
||||
- "unicode/ucurr.h",
|
||||
"unicode/udat.h",
|
||||
"unicode/udateintervalformat.h",
|
||||
"unicode/udatpg.h",
|
||||
- "unicode/udisplaycontext.h",
|
||||
"unicode/ufieldpositer.h",
|
||||
"unicode/uformattable.h",
|
||||
"unicode/ugender.h",
|
||||
- "unicode/uldnames.h",
|
||||
"unicode/ulocdata.h",
|
||||
"unicode/umsg.h",
|
||||
"unicode/unirepl.h",
|
||||
@@ -130,6 +126,7 @@ shim_headers("icui18n_shim") {
|
||||
"unicode/upluralrules.h",
|
||||
"unicode/uregex.h",
|
||||
"unicode/uregion.h",
|
||||
+ "unicode/ureldatefmt.h",
|
||||
"unicode/usearch.h",
|
||||
"unicode/uspoof.h",
|
||||
"unicode/utmscale.h",
|
||||
@@ -141,20 +138,22 @@ shim_headers("icui18n_shim") {
|
||||
shim_headers("icuuc_shim") {
|
||||
root_path = "source/common"
|
||||
headers = [
|
||||
- # This list can easily be updated using the command below:
|
||||
- # find third_party/icu/source/common/unicode \
|
||||
- # -iname '*.h' -printf '"%p",\n' | \
|
||||
- # sed -e 's|third_party/icu/source/common/||' | sort -u
|
||||
+ # This list can easily be updated using the commands below:
|
||||
+ # cd third_party/icu/source/common
|
||||
+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
|
||||
"unicode/appendable.h",
|
||||
"unicode/brkiter.h",
|
||||
"unicode/bytestream.h",
|
||||
"unicode/bytestrie.h",
|
||||
"unicode/bytestriebuilder.h",
|
||||
"unicode/caniter.h",
|
||||
+ "unicode/casemap.h",
|
||||
+ "unicode/char16ptr.h",
|
||||
"unicode/chariter.h",
|
||||
"unicode/dbbi.h",
|
||||
"unicode/docmain.h",
|
||||
"unicode/dtintrv.h",
|
||||
+ "unicode/edits.h",
|
||||
"unicode/enumset.h",
|
||||
"unicode/errorcode.h",
|
||||
"unicode/filteredbrk.h",
|
||||
@@ -163,6 +162,7 @@ shim_headers("icuuc_shim") {
|
||||
"unicode/idna.h",
|
||||
"unicode/listformatter.h",
|
||||
"unicode/localpointer.h",
|
||||
+ "unicode/locdspnm.h",
|
||||
"unicode/locid.h",
|
||||
"unicode/messagepattern.h",
|
||||
"unicode/normalizer2.h",
|
||||
@@ -176,12 +176,14 @@ shim_headers("icuuc_shim") {
|
||||
"unicode/rep.h",
|
||||
"unicode/resbund.h",
|
||||
"unicode/schriter.h",
|
||||
+ "unicode/simpleformatter.h",
|
||||
"unicode/std_string.h",
|
||||
"unicode/strenum.h",
|
||||
"unicode/stringpiece.h",
|
||||
"unicode/stringtriebuilder.h",
|
||||
"unicode/symtable.h",
|
||||
"unicode/ubidi.h",
|
||||
+ "unicode/ubiditransform.h",
|
||||
"unicode/ubrk.h",
|
||||
"unicode/ucasemap.h",
|
||||
"unicode/ucat.h",
|
||||
@@ -195,10 +197,13 @@ shim_headers("icuuc_shim") {
|
||||
"unicode/ucnv_err.h",
|
||||
"unicode/ucnvsel.h",
|
||||
"unicode/uconfig.h",
|
||||
+ "unicode/ucurr.h",
|
||||
"unicode/udata.h",
|
||||
+ "unicode/udisplaycontext.h",
|
||||
"unicode/uenum.h",
|
||||
"unicode/uidna.h",
|
||||
"unicode/uiter.h",
|
||||
+ "unicode/uldnames.h",
|
||||
"unicode/ulistformatter.h",
|
||||
"unicode/uloc.h",
|
||||
"unicode/umachine.h",
|
||||
--
|
||||
2.14.3
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
From fd5b3e755df541b44128caed625215017ef59989 Mon Sep 17 00:00:00 2001
|
||||
From: jshin <jshin@chromium.org>
|
||||
Date: Thu, 9 Mar 2017 12:01:15 -0800
|
||||
Subject: [PATCH] Prepare for ICU's switch to char16_t
|
||||
|
||||
ICU's UChar was uint16_t (non-Win) or wchar_t (Windows). It's switching
|
||||
to char16_t in both C/C++ API. It needs some changes. Fortunately,
|
||||
v8 needs only a couple of changes because v8 has been using
|
||||
reinterpret_cast in many places calling ICU API.
|
||||
|
||||
This change was confirmed to work fine with ICU-59-to-be.
|
||||
|
||||
BUG=v8:6062
|
||||
TEST=trybot
|
||||
|
||||
Review-Url: https://codereview.chromium.org/2738503008
|
||||
Cr-Commit-Position: refs/heads/master@{#43707}
|
||||
---
|
||||
src/i18n.cc | 12 +++++++++++-
|
||||
src/runtime/runtime-i18n.cc | 10 ++++++----
|
||||
2 files changed, 17 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/v8/src/i18n.cc b/v8/src/i18n.cc
|
||||
index d2245ef34a9..7c22871ff5e 100644
|
||||
--- a/v8/src/i18n.cc
|
||||
+++ b/v8/src/i18n.cc
|
||||
@@ -30,8 +30,13 @@
|
||||
#include "unicode/ucol.h"
|
||||
#include "unicode/ucurr.h"
|
||||
#include "unicode/unum.h"
|
||||
+#include "unicode/uvernum.h"
|
||||
#include "unicode/uversion.h"
|
||||
|
||||
+#if U_ICU_VERSION_MAJOR_NUM >= 59
|
||||
+#include "unicode/char16ptr.h"
|
||||
+#endif
|
||||
+
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
@@ -270,8 +275,13 @@ icu::DecimalFormat* CreateICUNumberFormat(
|
||||
}
|
||||
|
||||
UErrorCode status_digits = U_ZERO_ERROR;
|
||||
+#if U_ICU_VERSION_MAJOR_NUM >= 59
|
||||
uint32_t fraction_digits = ucurr_getDefaultFractionDigits(
|
||||
- currency.getTerminatedBuffer(), &status_digits);
|
||||
+ icu::toUCharPtr(currency.getTerminatedBuffer()), &status_digits);
|
||||
+#else
|
||||
+ uint32_t fraction_digits = ucurr_getDefaultFractionDigits(
|
||||
+ currency.getTerminatedBuffer(), &status_digits);
|
||||
+#endif
|
||||
if (U_SUCCESS(status_digits)) {
|
||||
number_format->setMinimumFractionDigits(fraction_digits);
|
||||
number_format->setMaximumFractionDigits(fraction_digits);
|
||||
diff --git a/v8/src/runtime/runtime-i18n.cc b/v8/src/runtime/runtime-i18n.cc
|
||||
index 0b453819146..e89175a37db 100644
|
||||
--- a/v8/src/runtime/runtime-i18n.cc
|
||||
+++ b/v8/src/runtime/runtime-i18n.cc
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "unicode/uloc.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/unum.h"
|
||||
+#include "unicode/ustring.h"
|
||||
#include "unicode/uversion.h"
|
||||
|
||||
|
||||
@@ -609,10 +610,11 @@ RUNTIME_FUNCTION(Runtime_InternalCompare) {
|
||||
String::FlatContent flat2 = string2->GetFlatContent();
|
||||
std::unique_ptr<uc16[]> sap1;
|
||||
std::unique_ptr<uc16[]> sap2;
|
||||
- const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1);
|
||||
- const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2);
|
||||
- result =
|
||||
- collator->compare(string_val1, length1, string_val2, length2, status);
|
||||
+ icu::UnicodeString string_val1(
|
||||
+ FALSE, GetUCharBufferFromFlat(flat1, &sap1, length1), length1);
|
||||
+ icu::UnicodeString string_val2(
|
||||
+ FALSE, GetUCharBufferFromFlat(flat2, &sap2, length2), length2);
|
||||
+ result = collator->compare(string_val1, string_val2, status);
|
||||
}
|
||||
if (U_FAILURE(status)) return isolate->ThrowIllegalOperation();
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
From 6f067da77b786787c6a3c3253198b0516da79904 Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Mon, 27 Nov 2017 17:26:03 -0500
|
||||
Subject: [PATCH] glibc-2.26 compatibility fix
|
||||
|
||||
---
|
||||
.../linux/dump_writer_common/ucontext_reader.cc | 30 +++++++++++-----------
|
||||
.../linux/dump_writer_common/ucontext_reader.h | 10 ++++----
|
||||
src/client/linux/handler/exception_handler.cc | 10 ++++----
|
||||
src/client/linux/handler/exception_handler.h | 2 +-
|
||||
.../linux/microdump_writer/microdump_writer.cc | 2 +-
|
||||
.../linux/minidump_writer/minidump_writer.cc | 2 +-
|
||||
6 files changed, 28 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/src/client/linux/dump_writer_common/ucontext_reader.cc b/src/client/linux/dump_writer_common/ucontext_reader.cc
|
||||
index c80724dd..93b4d9f8 100644
|
||||
--- a/src/client/linux/dump_writer_common/ucontext_reader.cc
|
||||
+++ b/src/client/linux/dump_writer_common/ucontext_reader.cc
|
||||
@@ -40,15 +40,15 @@ namespace google_breakpad {
|
||||
|
||||
#if defined(__i386__)
|
||||
|
||||
-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.gregs[REG_ESP];
|
||||
}
|
||||
|
||||
-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.gregs[REG_EIP];
|
||||
}
|
||||
|
||||
-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
|
||||
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
|
||||
const struct _libc_fpstate* fp) {
|
||||
const greg_t* regs = uc->uc_mcontext.gregs;
|
||||
|
||||
@@ -88,15 +88,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
|
||||
|
||||
#elif defined(__x86_64)
|
||||
|
||||
-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.gregs[REG_RSP];
|
||||
}
|
||||
|
||||
-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.gregs[REG_RIP];
|
||||
}
|
||||
|
||||
-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
|
||||
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
|
||||
const struct _libc_fpstate* fpregs) {
|
||||
const greg_t* regs = uc->uc_mcontext.gregs;
|
||||
|
||||
@@ -145,15 +145,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
|
||||
|
||||
#elif defined(__ARM_EABI__)
|
||||
|
||||
-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.arm_sp;
|
||||
}
|
||||
|
||||
-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.arm_pc;
|
||||
}
|
||||
|
||||
-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
|
||||
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
|
||||
out->context_flags = MD_CONTEXT_ARM_FULL;
|
||||
|
||||
out->iregs[0] = uc->uc_mcontext.arm_r0;
|
||||
@@ -184,15 +184,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
|
||||
|
||||
#elif defined(__aarch64__)
|
||||
|
||||
-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.sp;
|
||||
}
|
||||
|
||||
-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.pc;
|
||||
}
|
||||
|
||||
-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
|
||||
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
|
||||
const struct fpsimd_context* fpregs) {
|
||||
out->context_flags = MD_CONTEXT_ARM64_FULL;
|
||||
|
||||
@@ -210,15 +210,15 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc,
|
||||
|
||||
#elif defined(__mips__)
|
||||
|
||||
-uintptr_t UContextReader::GetStackPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP];
|
||||
}
|
||||
|
||||
-uintptr_t UContextReader::GetInstructionPointer(const struct ucontext* uc) {
|
||||
+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
|
||||
return uc->uc_mcontext.pc;
|
||||
}
|
||||
|
||||
-void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext *uc) {
|
||||
+void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
|
||||
#if _MIPS_SIM == _ABI64
|
||||
out->context_flags = MD_CONTEXT_MIPS64_FULL;
|
||||
#elif _MIPS_SIM == _ABIO32
|
||||
diff --git a/src/client/linux/dump_writer_common/ucontext_reader.h b/src/client/linux/dump_writer_common/ucontext_reader.h
|
||||
index b6e77b4b..2369a9ad 100644
|
||||
--- a/src/client/linux/dump_writer_common/ucontext_reader.h
|
||||
+++ b/src/client/linux/dump_writer_common/ucontext_reader.h
|
||||
@@ -41,21 +41,21 @@ namespace google_breakpad {
|
||||
|
||||
// Wraps platform-dependent implementations of accessors to ucontext structs.
|
||||
struct UContextReader {
|
||||
- static uintptr_t GetStackPointer(const struct ucontext* uc);
|
||||
+ static uintptr_t GetStackPointer(const ucontext_t* uc);
|
||||
|
||||
- static uintptr_t GetInstructionPointer(const struct ucontext* uc);
|
||||
+ static uintptr_t GetInstructionPointer(const ucontext_t* uc);
|
||||
|
||||
// Juggle a arch-specific ucontext into a minidump format
|
||||
// out: the minidump structure
|
||||
// info: the collection of register structures.
|
||||
#if defined(__i386__) || defined(__x86_64)
|
||||
- static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
|
||||
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
|
||||
const struct _libc_fpstate* fp);
|
||||
#elif defined(__aarch64__)
|
||||
- static void FillCPUContext(RawContextCPU *out, const ucontext *uc,
|
||||
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
|
||||
const struct fpsimd_context* fpregs);
|
||||
#else
|
||||
- static void FillCPUContext(RawContextCPU *out, const ucontext *uc);
|
||||
+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc);
|
||||
#endif
|
||||
};
|
||||
|
||||
diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
|
||||
index 148d61f9..9d53c11e 100644
|
||||
--- a/src/client/linux/handler/exception_handler.cc
|
||||
+++ b/src/client/linux/handler/exception_handler.cc
|
||||
@@ -439,9 +439,9 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
|
||||
// Fill in all the holes in the struct to make Valgrind happy.
|
||||
memset(&g_crash_context_, 0, sizeof(g_crash_context_));
|
||||
memcpy(&g_crash_context_.siginfo, info, sizeof(siginfo_t));
|
||||
- memcpy(&g_crash_context_.context, uc, sizeof(struct ucontext));
|
||||
+ memcpy(&g_crash_context_.context, uc, sizeof(ucontext_t));
|
||||
#if defined(__aarch64__)
|
||||
- struct ucontext* uc_ptr = (struct ucontext*)uc;
|
||||
+ ucontext_t* uc_ptr = (ucontext_t*)uc;
|
||||
struct fpsimd_context* fp_ptr =
|
||||
(struct fpsimd_context*)&uc_ptr->uc_mcontext.__reserved;
|
||||
if (fp_ptr->head.magic == FPSIMD_MAGIC) {
|
||||
@@ -450,9 +450,9 @@ bool ExceptionHandler::HandleSignal(int sig, siginfo_t* info, void* uc) {
|
||||
}
|
||||
#elif !defined(__ARM_EABI__) && !defined(__mips__)
|
||||
// FP state is not part of user ABI on ARM Linux.
|
||||
- // In case of MIPS Linux FP state is already part of struct ucontext
|
||||
+ // In case of MIPS Linux FP state is already part of ucontext_t
|
||||
// and 'float_state' is not a member of CrashContext.
|
||||
- struct ucontext* uc_ptr = (struct ucontext*)uc;
|
||||
+ ucontext_t* uc_ptr = (ucontext_t*)uc;
|
||||
if (uc_ptr->uc_mcontext.fpregs) {
|
||||
memcpy(&g_crash_context_.float_state, uc_ptr->uc_mcontext.fpregs,
|
||||
sizeof(g_crash_context_.float_state));
|
||||
@@ -476,7 +476,7 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) {
|
||||
// ExceptionHandler::HandleSignal().
|
||||
siginfo.si_code = SI_USER;
|
||||
siginfo.si_pid = getpid();
|
||||
- struct ucontext context;
|
||||
+ ucontext_t context;
|
||||
getcontext(&context);
|
||||
return HandleSignal(sig, &siginfo, &context);
|
||||
}
|
||||
diff --git a/src/client/linux/handler/exception_handler.h b/src/client/linux/handler/exception_handler.h
|
||||
index 591c3108..846df772 100644
|
||||
--- a/src/client/linux/handler/exception_handler.h
|
||||
+++ b/src/client/linux/handler/exception_handler.h
|
||||
@@ -191,7 +191,7 @@ class ExceptionHandler {
|
||||
struct CrashContext {
|
||||
siginfo_t siginfo;
|
||||
pid_t tid; // the crashing thread.
|
||||
- struct ucontext context;
|
||||
+ ucontext_t context;
|
||||
#if !defined(__ARM_EABI__) && !defined(__mips__)
|
||||
// #ifdef this out because FP state is not part of user ABI for Linux ARM.
|
||||
// In case of MIPS Linux FP state is already part of struct
|
||||
diff --git a/src/client/linux/microdump_writer/microdump_writer.cc b/src/client/linux/microdump_writer/microdump_writer.cc
|
||||
index d459d9ec..759f432e 100644
|
||||
--- a/src/client/linux/microdump_writer/microdump_writer.cc
|
||||
+++ b/src/client/linux/microdump_writer/microdump_writer.cc
|
||||
@@ -416,7 +416,7 @@ class MicrodumpWriter {
|
||||
|
||||
void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
|
||||
|
||||
- const struct ucontext* const ucontext_;
|
||||
+ const ucontext_t* const ucontext_;
|
||||
#if !defined(__ARM_EABI__) && !defined(__mips__)
|
||||
const google_breakpad::fpstate_t* const float_state_;
|
||||
#endif
|
||||
diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc
|
||||
index f407caa7..407c1e32 100644
|
||||
--- a/src/client/linux/minidump_writer/minidump_writer.cc
|
||||
+++ b/src/client/linux/minidump_writer/minidump_writer.cc
|
||||
@@ -1240,7 +1240,7 @@ class MinidumpWriter {
|
||||
const int fd_; // File descriptor where the minidum should be written.
|
||||
const char* path_; // Path to the file where the minidum should be written.
|
||||
|
||||
- const struct ucontext* const ucontext_; // also from the signal handler
|
||||
+ const ucontext_t* const ucontext_; // also from the signal handler
|
||||
#if !defined(__ARM_EABI__) && !defined(__mips__)
|
||||
const google_breakpad::fpstate_t* const float_state_; // ditto
|
||||
#endif
|
||||
--
|
||||
2.14.3
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
From 055fb62fc58ef7027b444dd235bc4781effa30d7 Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Mon, 2 Oct 2017 15:22:51 -0400
|
||||
Subject: [PATCH] Gentoo build fixes
|
||||
|
||||
---
|
||||
brightray.gyp | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
brightray.gypi | 14 ++-------
|
||||
2 files changed, 88 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/brightray.gyp b/brightray.gyp
|
||||
index e60d17a..79e0618 100644
|
||||
--- a/brightray.gyp
|
||||
+++ b/brightray.gyp
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
'variables': {
|
||||
# The libraries brightray will be compiled to.
|
||||
- 'linux_system_libraries': 'gtk+-2.0 dbus-1 x11 x11-xcb xcb xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gconf-2.0 gmodule-2.0 nss'
|
||||
+ 'linux_system_libraries': 'gtk+-2.0 dbus-1 x11 x11-xcb xcb xi xcursor xdamage xrandr xcomposite xext xfixes xrender xtst xscrnsaver gmodule-2.0 nss'
|
||||
},
|
||||
'includes': [
|
||||
'filenames.gypi',
|
||||
@@ -9,6 +9,11 @@
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'brightray',
|
||||
+ 'dependencies': [
|
||||
+ 'cups',
|
||||
+ 'gconf',
|
||||
+ 'icu',
|
||||
+ ],
|
||||
'type': 'static_library',
|
||||
'include_dirs': [
|
||||
'.',
|
||||
@@ -130,18 +135,33 @@
|
||||
}, {
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
- # Link with ffmpeg.
|
||||
- '<(libchromiumcontent_dir)/libffmpeg.so',
|
||||
# Following libraries are required by libchromiumcontent:
|
||||
+ '-lFLAC',
|
||||
'-lasound',
|
||||
+ '-lavcodec',
|
||||
+ '-lavformat',
|
||||
+ '-lavutil',
|
||||
'-lcap',
|
||||
- '-lcups',
|
||||
- '-lrt',
|
||||
+ '-lcrypto',
|
||||
'-ldl',
|
||||
- '-lresolv',
|
||||
+ '-lexpat',
|
||||
'-lfontconfig',
|
||||
'-lfreetype',
|
||||
- '-lexpat',
|
||||
+ '-lharfbuzz',
|
||||
+ '-ljpeg',
|
||||
+ '-lminizip',
|
||||
+ '-lpng',
|
||||
+ '-lre2',
|
||||
+ '-lresolv',
|
||||
+ '-lrt',
|
||||
+ '-lsnappy',
|
||||
+ '-lssl',
|
||||
+ '-lvpx',
|
||||
+ '-lwebp',
|
||||
+ '-lwebpdemux',
|
||||
+ '-lxml2',
|
||||
+ '-lxslt',
|
||||
+ '-lz',
|
||||
],
|
||||
},
|
||||
}],
|
||||
@@ -390,5 +410,64 @@
|
||||
}], # OS=="win"
|
||||
],
|
||||
},
|
||||
+ {
|
||||
+ 'target_name': 'gconf',
|
||||
+ 'type': 'none',
|
||||
+ 'conditions': [
|
||||
+ ['use_gconf==1 and _toolset=="target"', {
|
||||
+ 'direct_dependent_settings': {
|
||||
+ 'cflags': [
|
||||
+ '<!@(<(pkg-config) --cflags gconf-2.0)',
|
||||
+ ],
|
||||
+ 'defines': [
|
||||
+ 'USE_GCONF',
|
||||
+ ],
|
||||
+ },
|
||||
+ 'link_settings': {
|
||||
+ 'ldflags': [
|
||||
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other gconf-2.0)',
|
||||
+ ],
|
||||
+ 'libraries': [
|
||||
+ '<!@(<(pkg-config) --libs-only-l gconf-2.0)',
|
||||
+ ],
|
||||
+ },
|
||||
+ }],
|
||||
+ ],
|
||||
+ },
|
||||
+ {
|
||||
+ 'target_name': 'cups',
|
||||
+ 'type': 'none',
|
||||
+ 'conditions': [
|
||||
+ ['use_cups==1', {
|
||||
+ 'direct_dependent_settings': {
|
||||
+ 'defines': [
|
||||
+ 'USE_CUPS',
|
||||
+ ],
|
||||
+ 'link_settings': {
|
||||
+ 'libraries': [
|
||||
+ '-lcups',
|
||||
+ ],
|
||||
+ },
|
||||
+ },
|
||||
+ }],
|
||||
+ ],
|
||||
+ },
|
||||
+ {
|
||||
+ 'target_name': 'icu',
|
||||
+ 'type': 'none',
|
||||
+ 'conditions': [
|
||||
+ ['use_system_icu==1', {
|
||||
+ 'direct_dependent_settings': {
|
||||
+ 'link_settings': {
|
||||
+ 'libraries': [
|
||||
+ '-licui18n',
|
||||
+ '-licuuc',
|
||||
+ '-licudata',
|
||||
+ ],
|
||||
+ },
|
||||
+ },
|
||||
+ }],
|
||||
+ ],
|
||||
+ },
|
||||
],
|
||||
}
|
||||
diff --git a/brightray.gypi b/brightray.gypi
|
||||
index 064ae1a..95d6f14 100644
|
||||
--- a/brightray.gypi
|
||||
+++ b/brightray.gypi
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
'includes': [
|
||||
- 'vendor/download/libchromiumcontent/filenames.gypi',
|
||||
+ 'vendor/libchromiumcontent/dist/main/filenames.gypi',
|
||||
],
|
||||
'variables': {
|
||||
'libchromiumcontent_component%': 1,
|
||||
@@ -14,7 +14,7 @@
|
||||
}, {
|
||||
'libchromiumcontent_dir%': '<(libchromiumcontent_static_libraries_dir)',
|
||||
'libchromiumcontent_libraries%': '<(libchromiumcontent_static_libraries)',
|
||||
- 'libchromiumcontent_v8_libraries%': '<(libchromiumcontent_static_v8_libraries)',
|
||||
+ 'libchromiumcontent_v8_libraries%': '<(libchromiumcontent_shared_v8_libraries)',
|
||||
}],
|
||||
],
|
||||
},
|
||||
@@ -235,22 +235,12 @@
|
||||
'conditions': [
|
||||
['OS=="linux"', {
|
||||
'cflags': [
|
||||
- '-O2',
|
||||
- # Generate symbols, will be stripped later.
|
||||
- '-g',
|
||||
- # Don't emit the GCC version ident directives, they just end up
|
||||
- # in the .comment section taking up binary size.
|
||||
- '-fno-ident',
|
||||
# Put data and code in their own sections, so that unused symbols
|
||||
# can be removed at link time with --gc-sections.
|
||||
'-fdata-sections',
|
||||
'-ffunction-sections',
|
||||
],
|
||||
'ldflags': [
|
||||
- # Specifically tell the linker to perform optimizations.
|
||||
- # See http://lwn.net/Articles/192624/ .
|
||||
- '-Wl,-O1',
|
||||
- '-Wl,--as-needed',
|
||||
'-Wl,--gc-sections',
|
||||
],
|
||||
}], # OS=="linux"
|
||||
--
|
||||
2.14.3
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
From 0352e8df546c58b85e79714f77c616832c8c72ac Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Fri, 28 Apr 2017 17:22:38 -0400
|
||||
Subject: [PATCH] Gentoo build fixes
|
||||
|
||||
---
|
||||
chromiumcontent/BUILD.gn | 9 +++------
|
||||
chromiumcontent/build_libs.py | 2 +-
|
||||
script/create-dist | 39 ++++++++++++++++++++++++++-------------
|
||||
script/lib/config.py | 2 +-
|
||||
4 files changed, 31 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/chromiumcontent/BUILD.gn b/chromiumcontent/BUILD.gn
|
||||
index e4e4166..f88fab3 100644
|
||||
--- a/chromiumcontent/BUILD.gn
|
||||
+++ b/chromiumcontent/BUILD.gn
|
||||
@@ -343,12 +343,9 @@ if (is_electron_build && !is_component_build) {
|
||||
}
|
||||
}
|
||||
|
||||
- static_library("v8") {
|
||||
- complete_static_lib = true
|
||||
- sources = []
|
||||
- if (defined(obj_v8)) {
|
||||
- sources += obj_v8
|
||||
- }
|
||||
+ shared_library("v8") {
|
||||
+ deps = [ "//v8:v8", "//v8:v8_libplatform" ]
|
||||
+ ldflags = [ "-Wl,-rpath=\$ORIGIN/" ]
|
||||
}
|
||||
|
||||
} else {
|
||||
diff --git a/chromiumcontent/build_libs.py b/chromiumcontent/build_libs.py
|
||||
index e10f320..716c5f2 100644
|
||||
--- a/chromiumcontent/build_libs.py
|
||||
+++ b/chromiumcontent/build_libs.py
|
||||
@@ -82,7 +82,7 @@ with open(args.out, 'w') as out:
|
||||
"third_party/usrsctp",
|
||||
"third_party/woff2",
|
||||
"third_party/zlib",
|
||||
- "tools",
|
||||
+ "tools/battor_agent",
|
||||
"ui",
|
||||
"url",
|
||||
])
|
||||
diff --git a/script/create-dist b/script/create-dist
|
||||
index aec75e5..cf2f62c 100755
|
||||
--- a/script/create-dist
|
||||
+++ b/script/create-dist
|
||||
@@ -45,7 +45,6 @@ COMPONENTS = ['static_library', 'shared_library']
|
||||
BINARIES = {
|
||||
'all': [
|
||||
'content_shell.pak',
|
||||
- 'icudtl.dat',
|
||||
'natives_blob.bin',
|
||||
'snapshot_blob.bin',
|
||||
os.path.join('gen', 'blink', 'public', 'resources', 'blink_image_resources_200_percent.pak'),
|
||||
@@ -59,7 +58,6 @@ BINARIES = {
|
||||
'libffmpeg.dylib',
|
||||
],
|
||||
'linux': [
|
||||
- 'libffmpeg.so',
|
||||
],
|
||||
'win32': [
|
||||
'd3dcompiler_47.dll',
|
||||
@@ -308,12 +306,11 @@ def main():
|
||||
|
||||
for component in COMPONENTS:
|
||||
if args.component == 'all' or args.component == component:
|
||||
- copy_binaries(target_arch, component, create_debug_archive)
|
||||
+ copy_binaries(target_arch, component, create_debug_archive,
|
||||
+ args.system_icu)
|
||||
copy_generated_sources(target_arch, component)
|
||||
copy_locales(target_arch, component)
|
||||
|
||||
- copy_ffmpeg(target_arch)
|
||||
- copy_sources()
|
||||
generate_licenses()
|
||||
if not args.no_zip:
|
||||
create_zip(create_debug_archive)
|
||||
@@ -331,6 +328,8 @@ def parse_args():
|
||||
help='static_library or shared_library or all')
|
||||
parser.add_argument('--no_zip', action='store_true',
|
||||
help='Do not create zip distribution')
|
||||
+ parser.add_argument('--system-icu', action='store_true', dest='system_icu',
|
||||
+ help='Use system icu.')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -355,15 +354,17 @@ def check_create_debug_archive(target_arch):
|
||||
def copy_with_blacklist(target_arch, src, dest):
|
||||
if os.path.basename(src) in ARCH_BLACKLIST[target_arch]:
|
||||
return
|
||||
- shutil.copy2(src, dest)
|
||||
+ link_or_copy(src, dest)
|
||||
|
||||
|
||||
-def copy_binaries(target_arch, component, create_debug_archive):
|
||||
+def copy_binaries(target_arch, component, create_debug_archive, system_icu):
|
||||
output_dir = get_output_dir(SOURCE_ROOT, target_arch, component)
|
||||
target_dir = os.path.join(MAIN_DIR, component)
|
||||
mkdir_p(target_dir)
|
||||
|
||||
binaries = BINARIES['all'] + BINARIES[TARGET_PLATFORM]
|
||||
+ if not system_icu:
|
||||
+ binaries.append('icudtl.dat')
|
||||
if component == 'shared_library':
|
||||
binaries += BINARIES_SHARED_LIBRARY[TARGET_PLATFORM]
|
||||
for binary in binaries:
|
||||
@@ -371,7 +372,7 @@ def copy_binaries(target_arch, component, create_debug_archive):
|
||||
|
||||
# Copy all static libraries from chromiumcontent
|
||||
for library in glob.glob(os.path.join(output_dir, 'obj', 'chromiumcontent', '*.' + STATIC_LIBRARY_SUFFIX)):
|
||||
- shutil.copy2(library, target_dir)
|
||||
+ link_or_copy(library, target_dir)
|
||||
|
||||
if component == 'shared_library':
|
||||
match = '*.{0}'.format(SHARED_LIBRARY_SUFFIX)
|
||||
@@ -396,7 +397,7 @@ def copy_binaries(target_arch, component, create_debug_archive):
|
||||
for root, _, filenames in os.walk(output_dir):
|
||||
for pdb in filenames:
|
||||
if pdb.endswith('.pdb'):
|
||||
- shutil.copy2(os.path.join(root, pdb), target_dir)
|
||||
+ link_or_copy(os.path.join(root, pdb), target_dir)
|
||||
|
||||
if TARGET_PLATFORM == 'linux':
|
||||
if component == 'shared_library':
|
||||
@@ -433,7 +434,7 @@ def copy_binaries(target_arch, component, create_debug_archive):
|
||||
|
||||
ffmpeg_output_dir = get_output_dir(SOURCE_ROOT, target_arch, 'ffmpeg')
|
||||
for binary in binaries:
|
||||
- shutil.copy2(os.path.join(ffmpeg_output_dir, binary), target_dir)
|
||||
+ link_or_copy(os.path.join(ffmpeg_output_dir, binary), target_dir)
|
||||
|
||||
|
||||
def copy_generated_sources(target_arch, component):
|
||||
@@ -452,7 +453,7 @@ def copy_locales(target_arch, component):
|
||||
for src_file in glob.glob(os.path.join(src_dir, 'content_strings_*.pak')):
|
||||
filename = os.path.basename(src_file)
|
||||
new_name = re.sub('content_strings_', '', filename)
|
||||
- shutil.copy2(src_file, os.path.join(target_dir, new_name))
|
||||
+ link_or_copy(src_file, os.path.join(target_dir, new_name))
|
||||
|
||||
def copy_sources():
|
||||
for include_path in INCLUDE_DIRS:
|
||||
@@ -477,7 +478,7 @@ def copy_ffmpeg(target_arch):
|
||||
|
||||
target_dir = os.path.join(MAIN_DIR, 'ffmpeg')
|
||||
mkdir_p(target_dir)
|
||||
- shutil.copy2(os.path.join(output_dir, binary), target_dir)
|
||||
+ link_or_copy(os.path.join(output_dir, binary), target_dir)
|
||||
|
||||
|
||||
|
||||
@@ -494,7 +495,7 @@ def copy_source_file(absolute_path, relative_to, destination):
|
||||
relative_path = os.path.relpath(absolute_path, start=relative_to)
|
||||
final_path = os.path.join(destination, relative_path)
|
||||
mkdir_p(os.path.dirname(final_path))
|
||||
- shutil.copy2(absolute_path, final_path)
|
||||
+ link_or_copy(absolute_path, final_path)
|
||||
|
||||
|
||||
def copy_dir(relative_path, relative_to, destination):
|
||||
@@ -531,6 +532,7 @@ def link_binary_to_debug_file(objcopy, binfile, symfile, dirname):
|
||||
def run_strip(target_arch, filename, create_debug_archive):
|
||||
# Static libraries are not stripped because it would remove
|
||||
# all the symbols in it.
|
||||
+ return
|
||||
if filename.endswith('.a'):
|
||||
return
|
||||
|
||||
@@ -620,6 +622,17 @@ def rm_rf(path):
|
||||
raise
|
||||
|
||||
|
||||
+def link_or_copy(src, dst):
|
||||
+ if os.path.isfile(src):
|
||||
+ if os.path.isdir(dst):
|
||||
+ dst = os.path.join(dst, os.path.basename(src))
|
||||
+ try:
|
||||
+ os.link(src, dst)
|
||||
+ except OSError:
|
||||
+ shutil.copy2(src, dst)
|
||||
+ else:
|
||||
+ shutil.copy2(src, dst)
|
||||
+
|
||||
def safe_unlink(path):
|
||||
try:
|
||||
os.unlink(path)
|
||||
diff --git a/script/lib/config.py b/script/lib/config.py
|
||||
index 3455161..195b2a1 100644
|
||||
--- a/script/lib/config.py
|
||||
+++ b/script/lib/config.py
|
||||
@@ -4,4 +4,4 @@ import os
|
||||
|
||||
|
||||
def get_output_dir(source_root, target_arch, component):
|
||||
- return os.path.join(source_root, 'src', 'out-' + target_arch, component)
|
||||
+ return os.environ.get('CHROMIUM_BUILD_DIR')
|
||||
--
|
||||
2.13.6
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
From 672445004bafb94ea14cbb89c12c205c731eb288 Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Wed, 10 Feb 2016 14:45:13 -0500
|
||||
Subject: [PATCH] Build fixes
|
||||
|
||||
---
|
||||
lib/internal/bootstrap_node.js | 2 ++
|
||||
node.gyp | 14 +++++++++-----
|
||||
src/node_main.cc | 4 ++++
|
||||
3 files changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js
|
||||
index aee7261f23..b921843643 100644
|
||||
--- a/lib/internal/bootstrap_node.js
|
||||
+++ b/lib/internal/bootstrap_node.js
|
||||
@@ -39,7 +39,9 @@
|
||||
setupGlobalConsole();
|
||||
}
|
||||
|
||||
+ if (!process.env._ELECTRON_BUILD_NO_ASAR) {
|
||||
setupAsarSupport();
|
||||
+ }
|
||||
|
||||
const _process = NativeModule.require('internal/process');
|
||||
|
||||
diff --git a/node.gyp b/node.gyp
|
||||
index c0bc2d7d4c..e5920f6a33 100644
|
||||
--- a/node.gyp
|
||||
+++ b/node.gyp
|
||||
@@ -17,6 +17,7 @@
|
||||
'node_shared_libuv%': 'false',
|
||||
'node_use_openssl%': 'true',
|
||||
'node_shared_openssl%': 'false',
|
||||
+ 'node_v8_path%': 'deps/v8',
|
||||
'node_v8_options%': '',
|
||||
'node_enable_v8_vtunejit%': 'false',
|
||||
'node_core_target_name%': 'node',
|
||||
@@ -146,6 +147,7 @@
|
||||
],
|
||||
|
||||
'include_dirs': [
|
||||
+ '<(node_v8_path)/include',
|
||||
'src',
|
||||
'tools/msvs/genfiles',
|
||||
'deps/uv/src/ares',
|
||||
@@ -261,6 +263,13 @@
|
||||
'V8_DEPRECATION_WARNINGS=1',
|
||||
],
|
||||
|
||||
+ 'link_settings': {
|
||||
+ 'ldflags': [
|
||||
+ '-Wl,-rpath=\$$ORIGIN/',
|
||||
+ # Make native module dynamic loading work.
|
||||
+ '-rdynamic',
|
||||
+ ],
|
||||
+ },
|
||||
|
||||
'conditions': [
|
||||
[ 'node_shared=="false"', {
|
||||
@@ -950,11 +959,6 @@
|
||||
}]
|
||||
]
|
||||
}],
|
||||
- [ 'node_use_v8_platform=="true"', {
|
||||
- 'dependencies': [
|
||||
- 'deps/v8/src/v8.gyp:v8_libplatform',
|
||||
- ],
|
||||
- }],
|
||||
[ 'node_use_bundled_v8=="true"', {
|
||||
'dependencies': [
|
||||
'deps/v8/src/v8.gyp:v8',
|
||||
diff --git a/src/node_main.cc b/src/node_main.cc
|
||||
index 16bda81ae6..2eb1d08369 100644
|
||||
--- a/src/node_main.cc
|
||||
+++ b/src/node_main.cc
|
||||
@@ -50,11 +50,15 @@ int wmain(int argc, wchar_t *wargv[]) {
|
||||
}
|
||||
#else
|
||||
// UNIX
|
||||
+#include <stdlib.h>
|
||||
int main(int argc, char *argv[]) {
|
||||
// Disable stdio buffering, it interacts poorly with printf()
|
||||
// calls elsewhere in the program (e.g., any logging from V8.)
|
||||
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||
setvbuf(stderr, nullptr, _IONBF, 0);
|
||||
+#ifdef ELECTRON_NODE_BUILD_NO_ASAR
|
||||
+ setenv("_ELECTRON_BUILD_NO_ASAR", "1", 1);
|
||||
+#endif
|
||||
return node::Start(argc, argv);
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.14.3
|
||||
|
||||
@@ -1,556 +0,0 @@
|
||||
From 8aa9ca32e88f7b6e66ded532d3110f4e84e99a9b Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Mon, 8 Feb 2016 15:16:40 -0500
|
||||
Subject: [PATCH] electron build fixes
|
||||
|
||||
---
|
||||
common.gypi | 70 ++++++++++++++++++++++++++++++++++-----
|
||||
electron.gyp | 70 +++++++++++++++++++++++++++++++--------
|
||||
toolchain.gypi | 76 +++++++++++++++++--------------------------
|
||||
tools/ar-flags.py | 15 +++++++++
|
||||
tools/atom_source_root.py | 5 +++
|
||||
tools/browserify.py | 24 ++++++++++++++
|
||||
tools/get-endianness.py | 4 +++
|
||||
tools/js2asar.py | 13 ++++----
|
||||
tools/list-browserify-deps.py | 3 +-
|
||||
9 files changed, 204 insertions(+), 76 deletions(-)
|
||||
create mode 100644 tools/ar-flags.py
|
||||
create mode 100644 tools/atom_source_root.py
|
||||
create mode 100644 tools/browserify.py
|
||||
create mode 100644 tools/get-endianness.py
|
||||
|
||||
diff --git a/common.gypi b/common.gypi
|
||||
index 7c1bf366a..7892926eb 100644
|
||||
--- a/common.gypi
|
||||
+++ b/common.gypi
|
||||
@@ -2,6 +2,7 @@
|
||||
'includes': [
|
||||
'toolchain.gypi',
|
||||
'vendor/brightray/brightray.gypi',
|
||||
+ 'vendor/node/common.gypi',
|
||||
],
|
||||
'variables': {
|
||||
# Tell crashpad to build as external project.
|
||||
@@ -11,31 +12,44 @@
|
||||
'chromeos': 0,
|
||||
# Reflects node's config.gypi.
|
||||
'component%': 'static_library',
|
||||
- 'python': 'python',
|
||||
+ 'python%': 'python',
|
||||
'openssl_fips': '',
|
||||
'openssl_no_asm': 1,
|
||||
+
|
||||
+ 'host_arch': '<!(python <(DEPTH)/chromium/v8/gypfiles/detect_v8_host_arch.py)',
|
||||
+
|
||||
+ # ICU configuration for Node.
|
||||
+ # Note: the use of icu-system.gyp does not necessarily
|
||||
+ # indicate that the system ICU will be used, it merely
|
||||
+ # disables the use of the version bundled with Node.
|
||||
+ 'icu_gyp_path': 'tools/icu/icu-system.gyp',
|
||||
+ 'icu_small': 'false',
|
||||
+
|
||||
'use_openssl_def': 0,
|
||||
'OPENSSL_PRODUCT': 'libopenssl.a',
|
||||
- 'node_release_urlbase': 'https://atom.io/download/atom-shell',
|
||||
- 'node_byteorder': '<!(node <(DEPTH)/tools/get-endianness.js)',
|
||||
+ 'node_release_urlbase': 'https://atom.io/download/electron',
|
||||
+ 'node_byteorder': '<!(python <(DEPTH)/tools/get-endianness.py)',
|
||||
'node_target_type': 'shared_library',
|
||||
+ 'node_module_version': '',
|
||||
'node_install_npm': 'false',
|
||||
'node_prefix': '',
|
||||
'node_shared': 'true',
|
||||
'node_shared_cares': 'false',
|
||||
- 'node_shared_http_parser': 'false',
|
||||
- 'node_shared_libuv': 'false',
|
||||
- 'node_shared_openssl': 'false',
|
||||
'node_shared_v8': 'true',
|
||||
- 'node_shared_zlib': 'false',
|
||||
+ 'node_shared_http_parser': 'true',
|
||||
+ # There are ABI-incompatible modifications to libuv
|
||||
+ 'node_shared_libuv': 'false',
|
||||
+ 'node_shared_openssl': 'true',
|
||||
+ 'node_shared_zlib': 'true',
|
||||
'node_tag': '',
|
||||
'node_use_dtrace': 'false',
|
||||
'node_use_etw': 'false',
|
||||
'node_use_mdb': 'false',
|
||||
'node_use_openssl': 'true',
|
||||
'node_use_perfctr': 'false',
|
||||
- 'node_use_v8_platform': 'false',
|
||||
+ 'node_use_v8_platform': 'true',
|
||||
'node_use_bundled_v8': 'false',
|
||||
+ 'node_v8_path': '<(DEPTH)/chromium/v8/',
|
||||
'node_enable_d8': 'false',
|
||||
'uv_library': 'static_library',
|
||||
'uv_parent_path': 'vendor/node/deps/uv',
|
||||
@@ -44,10 +58,17 @@
|
||||
'v8_postmortem_support': 'false',
|
||||
'v8_enable_i18n_support': 'false',
|
||||
'v8_inspector': 'false',
|
||||
+ 'v8_host_byteorder': '<!(python <(DEPTH)/tools/get-endianness.py)',
|
||||
+ 'v8_use_snapshot': 'true',
|
||||
+ 'v8_use_external_startup_data': 1,
|
||||
},
|
||||
# Settings to compile node under Windows.
|
||||
'target_defaults': {
|
||||
'target_conditions': [
|
||||
+ ['_target_name in ["icuuc", "icui18n"]', {
|
||||
+ 'cflags_cc!': ['-fno-rtti']
|
||||
+ }],
|
||||
+
|
||||
['_target_name in ["libuv", "http_parser", "openssl", "openssl-cli", "cares", "node", "zlib"]', {
|
||||
'msvs_disabled_warnings': [
|
||||
4003, # not enough actual parameters for macro 'V'
|
||||
@@ -128,6 +149,20 @@
|
||||
],
|
||||
}],
|
||||
['_target_name=="node"', {
|
||||
+ 'cflags!': [
|
||||
+ '-fvisibility=hidden',
|
||||
+ '-fdata-sections',
|
||||
+ '-ffunction-sections',
|
||||
+ ],
|
||||
+ 'cflags_cc!': [
|
||||
+ '-fvisibility-inlines-hidden',
|
||||
+ ],
|
||||
+ 'libraries': [
|
||||
+ '-lz',
|
||||
+ '-lhttp_parser',
|
||||
+ '-lcrypto',
|
||||
+ '-lssl',
|
||||
+ ],
|
||||
'include_dirs': [
|
||||
'<(libchromiumcontent_src_dir)',
|
||||
'<(libchromiumcontent_src_dir)/third_party/icu/source/common',
|
||||
@@ -167,7 +202,9 @@
|
||||
'-Wl,--no-whole-archive',
|
||||
],
|
||||
}, {
|
||||
- 'libraries': [ '<@(libchromiumcontent_v8_libraries)' ],
|
||||
+ 'libraries': [
|
||||
+ '<@(libchromiumcontent_v8_libraries)',
|
||||
+ ],
|
||||
}],
|
||||
],
|
||||
}],
|
||||
@@ -228,6 +265,21 @@
|
||||
}], # OS=="win"
|
||||
],
|
||||
}],
|
||||
+ ['_target_name=="shell_runner_host_lib"', {
|
||||
+ 'conditions': [
|
||||
+ ['icu_use_data_file_flag==1', {
|
||||
+ 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE'],
|
||||
+ }, { # else icu_use_data_file_flag !=1
|
||||
+ 'conditions': [
|
||||
+ ['OS=="win"', {
|
||||
+ 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_SHARED'],
|
||||
+ }, {
|
||||
+ 'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC'],
|
||||
+ }],
|
||||
+ ],
|
||||
+ }],
|
||||
+ ],
|
||||
+ }],
|
||||
],
|
||||
'msvs_cygwin_shell': 0, # Strangely setting it to 1 would make building under cygwin fail.
|
||||
'msvs_disabled_warnings': [
|
||||
diff --git a/electron.gyp b/electron.gyp
|
||||
index f82de1e1f..2c398fe75 100644
|
||||
--- a/electron.gyp
|
||||
+++ b/electron.gyp
|
||||
@@ -191,7 +191,7 @@
|
||||
}, {
|
||||
'copied_libraries': [
|
||||
'<(PRODUCT_DIR)/lib/libnode.so',
|
||||
- '<(libchromiumcontent_dir)/libffmpeg.so',
|
||||
+ '<@(libchromiumcontent_shared_v8_libraries)',
|
||||
],
|
||||
}],
|
||||
],
|
||||
@@ -244,8 +244,8 @@
|
||||
'<@(lib_sources)',
|
||||
],
|
||||
'include_dirs': [
|
||||
- '.',
|
||||
'chromium_src',
|
||||
+ '.',
|
||||
'vendor/brightray',
|
||||
'vendor/native_mate',
|
||||
# libicu headers shim.
|
||||
@@ -255,7 +255,6 @@
|
||||
'<(SHARED_INTERMEDIATE_DIR)',
|
||||
# Include directories for uv and node.
|
||||
'vendor/node/src',
|
||||
- 'vendor/node/deps/http_parser',
|
||||
'vendor/node/deps/uv/include',
|
||||
# The `node.h` is using `#include"v8.h"`.
|
||||
'<(libchromiumcontent_src_dir)/v8/include',
|
||||
@@ -344,11 +343,12 @@
|
||||
'<@(lib_sources_nss)',
|
||||
],
|
||||
'link_settings': {
|
||||
+ 'libraries': [ '<@(libchromiumcontent_v8_libraries)' ],
|
||||
'ldflags': [
|
||||
# Make binary search for libraries under current directory, so we
|
||||
# don't have to manually set $LD_LIBRARY_PATH:
|
||||
# http://serverfault.com/questions/279068/cant-find-so-in-the-same-directory-as-the-executable
|
||||
- '-rpath \$$ORIGIN',
|
||||
+ '-Wl,-rpath=\$$ORIGIN/',
|
||||
# Make native module dynamic loading work.
|
||||
'-rdynamic',
|
||||
],
|
||||
@@ -370,6 +370,9 @@
|
||||
{
|
||||
'target_name': 'js2asar',
|
||||
'type': 'none',
|
||||
+ 'dependencies': [
|
||||
+ 'nodebin'
|
||||
+ ],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'js2asar',
|
||||
@@ -391,6 +394,7 @@
|
||||
'action': [
|
||||
'python',
|
||||
'tools/js2asar.py',
|
||||
+ '<(PRODUCT_DIR)/nodebin',
|
||||
'<@(_outputs)',
|
||||
'lib',
|
||||
'<@(_inputs)',
|
||||
@@ -401,6 +405,9 @@
|
||||
{
|
||||
'target_name': 'app2asar',
|
||||
'type': 'none',
|
||||
+ 'dependencies': [
|
||||
+ 'nodebin'
|
||||
+ ],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'app2asar',
|
||||
@@ -422,6 +429,7 @@
|
||||
'action': [
|
||||
'python',
|
||||
'tools/js2asar.py',
|
||||
+ '<(PRODUCT_DIR)/nodebin',
|
||||
'<@(_outputs)',
|
||||
'default_app',
|
||||
'<@(_inputs)',
|
||||
@@ -447,6 +455,7 @@
|
||||
'dependencies': [
|
||||
# depend on this target to ensure the '<(js2c_input_dir)' is created
|
||||
'atom_js2c_copy',
|
||||
+ 'nodebin'
|
||||
],
|
||||
'variables': {
|
||||
'sandbox_args': [
|
||||
@@ -476,11 +485,9 @@
|
||||
'<(js2c_input_dir)/preload_bundle.js',
|
||||
],
|
||||
'action': [
|
||||
- 'npm',
|
||||
- 'run',
|
||||
- '--silent',
|
||||
- 'browserify',
|
||||
- '--',
|
||||
+ 'python',
|
||||
+ 'tools/browserify.py',
|
||||
+ '<(PRODUCT_DIR)/nodebin',
|
||||
'<@(sandbox_args)',
|
||||
'-o',
|
||||
'<@(_outputs)',
|
||||
@@ -495,12 +502,11 @@
|
||||
'<(js2c_input_dir)/isolated_bundle.js',
|
||||
],
|
||||
'action': [
|
||||
- 'npm',
|
||||
- 'run',
|
||||
- '--silent',
|
||||
- 'browserify',
|
||||
- '--',
|
||||
+ 'python',
|
||||
+ 'tools/browserify.py',
|
||||
+ '<(PRODUCT_DIR)/nodebin',
|
||||
'<@(isolated_args)',
|
||||
+ 'lib/isolated_renderer/init.js',
|
||||
'-o',
|
||||
'<@(_outputs)',
|
||||
],
|
||||
@@ -535,6 +541,42 @@
|
||||
}
|
||||
],
|
||||
}, # target atom_js2c
|
||||
+ {
|
||||
+ 'target_name': 'nodebin',
|
||||
+ 'type': 'executable',
|
||||
+ 'defines': [
|
||||
+ 'ELECTRON_NODE_BUILD_NO_ASAR'
|
||||
+ ],
|
||||
+ 'sources': [
|
||||
+ 'vendor/node/src/node_main.cc',
|
||||
+ ],
|
||||
+ 'dependencies': [
|
||||
+ 'vendor/node/node.gyp:node',
|
||||
+ ],
|
||||
+ 'include_dirs': [
|
||||
+ '.',
|
||||
+ '<(node_v8_path)/include',
|
||||
+ 'vendor/native_mate',
|
||||
+ # Include atom_natives.h.
|
||||
+ '<(SHARED_INTERMEDIATE_DIR)',
|
||||
+ # Include directories for uv and node.
|
||||
+ 'vendor/node/src',
|
||||
+ 'vendor/node/deps/uv/include',
|
||||
+ '<(libchromiumcontent_src_dir)',
|
||||
+ # The `node.h` is using `#include"v8.h"`.
|
||||
+ '<(libchromiumcontent_src_dir)/v8/include',
|
||||
+ # The `node.h` is using `#include"ares.h"`.
|
||||
+ 'vendor/node/deps/cares/include',
|
||||
+ ],
|
||||
+ 'link_settings': {
|
||||
+ 'libraries': [ '<@(libchromiumcontent_v8_libraries)' ],
|
||||
+ 'ldflags': [
|
||||
+ '-Wl,-rpath=\$$ORIGIN/',
|
||||
+ # Make native module dynamic loading work.
|
||||
+ '-rdynamic',
|
||||
+ ],
|
||||
+ },
|
||||
+ }, # target nodebin
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="mac"', {
|
||||
diff --git a/toolchain.gypi b/toolchain.gypi
|
||||
index 1c5f8a713..c20ed1a0f 100644
|
||||
--- a/toolchain.gypi
|
||||
+++ b/toolchain.gypi
|
||||
@@ -16,7 +16,7 @@
|
||||
'arm_neon%': 1,
|
||||
|
||||
# Abosulte path to source root.
|
||||
- 'source_root%': '<!(node <(DEPTH)/tools/atom_source_root.js)',
|
||||
+ 'source_root%': '<!(python <(DEPTH)/tools/atom_source_root.py)',
|
||||
},
|
||||
|
||||
# Copy conditionally-set variables out one scope.
|
||||
@@ -40,34 +40,6 @@
|
||||
'mac_sdk%': '<!(python <(DEPTH)/tools/mac/find_sdk.py <(mac_sdk_min))',
|
||||
}],
|
||||
|
||||
- ['OS=="linux"', {
|
||||
- 'variables': {
|
||||
- # The system libdir used for this ABI.
|
||||
- 'system_libdir%': 'lib',
|
||||
-
|
||||
- # Setting the path to sysroot.
|
||||
- 'conditions': [
|
||||
- ['target_arch=="arm"', {
|
||||
- # sysroot needs to be an absolute path otherwise it generates
|
||||
- # incorrect results when passed to pkg-config
|
||||
- 'sysroot%': '<(source_root)/vendor/debian_wheezy_arm-sysroot',
|
||||
- }],
|
||||
- ['target_arch=="ia32"', {
|
||||
- 'sysroot%': '<(source_root)/vendor/debian_wheezy_i386-sysroot',
|
||||
- }],
|
||||
- ['target_arch=="x64"', {
|
||||
- 'sysroot%': '<(source_root)/vendor/debian_wheezy_amd64-sysroot',
|
||||
- }],
|
||||
- ],
|
||||
- },
|
||||
- # Copy conditionally-set variables out one scope.
|
||||
- 'sysroot%': '<(sysroot)',
|
||||
- 'system_libdir%': '<(system_libdir)',
|
||||
-
|
||||
- # Redirect pkg-config to search from sysroot.
|
||||
- 'pkg-config%': '<(source_root)/tools/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)" "<(system_libdir)"',
|
||||
- }],
|
||||
-
|
||||
# Set default compiler flags depending on ARM version.
|
||||
['arm_version==6', {
|
||||
'arm_arch%': 'armv6',
|
||||
@@ -136,23 +108,6 @@
|
||||
},
|
||||
}],
|
||||
|
||||
- # Setup sysroot environment.
|
||||
- ['OS=="linux" and target_arch in ["arm", "ia32", "x64"]', {
|
||||
- 'target_defaults': {
|
||||
- 'target_conditions': [
|
||||
- ['_toolset=="target"', {
|
||||
- 'cflags': [
|
||||
- '--sysroot=<(sysroot)',
|
||||
- ],
|
||||
- 'ldflags': [
|
||||
- '--sysroot=<(sysroot)',
|
||||
- '<!(<(source_root)/tools/linux/sysroot_ld_path.sh <(sysroot))',
|
||||
- ],
|
||||
- }]
|
||||
- ],
|
||||
- },
|
||||
- }], # sysroot
|
||||
-
|
||||
# Setup cross-compilation on Linux.
|
||||
['OS=="linux"', {
|
||||
'target_defaults': {
|
||||
@@ -179,6 +134,35 @@
|
||||
'ldflags': [
|
||||
'-m64',
|
||||
],
|
||||
+ 'conditions': [
|
||||
+ ['use_lto==1 and clang==0', {
|
||||
+ 'cflags': [
|
||||
+ '-fno-fat-lto-objects',
|
||||
+ '-fuse-linker-plugin',
|
||||
+ '-flto=4',
|
||||
+ '--param=lto-partitions=1',
|
||||
+ ],
|
||||
+ 'ldflags': [
|
||||
+ '-fno-fat-lto-objects',
|
||||
+ '-fuse-linker-plugin',
|
||||
+ '-flto=4',
|
||||
+ '--param=lto-partitions=1',
|
||||
+ ],
|
||||
+ 'arflags': [
|
||||
+ '<!@(python <(DEPTH)/tools/ar-flags.py)',
|
||||
+ ]
|
||||
+ }],
|
||||
+ ['use_lto==1 and clang==1', {
|
||||
+ 'cflags': [
|
||||
+ '-flto',
|
||||
+ '-fwhole-program-vtables'
|
||||
+ ],
|
||||
+ 'ldflags': [
|
||||
+ '-flto',
|
||||
+ '-fwhole-program-vtables'
|
||||
+ ],
|
||||
+ }],
|
||||
+ ],
|
||||
}], # target_arch=="x64" and _toolset=="target"
|
||||
['target_arch=="arm" and _toolset=="target"', {
|
||||
'conditions': [
|
||||
diff --git a/tools/ar-flags.py b/tools/ar-flags.py
|
||||
new file mode 100644
|
||||
index 000000000..80b338a6e
|
||||
--- /dev/null
|
||||
+++ b/tools/ar-flags.py
|
||||
@@ -0,0 +1,15 @@
|
||||
+#!/usr/bin/env python
|
||||
+
|
||||
+import os
|
||||
+import subprocess
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ cc = os.environ.get('CC', '/usr/bin/cc')
|
||||
+ gcc_version = subprocess.check_output(
|
||||
+ [cc, '-dumpversion'], universal_newlines=True).strip(' \n')
|
||||
+
|
||||
+ lto_plugin = os.path.join(
|
||||
+ '/usr/libexec/gcc/x86_64-pc-linux-gnu/', gcc_version,
|
||||
+ 'liblto_plugin.so')
|
||||
+
|
||||
+ print('--plugin={}'.format(lto_plugin))
|
||||
diff --git a/tools/atom_source_root.py b/tools/atom_source_root.py
|
||||
new file mode 100644
|
||||
index 000000000..316e99701
|
||||
--- /dev/null
|
||||
+++ b/tools/atom_source_root.py
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/usr/bin/env python
|
||||
+
|
||||
+import os.path
|
||||
+
|
||||
+print(os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
|
||||
diff --git a/tools/browserify.py b/tools/browserify.py
|
||||
new file mode 100644
|
||||
index 000000000..15472c953
|
||||
--- /dev/null
|
||||
+++ b/tools/browserify.py
|
||||
@@ -0,0 +1,24 @@
|
||||
+#!/usr/bin/env python
|
||||
+
|
||||
+import os
|
||||
+import subprocess
|
||||
+import sys
|
||||
+
|
||||
+SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
||||
+
|
||||
+
|
||||
+def main():
|
||||
+ node = sys.argv[1]
|
||||
+ args = sys.argv[2:]
|
||||
+
|
||||
+ call_browserify(node, args)
|
||||
+
|
||||
+
|
||||
+def call_browserify(node, args):
|
||||
+ browserify = os.path.join(
|
||||
+ SOURCE_ROOT, 'node_modules', '.bin', 'browserify')
|
||||
+ subprocess.check_call([node, browserify] + args)
|
||||
+
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ sys.exit(main())
|
||||
diff --git a/tools/get-endianness.py b/tools/get-endianness.py
|
||||
new file mode 100644
|
||||
index 000000000..31507936f
|
||||
--- /dev/null
|
||||
+++ b/tools/get-endianness.py
|
||||
@@ -0,0 +1,4 @@
|
||||
+#!/usr/bin/env python
|
||||
+
|
||||
+import sys
|
||||
+print(sys.byteorder)
|
||||
diff --git a/tools/js2asar.py b/tools/js2asar.py
|
||||
index adad1751e..ca7686893 100755
|
||||
--- a/tools/js2asar.py
|
||||
+++ b/tools/js2asar.py
|
||||
@@ -11,13 +11,14 @@ SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def main():
|
||||
- archive = sys.argv[1]
|
||||
- folder_name = sys.argv[2]
|
||||
- source_files = sys.argv[3:]
|
||||
+ node = sys.argv[1]
|
||||
+ archive = sys.argv[2]
|
||||
+ folder_name = sys.argv[3]
|
||||
+ source_files = sys.argv[4:]
|
||||
|
||||
output_dir = tempfile.mkdtemp()
|
||||
copy_files(source_files, output_dir)
|
||||
- call_asar(archive, os.path.join(output_dir, folder_name))
|
||||
+ call_asar(node, archive, os.path.join(output_dir, folder_name))
|
||||
shutil.rmtree(output_dir)
|
||||
|
||||
|
||||
@@ -28,11 +29,11 @@ def copy_files(source_files, output_dir):
|
||||
shutil.copy2(source_file, output_path)
|
||||
|
||||
|
||||
-def call_asar(archive, output_dir):
|
||||
+def call_asar(node, archive, output_dir):
|
||||
asar = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'asar')
|
||||
if sys.platform in ['win32', 'cygwin']:
|
||||
asar += '.cmd'
|
||||
- subprocess.check_call([asar, 'pack', output_dir, archive])
|
||||
+ subprocess.check_call([node, asar, 'pack', output_dir, archive])
|
||||
|
||||
|
||||
def safe_mkdir(path):
|
||||
diff --git a/tools/list-browserify-deps.py b/tools/list-browserify-deps.py
|
||||
index c25007d2a..bbd921bc6 100755
|
||||
--- a/tools/list-browserify-deps.py
|
||||
+++ b/tools/list-browserify-deps.py
|
||||
@@ -9,7 +9,8 @@ BROWSERIFY = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'browserify')
|
||||
if sys.platform == 'win32':
|
||||
BROWSERIFY += '.cmd'
|
||||
|
||||
-deps = subprocess.check_output([BROWSERIFY, '--list'] + sys.argv[1:])
|
||||
+deps = subprocess.check_output([BROWSERIFY, '--list'] + sys.argv[1:],
|
||||
+ universal_newlines=True)
|
||||
for dep in deps.split('\n'):
|
||||
if dep:
|
||||
dep = os.path.relpath(dep, SOURCE_ROOT)
|
||||
--
|
||||
2.14.3
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
From 065c936e74d629b51f5258fb3b58899bd5857b53 Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Sun, 29 Oct 2017 16:38:40 -0400
|
||||
Subject: [PATCH] system-icu support
|
||||
|
||||
---
|
||||
electron.gyp | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/electron.gyp b/electron.gyp
|
||||
index 43f3ffb51..2c398fe75 100644
|
||||
--- a/electron.gyp
|
||||
+++ b/electron.gyp
|
||||
@@ -200,7 +200,6 @@
|
||||
'files': [
|
||||
'<@(copied_libraries)',
|
||||
'<(libchromiumcontent_dir)/locales',
|
||||
- '<(libchromiumcontent_dir)/icudtl.dat',
|
||||
'<(libchromiumcontent_dir)/blink_image_resources_200_percent.pak',
|
||||
'<(libchromiumcontent_dir)/content_resources_200_percent.pak',
|
||||
'<(libchromiumcontent_dir)/content_shell.pak',
|
||||
@@ -249,6 +248,9 @@
|
||||
'.',
|
||||
'vendor/brightray',
|
||||
'vendor/native_mate',
|
||||
+ # libicu headers shim.
|
||||
+ '<(SHARED_INTERMEDIATE_DIR)/shim_headers/icui18n_shim',
|
||||
+ '<(SHARED_INTERMEDIATE_DIR)/shim_headers/icuuc_shim',
|
||||
# Include atom_natives.h.
|
||||
'<(SHARED_INTERMEDIATE_DIR)',
|
||||
# Include directories for uv and node.
|
||||
--
|
||||
2.14.3
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
From da7d4d995b31fcdc94158bbc4adc01bf9bab78a9 Mon Sep 17 00:00:00 2001
|
||||
From: Elvis Pranskevichus <elvis@magic.io>
|
||||
Date: Sat, 11 Jun 2016 18:27:19 -0400
|
||||
Subject: [PATCH] Add support for external V8 snapshots
|
||||
|
||||
---
|
||||
src/node.cc | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 87 insertions(+)
|
||||
|
||||
diff --git a/src/node.cc b/src/node.cc
|
||||
index 66233d451..96e4e22d6 100644
|
||||
--- a/src/node.cc
|
||||
+++ b/src/node.cc
|
||||
@@ -4493,6 +4493,91 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
+#include <sys/mman.h>
|
||||
+
|
||||
+const char kProcSelfExe[] = "/proc/self/exe";
|
||||
+const char kNativesFileName[] = "natives_blob.bin";
|
||||
+const char kSnapshotFileName[] = "snapshot_blob.bin";
|
||||
+const char *g_mapped_natives = nullptr;
|
||||
+const char *g_mapped_snapshot = nullptr;
|
||||
+
|
||||
+static char* SnapshotPath(const char* filename) {
|
||||
+ char *path;
|
||||
+ char *dir;
|
||||
+ ssize_t r;
|
||||
+
|
||||
+ path = reinterpret_cast<char*>(malloc(4096 + strlen(filename) + 2));
|
||||
+ if (path == nullptr) {
|
||||
+ fprintf(stderr, "out of memory\n");
|
||||
+ ABORT();
|
||||
+ }
|
||||
+
|
||||
+ r = readlink(kProcSelfExe, path, 4096 + 1);
|
||||
+ if (r == -1) {
|
||||
+ perror("could not determine node executable directory");
|
||||
+ ABORT();
|
||||
+ }
|
||||
+
|
||||
+ path[r] = '\0';
|
||||
+
|
||||
+ dir = strrchr(path, '/');
|
||||
+
|
||||
+ strcpy(dir + 1, filename);
|
||||
+
|
||||
+ return path;
|
||||
+}
|
||||
+
|
||||
+static void LoadV8Snapshot(const char* name, const char** addr, size_t *size) {
|
||||
+ char *path = SnapshotPath(name);
|
||||
+ int fd;
|
||||
+ struct stat sb;
|
||||
+
|
||||
+ fd = open(path, O_RDONLY);
|
||||
+
|
||||
+ if (fd == -1) {
|
||||
+ fprintf(stderr, "could not open snapshot file '%s': %s\n",
|
||||
+ path, sys_errlist[errno]);
|
||||
+ ABORT();
|
||||
+ }
|
||||
+
|
||||
+ if (fstat(fd, &sb) == -1) {
|
||||
+ fprintf(stderr, "could not stat snapshot file '%s': %s\n",
|
||||
+ path, sys_errlist[errno]);
|
||||
+ ABORT();
|
||||
+ }
|
||||
+
|
||||
+ *size = sb.st_size;
|
||||
+
|
||||
+ *addr = reinterpret_cast<const char*>(
|
||||
+ mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0));
|
||||
+ if (*addr == MAP_FAILED) {
|
||||
+ fprintf(stderr, "could not read snapshot file '%s': %s\n",
|
||||
+ path, sys_errlist[errno]);
|
||||
+ ABORT();
|
||||
+ }
|
||||
+
|
||||
+ close(fd);
|
||||
+ free(path);
|
||||
+}
|
||||
+
|
||||
+static void LoadV8Snapshots() {
|
||||
+ size_t natives_size;
|
||||
+ size_t snapshot_size;
|
||||
+
|
||||
+ LoadV8Snapshot(kNativesFileName, &g_mapped_natives, &natives_size);
|
||||
+ LoadV8Snapshot(kSnapshotFileName, &g_mapped_snapshot, &snapshot_size);
|
||||
+
|
||||
+ v8::StartupData natives;
|
||||
+ natives.data = g_mapped_natives;
|
||||
+ natives.raw_size = natives_size;
|
||||
+ V8::SetNativesDataBlob(&natives);
|
||||
+
|
||||
+ v8::StartupData snapshot;
|
||||
+ snapshot.data = g_mapped_snapshot;
|
||||
+ snapshot.raw_size = snapshot_size;
|
||||
+ V8::SetSnapshotDataBlob(&snapshot);
|
||||
+}
|
||||
+
|
||||
inline int Start(uv_loop_t* event_loop,
|
||||
int argc, const char* const* argv,
|
||||
int exec_argc, const char* const* exec_argv) {
|
||||
@@ -4557,6 +4642,8 @@ int Start(int argc, char** argv) {
|
||||
const char** exec_argv;
|
||||
Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
|
||||
|
||||
+ LoadV8Snapshots();
|
||||
+
|
||||
#if HAVE_OPENSSL
|
||||
if (const char* extra = secure_getenv("NODE_EXTRA_CA_CERTS"))
|
||||
crypto::UseExtraCaCerts(extra);
|
||||
--
|
||||
2.11.1
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="github">elprans/asar</remote-id>
|
||||
<remote-id type="github">elprans/gentoo-electron-patches</remote-id>
|
||||
<remote-id type="github">elprans/grit</remote-id>
|
||||
<remote-id type="github">elprans/node-browserify</remote-id>
|
||||
</upstream>
|
||||
|
||||
Reference in New Issue
Block a user