Cross-Compile TCC for Windows #24
This file contains hidden or 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
| name: Cross-Compile TCC | |
| on: | |
| push: | |
| branches: | |
| - mob | |
| pull_request: | |
| branches: | |
| - mob | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout TCC source code | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Tiny-C-Compiler/mirror-repository | |
| ref: mob | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y mingw-w64 gcc-mingw-w64 make autoconf automake | |
| - name: Debug environment | |
| run: | | |
| echo "PATH: $PATH" | |
| echo "GCC Version: $(gcc --version)" | |
| echo "MinGW-w64 Version: $(x86_64-w64-mingw32-gcc --version)" | |
| - name: Compile for Linux | |
| run: | | |
| ./configure | |
| make -j$(nproc) | |
| strip tcc | |
| mv tcc tcc-linux | |
| - name: Compile for Windows (cross-compile) | |
| run: | | |
| ./configure --cross-prefix=x86_64-w64-mingw32- | |
| make -j$(nproc) | |
| x86_64-w64-mingw32-strip tcc.exe | |
| mv tcc.exe tcc-windows.exe | |
| - name: Create release artifacts | |
| run: | | |
| mkdir release | |
| mv tcc-linux release/tcc-linux | |
| mv tcc-windows.exe release/tcc-windows.exe | |
| tar -czvf tcc-latest-linux.tar.gz -C release tcc-linux | |
| zip -r tcc-latest-windows.zip release/tcc-windows.exe | |
| - name: Upload release to GitHub | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: latest | |
| files: | | |
| tcc-latest-linux.tar.gz | |
| tcc-latest-windows.zip | |
| repository: Tiny-C-Compiler/mirror-repository | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |