Browse Source

package/flutter-engine: bump to version 3.29.2

As of Flutter 3.27.4, the flutter-engine github repository is archived, and the
flutter-engine source code now resides at https://github.com/flutter/flutter/.

Because of the above, the following changes must occure:

- Paths are now prefixed with engine/src.

- The "name" field in the dot-gclient file is now "./", and the gen-tarball
  script:
   - Makes the dl-tmp/src dir
   - Copies the dot-gclient file to the dl-tmp/src dir
   - Runs gclient.py inside of the dl-tmp/src dir

Without these changes, gclient creates two directores:
dl-tmp/src/flutter and dl-tmp/src/engine, and cloning fails with the following
error:

```
python3: can't open file 'dl-tmp/src/engine/src/flutter/tools/pub_get_offline.py':
[Errno 2] No such file or directory
```

because the file resides at src/flutter/engine/src/flutter/tools.
Changing the name from src/flutter to ./ and running gclient.py directly in
the src directory creates a proper directory structure suitable for compiling.

Of course, this also means there is a new pushd in the gen_tarball method to
move to ${SCRATCH_DIR} to ensure the tarball is generated outside of the
source directory.

Tested with run-tests tests.package.test_flutter.TestFlutter.test_run.

The license file has changed, but it's still BSD-3-Clause.

Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Adam Duskett 4 months ago
parent
commit
1956e4e434

+ 4 - 4
package/flutter-engine/0001-disable-pre-canned-sysroot.patch

@@ -11,13 +11,13 @@ 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>
 ---
- build/config/sysroot.gni | 2 +-
+ engine/src/build/config/sysroot.gni | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni
+diff --git a/engine/src/build/config/sysroot.gni b/engine/src/build/config/sysroot.gni
 index 7987e519d..1de694263 100644
---- a/build/config/sysroot.gni
-+++ b/build/config/sysroot.gni
+--- 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

+ 4 - 4
package/flutter-engine/0002-remove-explicit-x11-dependency.patch

@@ -10,13 +10,13 @@ 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>
 ---
- flutter/shell/platform/linux/config/BUILD.gn | 4 ----
+ engine/src/flutter/shell/platform/linux/config/BUILD.gn | 4 ----
  1 file changed, 4 deletions(-)
 
-diff --git a/flutter/shell/platform/linux/config/BUILD.gn b/flutter/shell/platform/linux/config/BUILD.gn
+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/flutter/shell/platform/linux/config/BUILD.gn
-+++ b/flutter/shell/platform/linux/config/BUILD.gn
+--- 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")

+ 5 - 5
package/flutter-engine/0003-fix-toolchain-paths.patch

@@ -4,7 +4,7 @@ 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, build/toolchain/custom/BUILD.gn attempts to use several gcc utilities
+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.
 
@@ -13,13 +13,13 @@ 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>
 ---
- build/toolchain/custom/BUILD.gn | 4 +++++------
+ engine/src/build/toolchain/custom/BUILD.gn | 4 +++++------
  1 file changed, 5 insertions(+), 6 deletions(-)
 
-diff --git a/build/toolchain/custom/BUILD.gn b/build/toolchain/custom/BUILD.gn
+diff --git a/engine/src/build/toolchain/custom/BUILD.gn b/engine/src/build/toolchain/custom/BUILD.gn
 index 65b1623..8b3f6f8 100644
---- a/build/toolchain/custom/BUILD.gn
-+++ b/build/toolchain/custom/BUILD.gn
+--- 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"

+ 4 - 4
package/flutter-engine/0004-pkg-config.py-do-not-prepend-sysroot-path.patch

@@ -14,13 +14,13 @@ IE: output/host/.../sysroot/output/host/.../sysroot
 Upstream: https://github.com/flutter/flutter/issues/132152
 Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
 ---
- build/config/linux/pkg-config.py | 4 +---
+ engine/src/build/config/linux/pkg-config.py | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
 
-diff --git a/build/config/linux/pkg-config.py b/build/config/linux/pkg-config.py
+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/build/config/linux/pkg-config.py
-+++ b/build/config/linux/pkg-config.py
+--- 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(' ')
  

+ 2 - 2
package/flutter-engine/dot-gclient

@@ -3,8 +3,8 @@
 
 solutions = [{
     "managed": False,
-    "name": "src/flutter",
-    "url": "https://github.com/flutter/engine.git@!FLUTTER_VERSION!",
+    "name": "./",
+    "url": "https://github.com/flutter/flutter.git@!FLUTTER_VERSION!",
     "custom_vars": {
         "download_android_deps": False,
         "download_windows_deps": False,

+ 1 - 1
package/flutter-engine/flutter-engine.hash

@@ -1 +1 @@
-sha256  89519eca6f7b9529b35bdddd623a58c3af06a88c458dbd6531ddb4675acf75a9  LICENSE
+sha256  a598db94b6290ffbe10b5ecf911057b6a943351c727fdda9e5f2891d68700a20  LICENSE

+ 12 - 12
package/flutter-engine/flutter-engine.mk

@@ -22,7 +22,7 @@
 # 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.27.1
+FLUTTER_ENGINE_VERSION = 3.29.2
 
 # There is nothing for Buildroot to download. This is handled by gclient.
 FLUTTER_ENGINE_SITE =
@@ -41,7 +41,7 @@ FLUTTER_ENGINE_DEPENDENCIES = \
 
 # Dispatch all architectures of flutter
 # FLUTTER_ENGINE_TARGET_TRIPPLE must match the directory name found in
-# buildtools/linux-x64/clang/lib/clang/*/lib
+# 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
@@ -62,13 +62,13 @@ FLUTTER_ENGINE_RUNTIME_MODE=release
 endif
 
 FLUTTER_ENGINE_BUILD_DIR = \
-	$(@D)/out/linux_$(FLUTTER_ENGINE_RUNTIME_MODE)_$(FLUTTER_ENGINE_TARGET_ARCH)
+	$(@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)/flutter/buildtools/linux-x64/clang
+FLUTTER_ENGINE_CLANG_PATH = $(@D)/engine/src/flutter/buildtools/linux-x64/clang
 
 FLUTTER_ENGINE_CONF_OPTS = \
 	--clang \
@@ -97,10 +97,10 @@ endif
 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)/build/toolchain/custom/BUILD.gn
+		$(@D)/engine/src/build/toolchain/custom/BUILD.gn
 
 	$(SED) "s%cxx =.*%cxx = \"$(HOST_DIR)/bin/ccache $(FLUTTER_ENGINE_CLANG_PATH)/bin/clang++\""%g \
-		$(@D)/build/toolchain/custom/BUILD.gn
+		$(@D)/engine/src/build/toolchain/custom/BUILD.gn
 endef
 FLUTTER_ENGINE_PRE_CONFIGURE_HOOKS += FLUTTER_ENGINE_COMPILER_PATH_FIXUP
 endif
@@ -154,10 +154,10 @@ FLUTTER_ENGINE_DEPENDENCIES += libxcb
 else
 define FLUTTER_ENGINE_VULKAN_X11_SUPPORT_FIXUP
 	$(SED) "s%vulkan_use_x11.*%vulkan_use_x11 = false%g" -i \
-		$(@D)/flutter/build_overrides/vulkan_headers.gni
+		$(@D)/engine/src/flutter/build_overrides/vulkan_headers.gni
 
 	$(SED) "s%ozone_platform_x11.*%ozone_platform_x11 = false%g" \
-		$(@D)/build/config/BUILDCONFIG.gn
+		$(@D)/engine/src/build/config/BUILDCONFIG.gn
 endef
 FLUTTER_ENGINE_PRE_CONFIGURE_HOOKS += FLUTTER_ENGINE_VULKAN_X11_SUPPORT_FIXUP
 endif
@@ -167,10 +167,10 @@ FLUTTER_ENGINE_DEPENDENCIES += wayland
 else
 define FLUTTER_ENGINE_VULKAN_WAYLAND_SUPPORT_FIXUP
 	$(SED) "s%vulkan_use_wayland.*%vulkan_use_wayland = false%g" \
-		$(@D)/flutter/build_overrides/vulkan_headers.gni
+		$(@D)/engine/src/flutter/build_overrides/vulkan_headers.gni
 
 	$(SED) "s%ozone_platform_wayland.*%ozone_platform_wayland = false%g" \
-		$(@D)/build/config/BUILDCONFIG.gn
+		$(@D)/engine/src/build/config/BUILDCONFIG.gn
 endef
 FLUTTER_ENGINE_PRE_CONFIGURE_HOOKS += FLUTTER_ENGINE_VULKAN_WAYLAND_SUPPORT_FIXUP
 endif
@@ -198,7 +198,7 @@ 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) && \
+	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) \
@@ -208,7 +208,7 @@ define FLUTTER_ENGINE_CONFIGURE_CMDS
 endef
 
 define FLUTTER_ENGINE_BUILD_CMDS
-	cd $(@D) && \
+	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) \

+ 4 - 2
package/flutter-engine/gen-tarball

@@ -41,8 +41,8 @@ parse_opts() {
 
 prepare() {
     rm -rf "${SCRATCH_DIR}"
-    mkdir -p "${SCRATCH_DIR}"
-    pushd "${SCRATCH_DIR}" >/dev/null
+    mkdir -p "${SCRATCH_DIR}"/src
+    pushd "${SCRATCH_DIR}"/src >/dev/null
 }
 
 copy_dot_gclient() {
@@ -63,6 +63,7 @@ run_gclient() {
 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,
@@ -72,6 +73,7 @@ gen_tarball() {
     # 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() {