From b1e622fe218df1bb0318b560226aac4f0808dab8 Mon Sep 17 00:00:00 2001 From: Joel Winarske Date: Mon, 26 Aug 2024 11:40:10 -0700 Subject: [PATCH] flutter-engine-arm* CI Signed-off-by: Joel Winarske --- .github/workflows/flutter-engine-arm64.yaml | 116 +++++++++++++++++ .github/workflows/flutter-engine-armv7hf.yaml | 121 ++++++++++++++++++ patches/0001-clang-toolchain.patch | 33 +++++ 3 files changed, 270 insertions(+) create mode 100644 .github/workflows/flutter-engine-arm64.yaml create mode 100644 .github/workflows/flutter-engine-armv7hf.yaml create mode 100644 patches/0001-clang-toolchain.patch diff --git a/.github/workflows/flutter-engine-arm64.yaml b/.github/workflows/flutter-engine-arm64.yaml new file mode 100644 index 0000000..2f83f9d --- /dev/null +++ b/.github/workflows/flutter-engine-arm64.yaml @@ -0,0 +1,116 @@ +name: Linux arm64 + +on: + pull_request: + types: [ opened, synchronize, reopened, closed ] + release: + types: [ published, created, edited ] + workflow_dispatch: + +jobs: + linux-arm64: + + env: + # TODO - hard coded for now + SRCREV: "c9b9d5780da342eb3f0f5e439a7db06f7d112575" + + runs-on: [self-hosted, linux, x64] + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install packages + run: | + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git + + - name: Get Flutter Source + run: | + export PATH=$PATH:$PWD/depot_tools + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython + gclient config --spec 'solutions=[{"name":"src/flutter","url":"https://github.com/flutter/engine.git","deps_file":"DEPS","managed":False,"custom_deps":{},"custom_vars":{"download_android_deps":False,"download_windows_deps":False,"download_linux_deps":True}}]' + gclient sync --force --shallow --no-history -R -D --revision $SRCREV -j$(nproc) -v + + PATCH_DIR=$PWD/patches + + # fetch arm64 sysroot + cd src + build/linux/sysroot_scripts/install-sysroot.py --arch=arm64 + + git apply $PATCH_DIR/0001-clang-toolchain.patch + cd flutter + git apply $PATCH_DIR/0001-export-GPU-symbols.patch + + - name: Build Debug + working-directory: src + run: | + export PATH=$PATH:$PWD/../depot_tools + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython + ./flutter/tools/gn --runtime-mode=debug \ + --embedder-for-target \ + --no-build-embedder-examples \ + --enable-impeller-3d \ + --no-goma --no-rbe \ + --no-stripped --no-enable-unittests \ + --linux-cpu arm64 \ + --target-os linux \ + --target-sysroot $PWD/build/linux/debian_sid_arm64-sysroot \ + --target-toolchain $PWD/flutter/buildtools/linux-x64/clang \ + --target-triple aarch64-unknown-linux-gnu + + ninja -C out/linux_debug_arm64 + + - name: Publish Debug + working-directory: src/out/linux_debug_arm64 + run: | + ls -laR exe.unstripped + ls -la *.so + + - name: Build Release + working-directory: src + run: | + export PATH=$PATH:$PWD/../depot_tools + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython + ./flutter/tools/gn --runtime-mode=release \ + --embedder-for-target \ + --no-build-embedder-examples \ + --enable-impeller-3d \ + --no-goma --no-rbe \ + --no-stripped --no-enable-unittests \ + --linux-cpu arm64 \ + --target-os linux \ + --target-sysroot $PWD/build/linux/debian_sid_arm64-sysroot \ + --target-toolchain $PWD/flutter/buildtools/linux-x64/clang \ + --target-triple aarch64-unknown-linux-gnu + ninja -C out/linux_release_arm64 + + - name: Publish Release + working-directory: src/out/linux_release_arm64 + run: | + ls -laR exe.unstripped + ls -la *.so + + - name: Build Profile + working-directory: src + run: | + export PATH=$PATH:$PWD/../depot_tools + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython + ./flutter/tools/gn --runtime-mode=profile \ + --embedder-for-target \ + --no-build-embedder-examples \ + --enable-impeller-3d \ + --no-goma --no-rbe \ + --no-stripped --no-enable-unittests \ + --linux-cpu arm64 \ + --target-os linux \ + --target-sysroot $PWD/build/linux/debian_sid_arm64-sysroot \ + --target-toolchain $PWD/flutter/buildtools/linux-x64/clang \ + --target-triple aarch64-unknown-linux-gnu + ninja -C out/linux_profile_arm64 + + - name: Publish Profile + working-directory: src/out/linux_profile_arm64 + run: | + ls -laR exe.unstripped + ls -la *.so diff --git a/.github/workflows/flutter-engine-armv7hf.yaml b/.github/workflows/flutter-engine-armv7hf.yaml new file mode 100644 index 0000000..79a1914 --- /dev/null +++ b/.github/workflows/flutter-engine-armv7hf.yaml @@ -0,0 +1,121 @@ +name: Linux armv7hf + +on: + pull_request: + types: [ opened, synchronize, reopened, closed ] + release: + types: [ published, created, edited ] + workflow_dispatch: + +jobs: + linux-armv7hf: + + env: + # TODO - hard coded for now + SRCREV: "c9b9d5780da342eb3f0f5e439a7db06f7d112575" + + runs-on: [self-hosted, linux, x64] + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Install packages + run: | + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git + + - name: Get Flutter Source + run: | + export PATH=$PATH:$PWD/depot_tools + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython + gclient config --spec 'solutions=[{"name":"src/flutter","url":"https://github.com/flutter/engine.git","deps_file":"DEPS","managed":False,"custom_deps":{},"custom_vars":{"download_android_deps":False,"download_windows_deps":False,"download_linux_deps":True}}]' + gclient sync --force --shallow --no-history -R -D --revision $SRCREV -j$(nproc) -v + + PATCH_DIR=$PWD/patches + + # fetch arm sysroot + cd src + build/linux/sysroot_scripts/install-sysroot.py --arch=arm + + git apply $PATCH_DIR/0001-clang-toolchain.patch + cd flutter + git apply $PATCH_DIR/0001-export-GPU-symbols.patch + + - name: Build Debug + working-directory: src + run: | + export PATH=$PATH:$PWD/../depot_tools + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython + ./flutter/tools/gn --runtime-mode=debug \ + --embedder-for-target \ + --no-build-embedder-examples \ + --enable-impeller-3d \ + --no-goma --no-rbe \ + --no-stripped --no-enable-unittests \ + --linux-cpu arm \ + --arm-float-abi hard \ + --target-os linux \ + --target-sysroot $PWD/build/linux/debian_sid_arm-sysroot \ + --target-toolchain $PWD/flutter/buildtools/linux-x64/clang \ + --target-triple armv7-unknown-linux-gnueabihf + + ninja -C out/linux_debug_arm + + - name: Publish Debug + working-directory: src/out/linux_debug_arm + run: | + ls -laR clang_x64/exe.unstripped + ls -la *.so + + - name: Build Release + working-directory: src + run: | + export PATH=$PATH:$PWD/../depot_tools + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython + ./flutter/tools/gn --runtime-mode=release \ + --embedder-for-target \ + --no-build-embedder-examples \ + --enable-impeller-3d \ + --no-goma --no-rbe \ + --no-stripped --no-enable-unittests \ + --linux-cpu arm \ + --arm-float-abi hard \ + --target-os linux \ + --target-sysroot $PWD/build/linux/debian_sid_arm-sysroot \ + --target-toolchain $PWD/flutter/buildtools/linux-x64/clang \ + --target-triple armv7-unknown-linux-gnueabihf + + ninja -C out/linux_release_arm + + - name: Publish Release + working-directory: src/out/linux_release_arm + run: | + ls -laR clang_x64/exe.unstripped + ls -la *.so + + - name: Build Profile + working-directory: src + run: | + export PATH=$PATH:$PWD/../depot_tools + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython + ./flutter/tools/gn --runtime-mode=profile \ + --embedder-for-target \ + --no-build-embedder-examples \ + --enable-impeller-3d \ + --no-goma --no-rbe \ + --no-stripped --no-enable-unittests \ + --linux-cpu arm \ + --arm-float-abi hard \ + --target-os linux \ + --target-sysroot $PWD/build/linux/debian_sid_arm-sysroot \ + --target-toolchain $PWD/flutter/buildtools/linux-x64/clang \ + --target-triple armv7-unknown-linux-gnueabihf + + ninja -C out/linux_profile_arm + + - name: Publish Profile + working-directory: src/out/linux_profile_arm + run: | + ls -laR clang_x64/exe.unstripped + ls -la *.so diff --git a/patches/0001-clang-toolchain.patch b/patches/0001-clang-toolchain.patch new file mode 100644 index 0000000..d3645dd --- /dev/null +++ b/patches/0001-clang-toolchain.patch @@ -0,0 +1,33 @@ +From eb564c8be13a16158056890069deef5bad533529 Mon Sep 17 00:00:00 2001 +From: Joel Winarske +Date: Mon, 26 Aug 2024 12:25:58 -0700 +Subject: [PATCH] clang toolchain + +Signed-off-by: Joel Winarske +--- + build/toolchain/custom/BUILD.gn | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/build/toolchain/custom/BUILD.gn b/build/toolchain/custom/BUILD.gn +index 3da5f93..05de4d7 100644 +--- a/build/toolchain/custom/BUILD.gn ++++ b/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.43.5 +