@@ -28,6 +28,7 @@
N: Adam Duskett <adam.duskett@amarulasolutions.com>
F: package/depot-tools/
+F: package/flutter-sdk-bin/
N: Adam Duskett <aduskett@gmail.com>
F: package/firewalld/
@@ -36,6 +36,7 @@ menu "Host utilities"
source "package/faketime/Config.in.host"
source "package/fatcat/Config.in.host"
source "package/firmware-utils/Config.in.host"
+ source "package/flutter-sdk-bin/Config.in.host"
source "package/fwup/Config.in.host"
source "package/genext2fs/Config.in.host"
source "package/genimage/Config.in.host"
new file mode 100644
@@ -0,0 +1,16 @@
+# All host rust packages should depend on this option
+config BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_ARCH_SUPPORTS
+ bool
+ default y if BR2_HOSTARCH = "x86_64"
+
+config BR2_PACKAGE_HOST_FLUTTER_SDK_BIN
+ bool "host flutter-sdk-bin"
+ depends on BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_ARCH_SUPPORTS
+ help
+ Flutter is Google's SDK for crafting beautiful, fast user
+ experiences 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.
+
+ https://flutter.dev/
new file mode 100644
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 7048e51a89c99a5b6cac6d8ae416121264effa76da34dba5c0e7cf85519c8e98 flutter_linux_3.10.6-stable.tar.xz
+sha256 a598db94b6290ffbe10b5ecf911057b6a943351c727fdda9e5f2891d68700a20 LICENSE
new file mode 100644
@@ -0,0 +1,95 @@
+################################################################################
+#
+# host-flutter-sdk-bin
+#
+################################################################################
+
+FLUTTER_SDK_BIN_VERSION = 3.10.6
+FLUTTER_SDK_BIN_SITE = https://storage.googleapis.com/flutter_infra_release/releases/stable/linux
+FLUTTER_SDK_BIN_SOURCE = flutter_linux_$(FLUTTER_SDK_BIN_VERSION)-stable.tar.xz
+FLUTTER_SDK_BIN_LICENSE = BSD-3-Clause
+FLUTTER_SDK_BIN_LICENSE_FILES = LICENSE
+
+HOST_FLUTTER_SDK_BIN_SDK = $(HOST_DIR)/share/flutter/sdk
+HOST_FLUTTER_SDK_BIN_DART_SDK = $(HOST_FLUTTER_SDK_BIN_SDK)/bin/cache/dart-sdk
+HOST_FLUTTER_SDK_BIN_SDK_ENGINE = $(HOST_FLUTTER_SDK_BIN_SDK)/bin/cache/artifacts/engine
+
+# We must set the home directory to the sdk directory or else flutter will
+# place .dart, .dart-sdk, and .flutter in ~/.
+HOST_FLUTTER_SDK_BIN_ENV = \
+ HOME=$(HOST_FLUTTER_SDK_BIN_SDK) \
+ PATH=$(BR_PATH):$(HOST_FLUTTER_SDK_BIN_SDK):$(HOST_FLUTTER_SDK_BIN_SDK)/bin \
+ PUB_CACHE=$(HOST_FLUTTER_SDK_BIN_SDK)/.pub-cache
+
+# The following config options must be ran one at a time.
+HOST_FLUTTER_SDK_BIN_CONF_OPTS = \
+ --clear-features \
+ --no-analytics \
+ --disable-telemetry \
+ --enable-custom-devices \
+ --enable-linux-desktop \
+ --no-enable-android \
+ --no-enable-fuchsia \
+ --no-enable-ios \
+ --no-enable-macos-desktop \
+ --no-enable-windows-desktop
+
+define HOST_FLUTTER_SDK_BIN_CONFIGURE_CMDS
+ $(foreach i,$(HOST_FLUTTER_SDK_BIN_CONF_OPTS),
+ $(HOST_FLUTTER_SDK_BIN_ENV) $(@D)/bin/flutter config $(i); \
+ )
+ $(HOST_FLUTTER_SDK_BIN_ENV) $(@D)/bin/dart --disable-analytics
+endef
+
+# Remove the cache, as we will run precache after setting up flutter and dart
+# with the new config options.
+define HOST_FLUTTER_SDK_BIN_BUILD_CMDS
+ mkdir -p $(HOST_FLUTTER_SDK_BIN_SDK)
+ rm -rf $(HOST_FLUTTER_SDK_BIN_SDK)/.pub-cache
+ cd $(@D) && \
+ $(HOST_FLUTTER_SDK_BIN_ENV) $(@D)/bin/flutter precache;
+endef
+
+define HOST_FLUTTER_SDK_BIN_INSTALL_CMDS
+ cp -rpdT $(@D)/. $(HOST_FLUTTER_SDK_BIN_SDK)/
+endef
+
+ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)
+HOST_FLUTTER_SDK_BIN_SDK_ROOT = \
+ $(HOST_FLUTTER_SDK_BIN_SDK_ENGINE)/common/flutter_patched_sdk
+HOST_FLUTTER_SDK_BIN_SDK_PRODUCT = false
+else
+HOST_FLUTTER_SDK_BIN_SDK_ROOT = \
+ $(HOST_FLUTTER_SDK_BIN_SDK_ENGINE)/common/flutter_patched_sdk_product
+HOST_FLUTTER_SDK_BIN_SDK_PRODUCT = true
+endif
+
+# The Order matters.Taken from:
+# https://github.com/meta-flutter/meta-flutter/blob/kirkstone/classes/flutter-app.inc
+HOST_FLUTTER_SDK_BIN_DART_ARGS = \
+ --verbose \
+ --disable-analytics \
+ --disable-dart-dev $(HOST_FLUTTER_SDK_BIN_SDK_ENGINE)/linux-x64/frontend_server.dart.snapshot \
+ --sdk-root $(HOST_FLUTTER_SDK_BIN_SDK_ROOT) \
+ --target=flutter \
+ --no-print-incremental-dependencies \
+ -Ddart.vm.profile=false \
+ -Ddart.vm.product=$(HOST_FLUTTER_SDK_BIN_SDK_PRODUCT) \
+ --aot \
+ --tfa \
+ --packages .dart_tool/package_config.json \
+ --output-dill .dart_tool/flutter_build/*/app.dill \
+ --depfile .dart_tool/flutter_build/*/kernel_snapshot.d
+
+# Helper wrapper to run flutter when building flutter applications.
+HOST_FLUTTER_SDK_BIN_FLUTTER = \
+ $(HOST_FLUTTER_SDK_BIN_ENV) \
+ $(HOST_FLUTTER_SDK_BIN_SDK)/bin/flutter
+
+# Helper wrapper to run dart when building flutter applications.
+HOST_FLUTTER_SDK_BIN_DART_BIN = \
+ $(HOST_FLUTTER_SDK_BIN_ENV) \
+ $(HOST_FLUTTER_SDK_BIN_DART_SDK)/bin/dart \
+ $(HOST_FLUTTER_SDK_BIN_DART_ARGS)
+
+$(eval $(host-generic-package))
flutter-sdk-bin is a collection of host tools and plugins used to compile flutter applications. - As this is a collection of pre-compiled tools, append -bin to the end of the package name. - We must set the HOME directory variable to the sdk directory or else the flutter dart binaries place .dart, .dart-sdk, and .flutter in ~/. - set --clear-features, --no-analytics and --disable-telemetry first to disable google tracking as soon as possible. Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> --- Changes v5 -> v6: - Drop removing the cache directories. It's unecessary and causes flutter to redownload a bunch of packages to create the same directory structure as before. I am not sure why the flutter yocto recipe does this. Changes v4 -> v5: - Add a Config.in.host and set BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_ARCH_SUPPORTS to only support x86_64 [Yann] - Set the HOME variable when calling flutter and dart to prevent .dart, .dart-sdk, and .flutter from showing up in ~/. Yes, this is insane, no, there is not another option I could find. [Yann] - Add more disable config options to cut down on unecessary features. - Call the config options in a loop. DEVELOPERS | 1 + package/Config.in.host | 1 + package/flutter-sdk-bin/Config.in.host | 16 ++++ package/flutter-sdk-bin/flutter-sdk-bin.hash | 3 + package/flutter-sdk-bin/flutter-sdk-bin.mk | 95 ++++++++++++++++++++ 5 files changed, 116 insertions(+) create mode 100644 package/flutter-sdk-bin/Config.in.host create mode 100644 package/flutter-sdk-bin/flutter-sdk-bin.hash create mode 100644 package/flutter-sdk-bin/flutter-sdk-bin.mk