action.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. name: 'Setup LoongArch64 toolchain'
  2. description: 'Download Linux LoongArch64 toolchain and set output variables'
  3. inputs:
  4. version:
  5. description: 'LoongArch64 version'
  6. default: '2023.08.08'
  7. outputs:
  8. prefix:
  9. description: "LoongArch toolchain prefix"
  10. value: ${{ steps.final.outputs.prefix }}
  11. cc:
  12. description: "LoongArch C compiler"
  13. value: ${{ steps.final.outputs.cc }}
  14. cxx:
  15. description: "LoongArch C++ compiler"
  16. value: ${{ steps.final.outputs.cxx }}
  17. runs:
  18. using: 'composite'
  19. steps:
  20. - uses: actions/cache/restore@v4
  21. id: restore-cache
  22. with:
  23. path: /opt/cross-tools
  24. key: loongarch64-${{ inputs.version }}
  25. - name: 'Download LoongArch64 gcc+glibc toolchain'
  26. if: ${{ !steps.restore-cache.outputs.cache-hit }}
  27. shell: bash
  28. run: |
  29. url="https://github.com/loongson/build-tools/releases/download/${{ inputs.version }}/CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz"
  30. wget "$url" -O /tmp/toolchain.tar.xz
  31. mkdir -p /opt
  32. tar -C /opt -x -f /tmp/toolchain.tar.xz
  33. - uses: actions/cache/save@v4
  34. if: ${{ !steps.restore-cache.outputs.cache-hit }}
  35. with:
  36. path: /opt/cross-tools
  37. key: loongarch64-${{ inputs.version }}
  38. - name: 'Set output vars'
  39. id: final
  40. shell: bash
  41. run: |
  42. prefix=/opt/cross-tools
  43. echo "prefix=${prefix}" >> $GITHUB_OUTPUT
  44. cc="${prefix}/bin/loongarch64-unknown-linux-gnu-gcc"
  45. cxx="${prefix}/bin/loongarch64-unknown-linux-gnu-g++"
  46. echo "cc=${cc}" >> $GITHUB_OUTPUT
  47. echo "cxx=${cxx}" >> $GITHUB_OUTPUT
  48. echo "LOONGARCH64_CC=${cc}" >>$GITHUB_ENV
  49. echo "LOONGARCH64_CXX=${cxx}" >>$GITHUB_ENV