Skip to content

Cross-Compile TCC for Windows #26

Cross-Compile TCC for Windows

Cross-Compile TCC for Windows #26

name: Build and Release TCC (mob branch)
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build:
name: Compile TCC for multiple targets
runs-on: ubuntu-latest
strategy:
matrix:
target: [linux-x86_64, windows-x86_64, linux-arm]
steps:
- name: Download TCC source (mob branch)
run: |
wget -O tcc-mob.zip https://github.com/Tiny-C-Compiler/mirror-repository/archive/refs/heads/mob.zip
unzip tcc-mob.zip
mv mirror-repository-mob tcc
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential mingw-w64 gcc-arm-linux-gnueabi
- name: Build Native TCC (for tools)
run: |
cd tcc
./configure
make -j$(nproc)
mv c2str c2str_host
- name: Configure and Build Cross-Compiled TCC
run: |
cd tcc
case "${{ matrix.target }}" in
linux-x86_64)
./configure --prefix=/usr
make -j$(nproc)
mv tcc ../tcc-linux-x86_64
;;
windows-x86_64)
./configure --cc=x86_64-w64-mingw32-gcc --prefix=/usr
make -j$(nproc) HOST_C2STR=./c2str_host
mv tcc.exe ../tcc-windows-x86_64.exe
;;
linux-arm)
./configure --cc=arm-linux-gnueabi-gcc --prefix=/usr
make -j$(nproc)
mv tcc ../tcc-linux-arm
;;
esac
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tcc-${{ matrix.target }}
path: tcc-*
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create a release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*
token: ${{ secrets.GITHUB_TOKEN }}