From patchwork Thu Dec 5 17:15:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Drake X-Patchwork-Id: 1204723 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=codethink.co.uk Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47TNFg0zdQz9sP3 for ; Fri, 6 Dec 2019 04:37:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8C0B2883B5; Thu, 5 Dec 2019 17:37:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zrtxJ7oxgOz9; Thu, 5 Dec 2019 17:37:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id DDE6C8839A; Thu, 5 Dec 2019 17:37:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 818AA1BF9B9 for ; Thu, 5 Dec 2019 17:37:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7DF7288371 for ; Thu, 5 Dec 2019 17:37:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zBtS1-VkI8fY for ; Thu, 5 Dec 2019 17:37:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from imap2.colo.codethink.co.uk (imap2.colo.codethink.co.uk [78.40.148.184]) by whitealder.osuosl.org (Postfix) with ESMTPS id 0057C88384 for ; Thu, 5 Dec 2019 17:37:03 +0000 (UTC) Received: from [167.98.27.226] (helo=ts007-build.ts007.codethink.co.uk) by imap2.colo.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1icuj0-0007Yj-4u; Thu, 05 Dec 2019 17:15:34 +0000 From: Michael Drake To: buildroot@busybox.net Date: Thu, 5 Dec 2019 17:15:17 +0000 Message-Id: <20191205171517.96639-31-michael.drake@codethink.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191205171517.96639-1-michael.drake@codethink.co.uk> References: <20191205171517.96639-1-michael.drake@codethink.co.uk> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v1 30/30] package/libcef: Add v8 Snapshot option. X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jon duSaint , Michael Drake , Patrick Glaser , Thomas Preston , Enis Lavery Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This is an optimisation for JavaScript context creation (e.g. opening new tabs). Coauthored-by: Thomas Preston Cc: Patrick Glaser Cc: Jon duSaint Cc: Enis Lavery Signed-off-by: Michael Drake Signed-off-by: Thomas Preston --- package/libcef/Config.in | 31 +++++++++++++++++++++++++++++++ package/libcef/libcef.mk | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/package/libcef/Config.in b/package/libcef/Config.in index bab584df30..0dedd062e9 100644 --- a/package/libcef/Config.in +++ b/package/libcef/Config.in @@ -95,6 +95,37 @@ config BR2_PACKAGE_LIBCEF_CEFSIMPLE help Enables libcef example application cefsimple. +comment "libcef v8 snapshots depends on a 64-bit target arch" + depends on !BR2_aarch64 && !BR2_x86_64 + +config BR2_PACKAGE_LIBCEF_V8_SNAPSHOTS + bool "Enable v8 snapshots in libcef" + depends on BR2_aarch64 || BR2_x86_64 + select BR2_PACKAGE_HOST_DBUS + select BR2_PACKAGE_HOST_FFMPEG + select BR2_PACKAGE_HOST_LIBXCB + select BR2_PACKAGE_HOST_PCIUTILS + select BR2_PACKAGE_HOST_XCB_UTIL + select BR2_PACKAGE_HOST_XLIB_LIBXTST + help + Enables V8 snapshots. This is an optimisation for + JavaScript context creation (e.g. opening new tabs). + It avoids needing to execute a whole load of JavaScript + code that gets run on context initialisation. + It works by building a browser for the host, creating + a JavaScript context, and saving the JavaScript heap + to file. The target browser can then load the recorded + JavaScript heap from file, instead of executing the + JavaScript code. + + Note that since this requires building a browser for + the host, it requires a lot of extra host packages + to be built. These host library packages need to have + the same memory architecture (32 vs. 64 bit) as the + target, because for the captured heap snapshot to be + valid for the target, it must be captured with a binary + which shares the same memory architecture. + config BR2_PACKAGE_LIBCEF_WIDEVINE bool "Enable Widevine support in libcef." select BR2_PACKAGE_WIDEVINE diff --git a/package/libcef/libcef.mk b/package/libcef/libcef.mk index 9d3b305451..e5a60e74ee 100644 --- a/package/libcef/libcef.mk +++ b/package/libcef/libcef.mk @@ -220,6 +220,30 @@ else LIBCEF_GN_DEFINES += use_pulseaudio=false endif +ifeq ($(BR2_PACKAGE_LIBCEF_V8_SNAPSHOTS),y) +LIBCEF_GN_DEFINES += \ + v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\" \ + v8_use_snapshot=true +LIBCEF_DEPENDENCIES += \ + host-alsa-lib \ + host-dbus \ + host-ffmpeg \ + host-libxcb \ + host-mesa3d \ + host-pciutils \ + host-xcb-util \ + host-xlib_libXcomposite \ + host-xlib_libXcursor \ + host-xlib_libXdamage \ + host-xlib_libXrandr \ + host-xlib_libXScrnSaver \ + host-xlib_libXtst +else +LIBCEF_GN_DEFINES += \ + v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\" \ + v8_use_snapshot=false +endif + ifeq ($(BR2_PACKAGE_LIBCEF_WIDEVINE),y) LIBCEF_GN_DEFINES += enable_widevine=true LIBCEF_DEPENDENCIES += widevine @@ -243,6 +267,17 @@ endef LIBCEF_POST_INSTALL_TARGET_HOOKS += LIBCEF_INSTALL_CEFSIMPLE endif +ifeq ($(BR2_PACKAGE_LIBCEF_V8_SNAPSHOTS),y) +define LIBCEF_INSTALL_V8_SNAPSHOT_BINARIES + # v8 snapshot binaries + $(INSTALL) -m 0644 -D -t $(TARGET_DIR)/usr/lib \ + $(@D)/$(LIBCEF_BUILD_OUTPUT_DIR)/natives_blob.bin \ + $(@D)/$(LIBCEF_BUILD_OUTPUT_DIR)/snapshot_blob.bin \ + $(@D)/$(LIBCEF_BUILD_OUTPUT_DIR)/v8_context_snapshot.bin +endef +LIBCEF_POST_INSTALL_TARGET_HOOKS += LIBCEF_INSTALL_V8_SNAPSHOT_BINARIES +endif + # To build libcef, the CEF project source must be extracted in a # `cef` directory inside the Chromium source tree. We override # the buildroot default extract commands to get the desired source