|
1 | | -name: Build and Release TCC (mob branch) |
| 1 | +name: Cross Compile to Windows |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_dispatch: |
5 | 5 | push: |
6 | | - tags: |
7 | | - - "v*.*.*" |
8 | | - |
9 | | -permissions: |
10 | | - contents: write |
| 6 | + branches: |
| 7 | + - main |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
11 | 11 |
|
12 | 12 | jobs: |
13 | 13 | build: |
14 | | - name: Compile TCC for multiple targets |
15 | 14 | runs-on: ubuntu-latest |
16 | 15 |
|
17 | | - strategy: |
18 | | - matrix: |
19 | | - target: [linux-x86_64, windows-x86_64, linux-arm] |
20 | | - |
21 | 16 | steps: |
22 | | - - name: Download TCC source (mob branch) |
23 | | - run: | |
24 | | - wget -O tcc-mob.zip https://github.com/Tiny-C-Compiler/mirror-repository/archive/refs/heads/mob.zip |
25 | | - unzip tcc-mob.zip |
26 | | - mv mirror-repository-mob tcc |
| 17 | + - name: Checkout Repository |
| 18 | + uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + ref: mob |
27 | 21 |
|
28 | | - - name: Install dependencies |
29 | | - run: | |
30 | | - sudo apt-get update |
31 | | - sudo apt-get install -y build-essential mingw-w64 gcc-arm-linux-gnueabi |
| 22 | + - name: Set up MinGW cross-compilation toolchain |
| 23 | + run: | |
| 24 | + echo "Setting up cross-compilers for Windows..." |
| 25 | + sudo apt update |
| 26 | + sudo apt install -y mingw-w64 gcc-mingw-w64-x86-64 |
32 | 27 |
|
33 | | - - name: Build Native TCC (for tools) |
34 | | - run: | |
35 | | - cd tcc |
36 | | - ./configure |
37 | | - make -j$(nproc) |
38 | | - mv c2str c2str_host |
| 28 | + - name: Build the project for Windows |
| 29 | + run: | |
| 30 | + echo "Starting build process for Windows target..." |
| 31 | + mkdir -p build |
| 32 | + cd build |
39 | 33 |
|
40 | | - - name: Configure and Build Cross-Compiled TCC |
41 | | - run: | |
42 | | - cd tcc |
43 | | - case "${{ matrix.target }}" in |
44 | | - linux-x86_64) |
45 | | - ./configure --prefix=/usr |
46 | | - make -j$(nproc) |
47 | | - mv tcc ../tcc-linux-x86_64 |
48 | | - ;; |
49 | | - windows-x86_64) |
50 | | - ./configure --cc=x86_64-w64-mingw32-gcc --prefix=/usr |
51 | | - make -j$(nproc) HOST_C2STR=./c2str_host |
52 | | - mv tcc.exe ../tcc-windows-x86_64.exe |
53 | | - ;; |
54 | | - linux-arm) |
55 | | - ./configure --cc=arm-linux-gnueabi-gcc --prefix=/usr |
56 | | - make -j$(nproc) |
57 | | - mv tcc ../tcc-linux-arm |
58 | | - ;; |
59 | | - esac |
| 34 | + echo "Running make with MinGW cross-compiler..." |
| 35 | + CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ ../Makefile |
60 | 36 |
|
61 | | - - name: Upload artifacts |
62 | | - uses: actions/upload-artifact@v4 |
63 | | - with: |
64 | | - name: tcc-${{ matrix.target }} |
65 | | - path: tcc-* |
| 37 | + - name: Debugging: List files in build directory |
| 38 | + run: | |
| 39 | + echo "Listing files in the build directory..." |
| 40 | + ls -al build |
66 | 41 |
|
67 | | - release: |
68 | | - name: Create GitHub Release |
69 | | - runs-on: ubuntu-latest |
70 | | - needs: build |
| 42 | + - name: Debugging: Check environment variables |
| 43 | + run: | |
| 44 | + echo "Checking environment variables..." |
| 45 | + env |
71 | 46 |
|
72 | | - steps: |
73 | | - - name: Download artifacts |
74 | | - uses: actions/download-artifact@v4 |
75 | | - with: |
76 | | - path: artifacts |
| 47 | + - name: Debugging: Check MinGW installation |
| 48 | + run: | |
| 49 | + echo "Verifying MinGW installation..." |
| 50 | + mingw-w64-gcc --version |
| 51 | +
|
| 52 | + - name: Debugging: Verify Makefile existence |
| 53 | + run: | |
| 54 | + echo "Checking if Makefile exists..." |
| 55 | + ls -al ../ |
| 56 | +
|
| 57 | + - name: List installed packages |
| 58 | + run: | |
| 59 | + echo "Listing installed packages..." |
| 60 | + dpkg -l |
| 61 | +
|
| 62 | + - name: Upload Windows build artifact |
| 63 | + uses: actions/upload-artifact@v3 |
| 64 | + with: |
| 65 | + name: windows-build |
| 66 | + path: build/ |
77 | 67 |
|
78 | | - - name: Create a release |
79 | | - uses: softprops/action-gh-release@v2 |
80 | | - with: |
81 | | - files: artifacts/**/* |
82 | | - token: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + - name: Clean up |
| 69 | + run: | |
| 70 | + echo "Cleaning up after build process..." |
| 71 | + rm -rf build |
0 commit comments