|
| 1 | +name: Linux riscv64 |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [ opened, synchronize, reopened, closed ] |
| 6 | + release: |
| 7 | + types: [ published, created, edited ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + linux-riscv64: |
| 12 | + |
| 13 | + env: |
| 14 | + # TODO - hard coded for now |
| 15 | + SRCREV: "c9b9d5780da342eb3f0f5e439a7db06f7d112575" |
| 16 | + |
| 17 | + runs-on: [self-hosted, linux, x64] |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + persist-credentials: false |
| 23 | + |
| 24 | + - name: Install packages |
| 25 | + run: | |
| 26 | + git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 27 | +
|
| 28 | + - name: Get Flutter Source |
| 29 | + run: | |
| 30 | + rm -rf out/linux_debug_riscv64|true |
| 31 | + rm -rf out/linux_release_riscv64|true |
| 32 | + rm -rf out/linux_profile_riscv64|true |
| 33 | +
|
| 34 | + export PATH=$PATH:$PWD/depot_tools |
| 35 | + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython |
| 36 | + 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}}]' |
| 37 | + gclient sync --force --shallow --no-history -R -D --revision $SRCREV -j$(nproc) -v |
| 38 | +
|
| 39 | + PATCH_DIR=$PWD/patches |
| 40 | +
|
| 41 | + # fetch arm64 sysroot |
| 42 | + cd src |
| 43 | +
|
| 44 | + # setting system_libdir in args.gn does not work |
| 45 | + git apply $PATCH_DIR/riscv64/0001-system-libdir.patch |
| 46 | +
|
| 47 | + git apply $PATCH_DIR/0001-clang-toolchain.patch |
| 48 | + cd flutter |
| 49 | + git apply $PATCH_DIR/0001-export-GPU-symbols.patch |
| 50 | +
|
| 51 | + git apply $PATCH_DIR/riscv64/0001-gn-riscv32-and-riscv64.patch |
| 52 | + git apply $PATCH_DIR/riscv64/0002-fml-build-config-add-riscv.patch |
| 53 | + git apply $PATCH_DIR/riscv64/0003-swiftshader-riscv-support.patch |
| 54 | + git apply $PATCH_DIR/riscv64/0004-tonic-riscv-support.patch |
| 55 | +
|
| 56 | + - name: Fetch sysroot & toolchain |
| 57 | + working-directory: src/build/linux |
| 58 | + run: | |
| 59 | + rm -rf debian_sid_riscv64-sysroot |true |
| 60 | + curl -L "https://drive.usercontent.google.com/download?id=1YM1OR7d_Z7KibqcUHVWuufqhsQlmH3qg&confirm=xxx" -o debian_sid_riscv64-sysroot.tar.gz |
| 61 | + mkdir -p debian_sid_riscv64-sysroot |
| 62 | + tar -xvzf debian_sid_riscv64-sysroot.tar.gz -C debian_sid_riscv64-sysroot |
| 63 | + rm debian_sid_riscv64-sysroot.tar.gz |
| 64 | +
|
| 65 | + cd ../../flutter/buildtools/linux-x64 |
| 66 | +
|
| 67 | + rm -rf recipe-sysroot-native |true |
| 68 | + curl -L "https://drive.usercontent.google.com/download?id=1gdV-1dJ4HD-EMWdFGAXKJwi8sFWnM1Qq&confirm=xxx" -o recipe-sysroot-native.tar.gz |
| 69 | + tar -xvzf recipe-sysroot-native.tar.gz -C . |
| 70 | + rm recipe-sysroot-native.tar.gz |
| 71 | +
|
| 72 | + - name: Build Debug |
| 73 | + working-directory: src |
| 74 | + run: | |
| 75 | + export PATH=$PATH:$PWD/../depot_tools |
| 76 | + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython |
| 77 | + ./flutter/tools/gn --runtime-mode=debug \ |
| 78 | + --embedder-for-target \ |
| 79 | + --no-build-embedder-examples \ |
| 80 | + --enable-impeller-3d \ |
| 81 | + --no-goma --no-rbe \ |
| 82 | + --no-stripped --no-enable-unittests \ |
| 83 | + --no-prebuilt-dart-sdk \ |
| 84 | + --linux-cpu riscv64 \ |
| 85 | + --target-os linux \ |
| 86 | + --target-sysroot $PWD/build/linux/debian_sid_riscv64-sysroot \ |
| 87 | + --target-toolchain $PWD/flutter/buildtools/linux-x64/recipe-sysroot-native/usr \ |
| 88 | + --target-triple riscv64-unknown-linux-gnu |
| 89 | +
|
| 90 | + ninja -C out/linux_debug_riscv64 |
| 91 | +
|
| 92 | + - name: Publish Debug |
| 93 | + working-directory: src/out/linux_debug_riscv64 |
| 94 | + run: | |
| 95 | + ls -laR exe.unstripped |
| 96 | + ls -la *.so |
| 97 | +
|
| 98 | + - name: Build Release |
| 99 | + working-directory: src |
| 100 | + run: | |
| 101 | + export PATH=$PATH:$PWD/../depot_tools |
| 102 | + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython |
| 103 | + ./flutter/tools/gn --runtime-mode=release \ |
| 104 | + --embedder-for-target \ |
| 105 | + --no-build-embedder-examples \ |
| 106 | + --enable-impeller-3d \ |
| 107 | + --no-goma --no-rbe \ |
| 108 | + --no-stripped --no-enable-unittests \ |
| 109 | + --no-prebuilt-dart-sdk \ |
| 110 | + --linux-cpu riscv64 \ |
| 111 | + --target-os linux \ |
| 112 | + --target-sysroot $PWD/build/linux/debian_sid_riscv64-sysroot \ |
| 113 | + --target-toolchain $PWD/flutter/buildtools/linux-x64/recipe-sysroot-native/usr \ |
| 114 | + --target-triple riscv64-unknown-linux-gnu |
| 115 | +
|
| 116 | + ninja -C out/linux_release_riscv64 |
| 117 | +
|
| 118 | + - name: Publish Release |
| 119 | + working-directory: src/out/linux_release_riscv64 |
| 120 | + run: | |
| 121 | + ls -laR exe.unstripped |
| 122 | + ls -la *.so |
| 123 | +
|
| 124 | + - name: Build Profile |
| 125 | + working-directory: src |
| 126 | + run: | |
| 127 | + export PATH=$PATH:$PWD/../depot_tools |
| 128 | + export VPYTHON_VIRTUALENV_ROOT=$PWD/vpython |
| 129 | + ./flutter/tools/gn --runtime-mode=profile \ |
| 130 | + --embedder-for-target \ |
| 131 | + --no-build-embedder-examples \ |
| 132 | + --enable-impeller-3d \ |
| 133 | + --no-goma --no-rbe \ |
| 134 | + --no-stripped --no-enable-unittests \ |
| 135 | + --no-prebuilt-dart-sdk \ |
| 136 | + --linux-cpu riscv64 \ |
| 137 | + --target-os linux \ |
| 138 | + --target-sysroot $PWD/build/linux/debian_sid_riscv64-sysroot \ |
| 139 | + --target-toolchain $PWD/flutter/buildtools/linux-x64/recipe-sysroot-native/usr \ |
| 140 | + --target-triple riscv64-unknown-linux-gnu |
| 141 | +
|
| 142 | + ninja -C out/linux_profile_riscv64 |
| 143 | +
|
| 144 | + - name: Publish Profile |
| 145 | + working-directory: src/out/linux_profile_riscv64 |
| 146 | + run: | |
| 147 | + ls -laR exe.unstripped |
| 148 | + ls -la *.so |
0 commit comments