-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit (migrate from flutter-embedded-linux)
- Loading branch information
Hidenori Matsubayashi
authored and
Hidenori Matsubayashi
committed
Jun 11, 2021
0 parents
commit 00b4eac
Showing
13 changed files
with
328 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Below is a list of people and organizations that have contributed | ||
# to sony/meta-flutter. Names should be added to the list like so: | ||
# | ||
# Name/Organization <email address> | ||
|
||
Sony Group Corporation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Contributing | ||
|
||
Welcome to this project. We welcome all your contribution and feedback. If you've never submitted code before, you must add your (or your organization's) name and contact info to the AUTHORS file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Copyright 2021 Sony Group Corporation. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
* Neither the name of Sony Group Corporation nor the names of its | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# meta-flutter for Yocto Project | ||
Recipe file of [Flutter for Embedded Linux](https://github.com/sony/flutter-embedded-linux) for Yocto Project. | ||
|
||
## Setup environment | ||
In this README, we explain how to build for Arm64 using `core-image-weston` which is one of Yocto Images, and `dunfell` which is one of LTS Yocto versions. See also: https://docs.yoctoproject.org/ | ||
|
||
There are two ways to build using Yocto. One is a build using bitbake and the other is a build using Yocto SDK. | ||
|
||
### Building Yocto | ||
Downloading `Poky` and `meta-clang`, `meta-flutter` source code: | ||
```Shell | ||
$ git clone git://git.yoctoproject.org/poky.git -b dunfell | ||
$ git clone https://github.com/kraj/meta-clang -b dunfell | ||
$ git clone https://github.com/sony/meta-flutter.git | ||
``` | ||
|
||
Setup the build environment using `oe-init-build-env` script in Poky. | ||
```Shell | ||
$ source poky/oe-init-build-env build | ||
``` | ||
|
||
Set your target machine in your `conf/local.conf`: | ||
``` | ||
MACHINE ?= "qemuarm64" | ||
``` | ||
|
||
Add meta-clang layer into `conf/bblayers.conf`. | ||
```Shell | ||
$ bitbake-layers add-layer ../meta-clang | ||
``` | ||
|
||
Add meta-flutter layer into `conf/bblayers.conf`. | ||
```Shell | ||
$ bitbake-layers add-layer ../meta-flutter | ||
``` | ||
|
||
### Building Yocto SDK (Only when using cross-building with Yocto SDK) | ||
Add the following in your `conf/local.conf`: | ||
``` | ||
CLANGSDK = "1" | ||
``` | ||
See also: [Adding clang in generated SDK toolchain](https://github.com/kraj/meta-clang/blob/master/README.md#adding-clang-in-generated-sdk-toolchain) | ||
|
||
Build Yocto SDK for cross-building. | ||
```Shell | ||
$ bitbake core-image-weston -c populate_sdk | ||
``` | ||
See also: [SDK building an sdk installer](https://www.yoctoproject.org/docs/2.1/sdk-manual/sdk-manual.html#sdk-building-an-sdk-installer) | ||
|
||
Install Yocto SDK. | ||
```Shell | ||
$ ./tmp/deploy/sdk/poky-glibc-x86_64-core-image-weston-aarch64-qemuarm64-toolchain-3.1.7.sh | ||
``` | ||
|
||
## Cross-building with bitbake | ||
### Flutter Engine (libflutter_engine.so) | ||
Build target is fixed to Linux and Arm64, and Flutter Engine version is also fixed in the recipe file. | ||
|
||
#### Flutter Engine version | ||
``` | ||
ENGINE_VERSION ?= "f5b97d0b23a3905e9b5b69aa873afcb52f550aaf" | ||
``` | ||
|
||
When creating a Flutter project, you will need to use the following version of the Flutter SDK. | ||
`Flutter 2.3.0-1.0.pre.269` | ||
|
||
If you want to change the version of the Flutter engine, change <engine_version> to the appropriate version of the Flutter SDK and add the following to `conf/local.conf`: | ||
``` | ||
ENGINE_VERSION_pn-flutter-engine = "<engine_version>" | ||
``` | ||
|
||
Flutter Engine is built with release mode by default. If you want to change the build mode, you can change it to add the following in your `conf/local.conf`: | ||
#### Flutter Engine mode | ||
``` | ||
# e.g. debug mode | ||
PACKAGECONFIG_pn-flutter-engine = "debug-mode" | ||
``` | ||
|
||
### Wayland backend | ||
```Shell | ||
$ bitbake flutter-wayland-client | ||
``` | ||
|
||
### DRM-GBM backend | ||
`libsystemd` is required to build this backend. Put the following in your `conf/local.conf`: | ||
``` | ||
DESTRO_FEATURES_append = " systemd" | ||
``` | ||
See also: [Using systemd for the Main Image and Using SysVinit for the Rescue Image](https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#using-systemd-for-the-main-image-and-using-sysvinit-for-the-rescue-image) | ||
|
||
```Shell | ||
$ bitbake flutter-drm-gbm-backend | ||
``` | ||
|
||
### DRM-EGLStream backend | ||
You need to install libsystemd in the same way with the DRM-GBM backend. | ||
|
||
```Shell | ||
$ bitbake flutter-drm-eglstream-backend | ||
``` | ||
|
||
## Cross-building with Yocto SDK | ||
Setup the cross-building toolchain environment using a script that you built and installed. | ||
```Shell | ||
$ source /opt/poky/3.1.7/environment-setup-aarch64-poky-linux | ||
``` | ||
|
||
Set the following environment vars to cross-build using clang. | ||
```Shell | ||
$ export CC=${CLANGCC} | ||
$ export CXX=${CLANGCXX} | ||
``` | ||
|
||
After doing that, you can build the embedder as normal like self-building on hosts. It means you don't need to be aware of cross-building. See: [self-build](https://github.com/sony/flutter-embedded-linux/wiki/Building-Embedded-Linux-embedding-for-Flutter#self-build) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# We have a conf and classes directory, add to BBPATH | ||
BBPATH .= ":${LAYERDIR}" | ||
|
||
# We have recipes-* directories, add to BBFILES | ||
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ | ||
${LAYERDIR}/recipes-*/*/*.bbappend" | ||
|
||
BBFILE_COLLECTIONS += "meta-flutter" | ||
BBFILE_PATTERN_meta-flutter = "^${LAYERDIR}/" | ||
BBFILE_PRIORITY_meta-flutter = "6" | ||
|
||
LAYERDEPENDS_meta-flutter = "core" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
TOOLCHAIN = "clang" | ||
DEPENDS += "libxkbcommon \ | ||
virtual/libgles2 \ | ||
virtual/egl \ | ||
flutter-engine" | ||
|
||
inherit pkgconfig cmake features_check |
20 changes: 20 additions & 0 deletions
20
recipes-graphics/flutter-embedded-linux/flutter-drm-eglstream-backend.bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
SUMMARY = "Flutter embedding for embedded Linux with DRM-EGLStream backend" | ||
DESCRIPTION = "Build the flutter-drm-eglstream-backend project" | ||
|
||
require repository.inc | ||
require dependency.inc | ||
|
||
DEPENDS += "libdrm \ | ||
virtual/mesa \ | ||
libinput \ | ||
udev \ | ||
systemd" | ||
|
||
EXTRA_OECMAKE = "-DUSER_PROJECT_PATH=examples/flutter-drm-eglstream-backend" | ||
|
||
do_install() { | ||
install -d ${D}${bindir} | ||
install -m 0755 ${WORKDIR}/build/flutter-drm-eglstream-backend ${D}${bindir} | ||
} | ||
|
||
require tasks.inc |
20 changes: 20 additions & 0 deletions
20
recipes-graphics/flutter-embedded-linux/flutter-drm-gbm-backend.bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
SUMMARY = "Flutter embedding for embedded Linux with DRM-GBM backend" | ||
DESCRIPTION = "Build the flutter-drm-gbm-backend project" | ||
|
||
require repository.inc | ||
require dependency.inc | ||
|
||
DEPENDS += "libdrm \ | ||
virtual/mesa \ | ||
libinput \ | ||
udev \ | ||
systemd" | ||
|
||
EXTRA_OECMAKE = "-DUSER_PROJECT_PATH=examples/flutter-drm-gbm-backend" | ||
|
||
do_install() { | ||
install -d ${D}${bindir} | ||
install -m 0755 ${WORKDIR}/build/flutter-drm-gbm-backend ${D}${bindir} | ||
} | ||
|
||
require tasks.inc |
18 changes: 18 additions & 0 deletions
18
recipes-graphics/flutter-embedded-linux/flutter-wayland-client.bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
SUMMARY = "Flutter embedding for embedded Linux with Wayland backend" | ||
DESCRIPTION = "Build the flutter-wayland-client project" | ||
|
||
require repository.inc | ||
require dependency.inc | ||
|
||
DEPENDS += "wayland \ | ||
wayland-protocols \ | ||
wayland-native" | ||
|
||
EXTRA_OECMAKE = "-DUSER_PROJECT_PATH=examples/flutter-wayland-client" | ||
|
||
do_install() { | ||
install -d ${D}${bindir} | ||
install -m 0755 ${WORKDIR}/build/flutter-client ${D}${bindir} | ||
} | ||
|
||
require tasks.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
AUTHOR = "Sony Group Corporation" | ||
HOMEPAGE = "https://github.com/sony/flutter-embedded-linux" | ||
BUGTRACKER = "https://github.com/sony/flutter-embedded-linux/issues" | ||
|
||
LICENSE = "BSD-3-Clause" | ||
LIC_FILES_CHKSUM = "file://LICENSE;md5=79ca841e7b9e09b0401186f2aa334adf" | ||
|
||
SRC_URI = "git://github.com/sony/flutter-embedded-linux.git;protocol=https" | ||
SRCREV = "${AUTOREV}" | ||
S = "${WORKDIR}/git" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
do_configure_prepend() { | ||
install -d ${S}/build | ||
install -m 0644 ${STAGING_LIBDIR}/libflutter_engine.so ${S}/build/ | ||
} | ||
do_configure_prepend[depends] += "flutter-engine:do_populate_sysroot" | ||
|
||
FILES_${PN} = "${bindir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
AUTHOR = "Sony Group Corporation" | ||
LICENSE = "BSD-3-Clause" | ||
LIC_FILES_CHKSUM = "file://LICENSE;md5=c2c05f9bdd5fc0b458037c2d1fb8d95e" | ||
|
||
SRC_URI = "git://chromium.googlesource.com/chromium/tools/depot_tools.git;protocol=https" | ||
SRCREV = "da768751d43b1f287bf99bea703ea13e2eedcf4d" | ||
|
||
S = "${WORKDIR}/git" | ||
|
||
inherit pkgconfig | ||
# TODO: Add dependent packages. | ||
DEPENDS = "freetype" | ||
|
||
GN_TOOLS_PYTHON2_PATH ??= "bootstrap-3.8.0.chromium.8_bin/python/bin" | ||
|
||
require gn-args-utils.inc | ||
|
||
ENGINE_VERSION ?= "f5b97d0b23a3905e9b5b69aa873afcb52f550aaf" | ||
PACKAGECONFIG ?= "release-mode" | ||
PACKAGECONFIG[debug-mode] = "--runtime-mode debug --unoptimized" | ||
PACKAGECONFIG[profile-mode] = "--runtime-mode profile --no-lto" | ||
PACKAGECONFIG[release-mode] = "--runtime-mode release" | ||
|
||
GN_TARGET_OS = "linux" | ||
GN_TARGET_ARCH = "arm64" | ||
|
||
GN_ARGS = "--target-sysroot ${STAGING_DIR_TARGET}${PACKAGECONFIG_CONFARGS}" | ||
GN_ARGS_append = " --target-os ${GN_TARGET_OS}" | ||
GN_ARGS_append = " --linux-cpu ${GN_TARGET_ARCH}" | ||
GN_ARGS_append = " --embedder-for-target" | ||
GN_ARGS_append = " --disable-desktop-embeddings" | ||
ARTIFACT_DIR = "${@get_engine_artifact_dir(d)}" | ||
|
||
do_configure() { | ||
# To disable auto update. | ||
export DEPOT_TOOLS_UPDATE=0 | ||
export PATH=${S}:${S}/${GN_TOOLS_PYTHON2_PATH}:$PATH | ||
|
||
cd ${WORKDIR} | ||
echo 'solutions = [ | ||
{ | ||
"managed" : False, | ||
"name" : "src/flutter", | ||
"url" : "https://github.com/flutter/engine.git@${ENGINE_VERSION}", | ||
"custom_deps": {}, | ||
"deps_file": "DEPS", | ||
"safesync_url": "", | ||
"custom_vars": { | ||
"download_android_deps": False, | ||
"download_windows_deps": False, | ||
}, | ||
}, | ||
]' > .gclient | ||
gclient sync | ||
|
||
cd ${WORKDIR}/src | ||
./flutter/tools/gn ${GN_ARGS} | ||
} | ||
|
||
do_compile() { | ||
export PATH=${S}:${S}/${GN_TOOLS_PYTHON2_PATH}:$PATH | ||
|
||
cd ${WORKDIR}/src | ||
ninja -C ${ARTIFACT_DIR} | ||
} | ||
|
||
do_install() { | ||
install -d ${D}${libdir} | ||
install -m 0755 ${WORKDIR}/src/${ARTIFACT_DIR}/libflutter_engine.so ${D}${libdir} | ||
} | ||
|
||
FILES_${PN} = "${libdir}" | ||
FILES_${PN}-dev = "${includedir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def get_engine_artifact_dir(d): | ||
gn_args = d.getVar("GN_ARGS") | ||
|
||
artifact_dir = 'out/' | ||
if 'debug' in gn_args: | ||
artifact_dir += 'linux_debug_unopt_arm64' | ||
elif 'profile' in gn_args: | ||
artifact_dir += 'linux_profile_arm64' | ||
else: | ||
artifact_dir += 'linux_release_arm64' | ||
|
||
return artifact_dir |