Initial Commit
- initial default booting image
This commit is contained in:
32
package/flutter-engine/0001-disable-pre-canned-sysroot.patch
Normal file
32
package/flutter-engine/0001-disable-pre-canned-sysroot.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 49a14e693124dc34f2cccbfb755d01a1198aa6bf Mon Sep 17 00:00:00 2001
|
||||
From: Joel Winarske <joel.winarsk@gmail.com>
|
||||
Date: Wed, 19 Jul 2023 15:24:22 -0700
|
||||
Subject: [PATCH] disable pre-canned sysroot
|
||||
|
||||
Override should be enabled if a custom sysroot using --target-sysroot is
|
||||
specified. If --target-sysroot is not set, then it should default to the
|
||||
pre-canned sysroot.
|
||||
|
||||
Upstream: https://github.com/flutter/flutter/issues/123073
|
||||
Signed-off-by: Joel Winarske <joel.winarsk@gmail.com>
|
||||
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
|
||||
---
|
||||
engine/src/build/config/sysroot.gni | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/engine/src/build/config/sysroot.gni b/engine/src/build/config/sysroot.gni
|
||||
index 7987e519d..1de694263 100644
|
||||
--- a/engine/src/build/config/sysroot.gni
|
||||
+++ b/engine/src/build/config/sysroot.gni
|
||||
@@ -12,7 +12,7 @@ declare_args() {
|
||||
|
||||
# Whether to use the default sysroot when building for Linux, if an explicit
|
||||
# sysroot isn't set.
|
||||
- use_default_linux_sysroot = true
|
||||
+ use_default_linux_sysroot = false
|
||||
}
|
||||
|
||||
if (current_toolchain == default_toolchain && target_sysroot != "") {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From b1a5db9318ca33a03f2700758d5debad907d21b6 Mon Sep 17 00:00:00 2001
|
||||
From: Joel Winarske <joel.winarsk@gmail.com>
|
||||
Date: Wed, 19 Jul 2023 15:26:40 -0700
|
||||
Subject: [PATCH] remove explicit x11 dependency
|
||||
|
||||
This is superfluous and may conflict with the actual rendering system used in
|
||||
gtk3 (e.g. wayland.)
|
||||
|
||||
Upstream: https://github.com/flutter/flutter/issues/123073
|
||||
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
|
||||
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
|
||||
---
|
||||
engine/src/flutter/shell/platform/linux/config/BUILD.gn | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/engine/src/flutter/shell/platform/linux/config/BUILD.gn b/engine/src/flutter/shell/platform/linux/config/BUILD.gn
|
||||
index da0ac056b..70c7a0ea1 100644
|
||||
--- a/engine/src/flutter/shell/platform/linux/config/BUILD.gn
|
||||
+++ b/engine/src/flutter/shell/platform/linux/config/BUILD.gn
|
||||
@@ -5,10 +5,6 @@
|
||||
import("//build/config/linux/pkg_config.gni")
|
||||
import("//flutter/shell/platform/glfw/config.gni")
|
||||
|
||||
-pkg_config("x11") {
|
||||
- packages = [ "x11" ]
|
||||
-}
|
||||
-
|
||||
pkg_config("gtk") {
|
||||
packages = [ "gtk+-3.0" ]
|
||||
}
|
||||
--
|
||||
2.41.0
|
||||
|
||||
40
package/flutter-engine/0003-fix-toolchain-paths.patch
Normal file
40
package/flutter-engine/0003-fix-toolchain-paths.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From ca175ef5bf7f96db57fb5aa562602dc424fab81c Mon Sep 17 00:00:00 2001
|
||||
From: Joel Winarske <joel.winarsk@gmail.com>
|
||||
Date: Sun, 5 Mar 2023 10:43:02 -0800
|
||||
Subject: [PATCH] fix toolchain paths
|
||||
|
||||
Flutter includes a copy of clang which is required to build. However, by
|
||||
default, engine/src/build/toolchain/custom/BUILD.gn attempts to use several gcc utilities
|
||||
such as ar, readelf, nm, and strip. Change these to the proper llvm provided
|
||||
utility.
|
||||
|
||||
Upstream: https://github.com/flutter/flutter/issues/123073
|
||||
|
||||
Signed-off-by: Joel Winarske <joel.winarsk@gmail.com>
|
||||
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
|
||||
---
|
||||
engine/src/build/toolchain/custom/BUILD.gn | 4 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/engine/src/build/toolchain/custom/BUILD.gn b/engine/src/build/toolchain/custom/BUILD.gn
|
||||
index 65b1623..8b3f6f8 100644
|
||||
--- a/engine/src/build/toolchain/custom/BUILD.gn
|
||||
+++ b/engine/src/build/toolchain/custom/BUILD.gn
|
||||
@@ -12,11 +12,11 @@ toolchain("custom") {
|
||||
# these values in our scope.
|
||||
cc = "${toolchain_bin}/clang"
|
||||
cxx = "${toolchain_bin}/clang++"
|
||||
- ar = "${toolchain_bin}/${custom_target_triple}-ar"
|
||||
+ ar = "${toolchain_bin}/llvm-ar"
|
||||
ld = "${toolchain_bin}/clang++"
|
||||
- readelf = "${toolchain_bin}/${custom_target_triple}-readelf"
|
||||
- nm = "${toolchain_bin}/${custom_target_triple}-nm"
|
||||
- strip = "${toolchain_bin}/${custom_target_triple}-strip"
|
||||
+ readelf = "${toolchain_bin}/llvm-readelf"
|
||||
+ nm = "${toolchain_bin}/llvm-nm"
|
||||
+ strip = "${toolchain_bin}/llvm-strip"
|
||||
|
||||
target_triple_flags = "--target=${custom_target_triple}"
|
||||
sysroot_flags = "--sysroot ${custom_sysroot}"
|
||||
--
|
||||
2.39.2
|
||||
@@ -0,0 +1,37 @@
|
||||
From 51e8fed854fd9d373bb9b20d7ed8e7cf6ef12312 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Duskett <adam.duskett@amarulasolutions.com>
|
||||
Date: Wed, 19 Jul 2023 11:48:59 -0700
|
||||
Subject: [PATCH] pkg-config.py: do not prepend sysroot path
|
||||
|
||||
Buildroot uses the standard PKG_CONFIG_SYSROOT_DIR variable, so what the
|
||||
pkg-config.py script is doing doesn't make sense. There is no need to prepend
|
||||
the sysroot, and flutter should let pkg-config use the PKG_CONFIG_SYSROOT_DIR
|
||||
variable.
|
||||
|
||||
Without this patch, the pkg-config.py script double prepends the sysroot path.
|
||||
IE: output/host/.../sysroot/output/host/.../sysroot
|
||||
|
||||
Upstream: https://github.com/flutter/flutter/issues/132152
|
||||
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
|
||||
---
|
||||
engine/src/build/config/linux/pkg-config.py | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/engine/src/build/config/linux/pkg-config.py b/engine/src/build/config/linux/pkg-config.py
|
||||
index b4a6aff17..44ffdcaea 100644
|
||||
--- a/engine/src/build/config/linux/pkg-config.py
|
||||
+++ b/engine/src/build/config/linux/pkg-config.py
|
||||
@@ -207,9 +207,7 @@ def main():
|
||||
all_flags = flag_string.strip().split(' ')
|
||||
|
||||
|
||||
- sysroot = options.sysroot
|
||||
- if not sysroot:
|
||||
- sysroot = ''
|
||||
+ sysroot = ''
|
||||
|
||||
includes = []
|
||||
cflags = []
|
||||
--
|
||||
2.41.0
|
||||
|
||||
78
package/flutter-engine/Config.in
Normal file
78
package/flutter-engine/Config.in
Normal file
@@ -0,0 +1,78 @@
|
||||
# Flutter includes a vendor copy of clang which is mandatory to use for
|
||||
# compiling. These are the supported architectures.
|
||||
config BR2_PACKAGE_FLUTTER_ENGINE_ARCH_SUPPORTS
|
||||
bool
|
||||
default y if BR2_aarch64
|
||||
default y if BR2_arm && !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5
|
||||
default y if BR2_x86_64
|
||||
|
||||
config BR2_PACKAGE_FLUTTER_ENGINE
|
||||
bool "flutter-engine"
|
||||
depends on BR2_PACKAGE_FLUTTER_ENGINE_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_USES_GLIBC
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
|
||||
depends on !BR2_STATIC_LIBS
|
||||
depends on BR2_USE_WCHAR # std::wstring
|
||||
depends on BR2_HOST_GCC_AT_LEAST_5
|
||||
depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
|
||||
select BR2_PACKAGE_FREETYPE
|
||||
select BR2_PACKAGE_HOST_DEPOT_TOOLS
|
||||
select BR2_PACKAGE_ZLIB
|
||||
help
|
||||
Flutter is Google's SDK for crafting beautiful, fast user
|
||||
experience for mobile, web, and desktop from a single
|
||||
codebase. Flutter works with existing code, is used by
|
||||
developers and organizations around the world, and is
|
||||
free and open source.
|
||||
|
||||
The Flutter Engine is a portable runtime for hosting
|
||||
Flutter applications. It implements Flutter's core
|
||||
libraries, including animation and graphics, file and
|
||||
network I/O, accessibility support, plugin architecture,
|
||||
and a Dart runtime and compile toolchain. Most developers
|
||||
will interact with Flutter via the Flutter Framework,
|
||||
which provides a modern, reactive framework, and a rich
|
||||
set of platform, layout and foundation widgets.
|
||||
|
||||
https://github.com/flutter/engine
|
||||
|
||||
if BR2_PACKAGE_FLUTTER_ENGINE
|
||||
|
||||
config FLUTTER_ENGINE_RUNTIME_MODE_PROFILE
|
||||
bool "enable profiling"
|
||||
help
|
||||
Some debugging ability is maintained—enough to profile your
|
||||
apps performance. Profile mode is disabled on the emulator
|
||||
and simulator, because their behavior is not representative
|
||||
of real performance. Profile mode is similar to release mode,
|
||||
with the following differences:
|
||||
|
||||
- Some service extensions, such as the one that enables the
|
||||
performance overlay, are enabled.
|
||||
|
||||
- Tracing is enabled, and tools supporting source-level
|
||||
debugging (such as DevTools) can connect to the process.
|
||||
|
||||
If this option is left unselected, the global option
|
||||
BR2_ENABLE_RUNTIME_DEBUG determines whether to build Flutter
|
||||
in release or debug mode.
|
||||
|
||||
https://docs.flutter.dev/testing/build-modes#profile
|
||||
|
||||
endif
|
||||
|
||||
comment "flutter-engine needs an OpenGL or OpenGLES backend"
|
||||
depends on BR2_PACKAGE_FLUTTER_ENGINE_ARCH_SUPPORTS
|
||||
depends on !BR2_PACKAGE_HAS_LIBGL && !BR2_PACKAGE_HAS_LIBGLES
|
||||
|
||||
comment "flutter-engine needs a glibc toolchain w/ wchar, C++, gcc >= 5, dynamic library, host gcc >= 5"
|
||||
depends on BR2_PACKAGE_FLUTTER_ENGINE_ARCH_SUPPORTS
|
||||
depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP \
|
||||
|| !BR2_TOOLCHAIN_GCC_AT_LEAST_5 || BR2_STATIC_LIBS \
|
||||
|| !BR2_USE_WCHAR || !BR2_HOST_GCC_AT_LEAST_5
|
||||
|
||||
comment "flutter-engine needs a toolchain not affected by GCC bug 64735"
|
||||
depends on BR2_PACKAGE_FLUTTER_ENGINE_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
|
||||
14
package/flutter-engine/dot-gclient
Normal file
14
package/flutter-engine/dot-gclient
Normal file
@@ -0,0 +1,14 @@
|
||||
# Definition file to download flutter-engine
|
||||
# Inspired by the output of meta-flutter/lib/gn.py
|
||||
|
||||
solutions = [{
|
||||
"managed": False,
|
||||
"name": "./",
|
||||
"url": "https://github.com/flutter/flutter.git@!FLUTTER_VERSION!",
|
||||
"custom_vars": {
|
||||
"download_android_deps": False,
|
||||
"download_windows_deps": False,
|
||||
"download_linux_deps": False,
|
||||
"download_fuchsia_deps": False
|
||||
},
|
||||
}]
|
||||
1
package/flutter-engine/flutter-engine.hash
Normal file
1
package/flutter-engine/flutter-engine.hash
Normal file
@@ -0,0 +1 @@
|
||||
sha256 a598db94b6290ffbe10b5ecf911057b6a943351c727fdda9e5f2891d68700a20 LICENSE
|
||||
254
package/flutter-engine/flutter-engine.mk
Normal file
254
package/flutter-engine/flutter-engine.mk
Normal file
@@ -0,0 +1,254 @@
|
||||
################################################################################
|
||||
#
|
||||
# flutter-engine
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# Flutter-engine has a release on the GitHub page. However, that release is
|
||||
# only for Google. Its intended purpose is for the gclient tool provided by
|
||||
# Google in their depot-tools package. To use the source code, we must use
|
||||
# gclient to download the flutter-engine source code along with several other
|
||||
# projects. Unfortunately, the Buildroot download system does not have the
|
||||
# capability of using gclient, and considering this package is the only
|
||||
# package that uses gclient, we side-step the entire download process and
|
||||
# perform the following steps if a tarball does not exist already:
|
||||
#
|
||||
# - Copy the pre-made gclient config file to a temporary scratch directory.
|
||||
# - Run gclient sync to generate a source directory with the proper
|
||||
# flutter-engine source code in the correct places.
|
||||
# - Create a source tarball.
|
||||
# - Copy the source tarball to the $(FLUTTER_ENGINE_DL_DIR) directory.
|
||||
#
|
||||
# There is no hash provided for the source tarball, as the gn binary
|
||||
# (used for configuration) relies on the .git directories. As such, a
|
||||
# reproducible tarball is not possible.
|
||||
FLUTTER_ENGINE_VERSION = 3.29.2
|
||||
|
||||
# There is nothing for Buildroot to download. This is handled by gclient.
|
||||
FLUTTER_ENGINE_SITE =
|
||||
FLUTTER_ENGINE_SOURCE =
|
||||
FLUTTER_ENGINE_LICENSE = BSD-3-Clause
|
||||
FLUTTER_ENGINE_LICENSE_FILES = LICENSE
|
||||
FLUTTER_ENGINE_TARBALL_PATH = $(FLUTTER_ENGINE_DL_DIR)/flutter-$(FLUTTER_ENGINE_VERSION).tar.gz
|
||||
FLUTTER_ENGINE_INSTALL_STAGING = YES
|
||||
FLUTTER_ENGINE_DOWNLOAD_DEPENDENCIES = host-depot-tools
|
||||
FLUTTER_ENGINE_DEPENDENCIES = \
|
||||
host-flutter-sdk-bin \
|
||||
host-ninja \
|
||||
host-pkgconf \
|
||||
freetype \
|
||||
zlib
|
||||
|
||||
# Dispatch all architectures of flutter
|
||||
# FLUTTER_ENGINE_TARGET_TRIPPLE must match the directory name found in
|
||||
# engine/src/buildtools/linux-x64/clang/lib/clang/*/lib
|
||||
ifeq ($(BR2_aarch64),y)
|
||||
FLUTTER_ENGINE_TARGET_ARCH = arm64
|
||||
FLUTTER_ENGINE_TARGET_TRIPPLE = aarch64-unknown-linux-gnu
|
||||
else ifeq ($(BR2_arm)$(BR2_armeb),y)
|
||||
FLUTTER_ENGINE_TARGET_ARCH = arm
|
||||
FLUTTER_ENGINE_TARGET_TRIPPLE = armv7-unknown-linux-gnueabihf
|
||||
else ifeq ($(BR2_x86_64),y)
|
||||
FLUTTER_ENGINE_TARGET_ARCH = x64
|
||||
FLUTTER_ENGINE_TARGET_TRIPPLE = x86_64-unknown-linux-gnu
|
||||
endif
|
||||
|
||||
ifeq ($(FLUTTER_ENGINE_RUNTIME_MODE_PROFILE),y)
|
||||
FLUTTER_ENGINE_RUNTIME_MODE=profile
|
||||
else ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)
|
||||
FLUTTER_ENGINE_RUNTIME_MODE=debug
|
||||
else
|
||||
FLUTTER_ENGINE_RUNTIME_MODE=release
|
||||
endif
|
||||
|
||||
FLUTTER_ENGINE_BUILD_DIR = \
|
||||
$(@D)/engine/src/out/linux_$(FLUTTER_ENGINE_RUNTIME_MODE)_$(FLUTTER_ENGINE_TARGET_ARCH)
|
||||
|
||||
FLUTTER_ENGINE_INSTALL_FILES = libflutter_engine.so
|
||||
|
||||
# Flutter engine includes a bundled patched clang that must be used for
|
||||
# compiling or else there are linking errors.
|
||||
FLUTTER_ENGINE_CLANG_PATH = $(@D)/engine/src/flutter/buildtools/linux-x64/clang
|
||||
|
||||
FLUTTER_ENGINE_CONF_OPTS = \
|
||||
--clang \
|
||||
--embedder-for-target \
|
||||
--linux-cpu $(FLUTTER_ENGINE_TARGET_ARCH) \
|
||||
--no-build-embedder-examples \
|
||||
--no-clang-static-analyzer \
|
||||
--no-enable-unittests \
|
||||
--no-goma \
|
||||
--no-prebuilt-dart-sdk \
|
||||
--no-stripped \
|
||||
--runtime-mode $(FLUTTER_ENGINE_RUNTIME_MODE) \
|
||||
--target-os linux \
|
||||
--target-sysroot $(STAGING_DIR) \
|
||||
--target-toolchain $(FLUTTER_ENGINE_CLANG_PATH) \
|
||||
--target-triple $(FLUTTER_ENGINE_TARGET_TRIPPLE)
|
||||
|
||||
ifeq ($(BR2_arm)$(BR2_armeb),y)
|
||||
FLUTTER_ENGINE_CONF_OPTS += \
|
||||
--arm-float-abi $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
|
||||
endif
|
||||
|
||||
# We must specify a full path to ccache and a full path to the flutter-engine
|
||||
# provided clang in order to use ccache, or else flutter-engine will error out
|
||||
# attempting to find ccache in the target-toolchain provided path.
|
||||
ifeq ($(BR2_CCACHE),y)
|
||||
define FLUTTER_ENGINE_COMPILER_PATH_FIXUP
|
||||
$(SED) "s%cc =.*%cc = \"$(HOST_DIR)/bin/ccache $(FLUTTER_ENGINE_CLANG_PATH)/bin/clang\""%g \
|
||||
$(@D)/engine/src/build/toolchain/custom/BUILD.gn
|
||||
|
||||
$(SED) "s%cxx =.*%cxx = \"$(HOST_DIR)/bin/ccache $(FLUTTER_ENGINE_CLANG_PATH)/bin/clang++\""%g \
|
||||
$(@D)/engine/src/build/toolchain/custom/BUILD.gn
|
||||
endef
|
||||
FLUTTER_ENGINE_PRE_CONFIGURE_HOOKS += FLUTTER_ENGINE_COMPILER_PATH_FIXUP
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_ENABLE_LTO),y)
|
||||
FLUTTER_ENGINE_CONF_OPTS += --lto
|
||||
else
|
||||
FLUTTER_ENGINE_CONF_OPTS += --no-lto
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_OPTIMIZE_0),y)
|
||||
FLUTTER_ENGINE_CONF_OPTS += --unoptimized
|
||||
endif
|
||||
|
||||
# There is no --disable-fontconfig option.
|
||||
ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
|
||||
FLUTTER_ENGINE_DEPENDENCIES += fontconfig
|
||||
FLUTTER_ENGINE_CONF_OPTS += --enable-fontconfig
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_HAS_LIBGL),y)
|
||||
FLUTTER_ENGINE_DEPENDENCIES += libgl
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_HAS_LIBGLES),y)
|
||||
FLUTTER_ENGINE_DEPENDENCIES += libgles
|
||||
FLUTTER_ENGINE_CONF_OPTS += --enable-impeller-3d
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBGLFW),y)
|
||||
FLUTTER_ENGINE_DEPENDENCIES += libglfw
|
||||
FLUTTER_ENGINE_CONF_OPTS += --build-glfw-shell
|
||||
else
|
||||
FLUTTER_ENGINE_CONF_OPTS += --no-build-glfw-shell
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBGTK3),y)
|
||||
FLUTTER_ENGINE_DEPENDENCIES += libgtk3
|
||||
FLUTTER_ENGINE_INSTALL_FILES += libflutter_linux_gtk.so
|
||||
else
|
||||
FLUTTER_ENGINE_CONF_OPTS += --disable-desktop-embeddings
|
||||
endif
|
||||
|
||||
# There is no --disable-vulkan option
|
||||
ifeq ($(BR2_PACKAGE_MESA3D_VULKAN_DRIVER),y)
|
||||
FLUTTER_ENGINE_CONF_OPTS += --enable-vulkan
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_XORG7)$(BR2_PACKAGE_LIBXCB),yy)
|
||||
FLUTTER_ENGINE_DEPENDENCIES += libxcb
|
||||
else
|
||||
define FLUTTER_ENGINE_VULKAN_X11_SUPPORT_FIXUP
|
||||
$(SED) "s%vulkan_use_x11.*%vulkan_use_x11 = false%g" -i \
|
||||
$(@D)/engine/src/flutter/build_overrides/vulkan_headers.gni
|
||||
|
||||
$(SED) "s%ozone_platform_x11.*%ozone_platform_x11 = false%g" \
|
||||
$(@D)/engine/src/build/config/BUILDCONFIG.gn
|
||||
endef
|
||||
FLUTTER_ENGINE_PRE_CONFIGURE_HOOKS += FLUTTER_ENGINE_VULKAN_X11_SUPPORT_FIXUP
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_WAYLAND),y)
|
||||
FLUTTER_ENGINE_DEPENDENCIES += wayland
|
||||
else
|
||||
define FLUTTER_ENGINE_VULKAN_WAYLAND_SUPPORT_FIXUP
|
||||
$(SED) "s%vulkan_use_wayland.*%vulkan_use_wayland = false%g" \
|
||||
$(@D)/engine/src/flutter/build_overrides/vulkan_headers.gni
|
||||
|
||||
$(SED) "s%ozone_platform_wayland.*%ozone_platform_wayland = false%g" \
|
||||
$(@D)/engine/src/build/config/BUILDCONFIG.gn
|
||||
endef
|
||||
FLUTTER_ENGINE_PRE_CONFIGURE_HOOKS += FLUTTER_ENGINE_VULKAN_WAYLAND_SUPPORT_FIXUP
|
||||
endif
|
||||
|
||||
# Generate a tarball if one does not already exist.
|
||||
define FLUTTER_ENGINE_GENERATE_TARBALL
|
||||
TAR="$(TAR)" \
|
||||
PATH=$(HOST_DIR)/share/depot_tools:$(BR_PATH) \
|
||||
PYTHONPATH=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR) \
|
||||
PUB_CACHE=$(FLUTTER_SDK_BIN_PUB_CACHE) \
|
||||
$(FLUTTER_ENGINE_PKGDIR)/gen-tarball \
|
||||
--dot-gclient $(TOPDIR)/$(FLUTTER_ENGINE_PKGDIR)/dot-gclient \
|
||||
--jobs $(PARALLEL_JOBS) \
|
||||
--scratch-dir $(@D)/dl-tmp \
|
||||
--tarball-dl-path $(FLUTTER_ENGINE_TARBALL_PATH) \
|
||||
--version $(FLUTTER_ENGINE_VERSION)
|
||||
endef
|
||||
FLUTTER_ENGINE_POST_DOWNLOAD_HOOKS += FLUTTER_ENGINE_GENERATE_TARBALL
|
||||
|
||||
define FLUTTER_ENGINE_EXTRACT_CMDS
|
||||
$(call suitable-extractor,$(FLUTTER_ENGINE_TARBALL_PATH)) $(FLUTTER_ENGINE_TARBALL_PATH) \
|
||||
| $(TAR) --strip-components=1 -C $(@D) $(TAR_OPTIONS) -
|
||||
endef
|
||||
|
||||
# We must set the home directory to the sdk directory or else flutter will
|
||||
# place .dart, and .flutter in ~/.
|
||||
define FLUTTER_ENGINE_CONFIGURE_CMDS
|
||||
cd $(@D)/engine/src && \
|
||||
rm -rf $(FLUTTER_ENGINE_BUILD_DIR) && \
|
||||
PATH=$(HOST_DIR)/share/depot_tools:$(BR_PATH) \
|
||||
PUB_CACHE=$(FLUTTER_SDK_BIN_PUB_CACHE) \
|
||||
HOME=$(HOST_FLUTTER_SDK_BIN_SDK) \
|
||||
./flutter/tools/gn \
|
||||
$(FLUTTER_ENGINE_CONF_OPTS)
|
||||
endef
|
||||
|
||||
define FLUTTER_ENGINE_BUILD_CMDS
|
||||
cd $(@D)/engine/src && \
|
||||
PATH=$(HOST_DIR)/share/depot_tools:$(BR_PATH) \
|
||||
PUB_CACHE=$(FLUTTER_SDK_BIN_PUB_CACHE) \
|
||||
HOME=$(HOST_FLUTTER_SDK_BIN_SDK) \
|
||||
$(HOST_DIR)/bin/ninja \
|
||||
-j $(PARALLEL_JOBS) \
|
||||
-C $(FLUTTER_ENGINE_BUILD_DIR)
|
||||
endef
|
||||
|
||||
# Flutter-engine builds several host applications use for flutter development.
|
||||
# One of those applications is gen_snapshot, which turns applications into
|
||||
# usable .so files for the target architecture. Compiling a host version of
|
||||
# flutter-engine would result in binaries producing host-architecture
|
||||
# flutter applications .so files. As such, copy gen_snapshot to the host
|
||||
# directory here and name it flutter_gen_snapshot for clarity.
|
||||
FLUTTER_ENGINE_GEN_SNAPSHOT = $(HOST_DIR)/bin/flutter_gen_snapshot
|
||||
define FLUTTER_ENGINE_INSTALL_GEN_SNAPSHOT
|
||||
$(INSTALL) -D -m 0755 $(FLUTTER_ENGINE_BUILD_DIR)/clang_x64/gen_snapshot \
|
||||
$(HOST_DIR)/bin/flutter_gen_snapshot
|
||||
endef
|
||||
FLUTTER_ENGINE_POST_INSTALL_STAGING_HOOKS += FLUTTER_ENGINE_INSTALL_GEN_SNAPSHOT
|
||||
|
||||
define FLUTTER_ENGINE_INSTALL_STAGING_CMDS
|
||||
$(foreach i,$(FLUTTER_ENGINE_INSTALL_FILES),
|
||||
$(INSTALL) -D -m 0755 $(FLUTTER_ENGINE_BUILD_DIR)/so.unstripped/$(i) \
|
||||
$(STAGING_DIR)/usr/lib/$(i); \
|
||||
)
|
||||
$(INSTALL) -D -m 0755 $(FLUTTER_ENGINE_BUILD_DIR)/flutter_embedder.h \
|
||||
$(STAGING_DIR)/usr/include/flutter_embedder.h
|
||||
|
||||
$(INSTALL) -D -m 0755 $(FLUTTER_ENGINE_BUILD_DIR)/icudtl.dat \
|
||||
$(STAGING_DIR)/usr/share/flutter/$(FLUTTER_ENGINE_RUNTIME_MODE)/data/icudtl.dat
|
||||
endef
|
||||
|
||||
define FLUTTER_ENGINE_INSTALL_TARGET_CMDS
|
||||
$(foreach i,$(FLUTTER_ENGINE_INSTALL_FILES),
|
||||
$(INSTALL) -D -m 0755 $(FLUTTER_ENGINE_BUILD_DIR)/so.unstripped/$(i) \
|
||||
$(TARGET_DIR)/usr/lib/$(i); \
|
||||
)
|
||||
$(INSTALL) -D -m 0755 $(FLUTTER_ENGINE_BUILD_DIR)/icudtl.dat \
|
||||
$(TARGET_DIR)/usr/share/flutter/$(FLUTTER_ENGINE_RUNTIME_MODE)/data/icudtl.dat
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
95
package/flutter-engine/gen-tarball
Executable file
95
package/flutter-engine/gen-tarball
Executable file
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
# Call gclient and generate a flutter-engine source tarball if one does not
|
||||
# already exist.
|
||||
set -eu
|
||||
|
||||
DL_DIR=
|
||||
DOT_GCLIENT=
|
||||
JOBS=
|
||||
SCRATCH_DIR=
|
||||
TARBALL_DL_PATH=
|
||||
VERSION=
|
||||
TARBALL_NAME=
|
||||
|
||||
term_bold="$(tput smso 2>/dev/null || true)"
|
||||
term_reset="$(tput rmso 2>/dev/null || true)"
|
||||
|
||||
# Print status messages in the same style Buildroot prints.
|
||||
message() {
|
||||
printf "%s>>> flutter-engine %s %s%s\n" "${term_bold}" "${VERSION}" "${1}" "${term_reset}"
|
||||
}
|
||||
|
||||
parse_opts() {
|
||||
local o O opts
|
||||
|
||||
o='d:j:s:t:v:'
|
||||
O='dot-gclient:,jobs:,scratch-dir:,tarball-dl-path:,version:'
|
||||
opts="$(getopt -o "${o}" -l "${O}" -- "${@}")"
|
||||
eval set -- "${opts}"
|
||||
|
||||
while [ ${#} -gt 0 ]; do
|
||||
case "${1}" in
|
||||
(-d|--dot-gclient) DOT_GCLIENT="${2}"; shift 2;;
|
||||
(-j|--jobs) JOBS="${2}"; shift 2;;
|
||||
(-s|--scratch-dir) SCRATCH_DIR="${2}"; shift 2;;
|
||||
(-t|--tarball-dl-path) DL_DIR=$(dirname "${2}"); TARBALL_DL_PATH="${2}"; shift 2;;
|
||||
(-v|--version) VERSION="${2}"; TARBALL_NAME=flutter-"${VERSION}".tar.gz; shift 2;;
|
||||
(--) shift; break;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
prepare() {
|
||||
rm -rf "${SCRATCH_DIR}"
|
||||
mkdir -p "${SCRATCH_DIR}"/src
|
||||
pushd "${SCRATCH_DIR}"/src >/dev/null
|
||||
}
|
||||
|
||||
copy_dot_gclient() {
|
||||
sed "s%!FLUTTER_VERSION!%${VERSION}%g" "${DOT_GCLIENT}" >.gclient
|
||||
}
|
||||
|
||||
run_gclient() {
|
||||
message "Downloading"
|
||||
gclient.py \
|
||||
sync \
|
||||
--delete_unversioned_trees \
|
||||
--no-history \
|
||||
--reset \
|
||||
--shallow \
|
||||
-j"${JOBS}"
|
||||
}
|
||||
|
||||
gen_tarball() {
|
||||
message "Generating tarball"
|
||||
mkdir -p "${DL_DIR}"
|
||||
pushd "${SCRATCH_DIR}" >/dev/null
|
||||
# There are two issues with the flutter-engine buildsystem:
|
||||
# - it expects empty directories created by gclient.py to be present; that
|
||||
# means we can't use the mk_tar_gz helper method from support/download/helpers,
|
||||
# because it does not include empty directories;
|
||||
# - it insists on having a full git repositoy, with .git et al., which means
|
||||
# we can't generate a reproducible archive anyway.
|
||||
# So we just create a plain tarball.
|
||||
${TAR} -C "${SCRATCH_DIR}"/src -czf "${TARBALL_NAME}" .
|
||||
mv "${TARBALL_NAME}" "${TARBALL_DL_PATH}"
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
popd >/dev/null
|
||||
rm -rf "${SCRATCH_DIR}"
|
||||
}
|
||||
|
||||
main() {
|
||||
parse_opts "${@}"
|
||||
if [[ ! -e "${TARBALL_DL_PATH}" ]]; then
|
||||
prepare
|
||||
copy_dot_gclient
|
||||
run_gclient
|
||||
gen_tarball
|
||||
cleanup
|
||||
fi
|
||||
}
|
||||
|
||||
main "${@}"
|
||||
Reference in New Issue
Block a user