|
| 1 | +# The pre-built yasm binaries are built with an older MSVCRT, |
| 2 | +# which is no longer installed on current Windows images. |
| 3 | + |
| 4 | +name: 'Setup yasm' |
| 5 | +description: 'Build yasm and add it to the PATH environment variable' |
| 6 | +runs: |
| 7 | + using: 'composite' |
| 8 | + steps: |
| 9 | + - name: 'Calculate variables' |
| 10 | + id: calc |
| 11 | + shell: sh |
| 12 | + run: | |
| 13 | + echo "cache-key=yasm-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT} |
| 14 | + - name: 'Restore yasm' |
| 15 | + id: restore-yasm |
| 16 | + uses: actions/cache/restore@v4 |
| 17 | + with: |
| 18 | + path: | |
| 19 | + ${{ github.workspace }}/yasm |
| 20 | + key: ${{ steps.calc.outputs.cache-key }} |
| 21 | + - name: 'Verify cached yasm' |
| 22 | + if: ${{ steps.restore-yasm.outputs.cache-hit }} |
| 23 | + shell: pwsh |
| 24 | + run: | |
| 25 | + ${{ github.workspace }}\yasm\bin\yasm --help |
| 26 | + - name: 'Download yasm sources' |
| 27 | + if: ${{ !steps.restore-yasm.outputs.cache-hit }} |
| 28 | + uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + repository: yasm/yasm |
| 31 | + path: yasm-src |
| 32 | + - name: 'Configure, build and install yasm' |
| 33 | + if: ${{ !steps.restore-yasm.outputs.cache-hit }} |
| 34 | + shell: pwsh |
| 35 | + run: | |
| 36 | + cmake -S yasm-src -B yasm-build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/yasm -DCMAKE_INSTALL_LIBDIR=bin -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded |
| 37 | + cmake --build yasm-build --parallel |
| 38 | + cmake --install yasm-build |
| 39 | + - name: 'Verify built yasm' |
| 40 | + if: ${{ !steps.restore-yasm.outputs.cache-hit }} |
| 41 | + shell: sh |
| 42 | + run: | |
| 43 | + set -e |
| 44 | + if [ ! -f "yasm/bin/yasm.exe" -a -f "yasm/bin/vsyasm.exe" ]; then |
| 45 | + cp "yasm/bin/vsyasm.exe" "yasm/bin/yasm.exe" |
| 46 | + fi |
| 47 | + yasm/bin/yasm --help |
| 48 | + - name: 'Cache yasm' |
| 49 | + if: ${{ !steps.restore-yasm.outputs.cache-hit }} |
| 50 | + uses: actions/cache/save@v4 |
| 51 | + with: |
| 52 | + path: | |
| 53 | + ${{ github.workspace }}/yasm |
| 54 | + key: ${{ steps.calc.outputs.cache-key }} |
| 55 | + enableCrossOsArchive: true |
| 56 | + - name: 'Set output variables' |
| 57 | + id: final |
| 58 | + shell: pwsh |
| 59 | + run: | |
| 60 | + echo "${{ github.workspace }}/yasm/bin" >> $env:GITHUB_PATH |
0 commit comments