Skip to content

Commit eb9a2bd

Browse files
authored
Update release-crosscompile.yml
1 parent 8f7366f commit eb9a2bd

File tree

1 file changed

+60
-53
lines changed

1 file changed

+60
-53
lines changed
Lines changed: 60 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
name: Cross Compile to Windows
1+
name: Cross-Compile TCC for Windows
22

33
on:
4-
workflow_dispatch:
54
push:
65
branches:
76
- main
@@ -12,60 +11,68 @@ on:
1211
jobs:
1312
build:
1413
runs-on: ubuntu-latest
15-
1614
steps:
17-
- name: Checkout Repository
18-
uses: actions/checkout@v3
19-
with:
20-
ref: mob
21-
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
27-
28-
- name: Build the project for Windows
29-
run: |
30-
echo "Starting build process for Windows target..."
31-
mkdir -p build
32-
cd build
33-
34-
echo "Running make with MinGW cross-compiler..."
35-
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ ../Makefile
36-
37-
- name: Debugging: List files in build directory
38-
run: |
39-
echo "Listing files in the build directory..."
40-
ls -al build
41-
42-
- name: Debugging: Check environment variables
43-
run: |
44-
echo "Checking environment variables..."
45-
env
15+
# Step 1: Checkout the repository
16+
- name: Checkout Repository
17+
uses: actions/checkout@v2
4618

47-
- name: Debugging: Check MinGW installation
48-
run: |
49-
echo "Verifying MinGW installation..."
50-
mingw-w64-gcc --version
19+
# Step 2: Download the mob.zip
20+
- name: Download TCC Mirror Repository
21+
run: |
22+
echo "Downloading TCC Mirror Repository..."
23+
curl -L -o tcc_mob.zip https://github.com/Tiny-C-Compiler/mirror-repository/archive/refs/heads/mob.zip
24+
unzip -q tcc_mob.zip
25+
mv mirror-repository-mob tcc_source
26+
echo "Download and extraction complete."
5127
52-
- name: Debugging: Verify Makefile existence
53-
run: |
54-
echo "Checking if Makefile exists..."
55-
ls -al ../
28+
# Step 3: Install cross-compilation tools (MinGW for Windows)
29+
- name: Install MinGW and Dependencies
30+
run: |
31+
echo "Installing MinGW for cross-compilation..."
32+
sudo apt-get update
33+
sudo apt-get install -y mingw-w64 build-essential
34+
echo "MinGW and dependencies installed."
5635
57-
- name: List installed packages
58-
run: |
59-
echo "Listing installed packages..."
60-
dpkg -l
36+
# Step 4: Build TCC for Windows (Cross-compiling)
37+
- name: Build TCC for Windows
38+
run: |
39+
echo "Navigating to TCC source directory..."
40+
cd tcc_source
41+
echo "Starting the cross-compilation process for Windows..."
42+
43+
# Debug: Show the contents of the directory
44+
ls -l
45+
46+
# Set up the cross-compilation environment
47+
export CC=x86_64-w64-mingw32-gcc
48+
export CXX=x86_64-w64-mingw32-g++
49+
export AR=x86_64-w64-mingw32-ar
50+
export RANLIB=x86_64-w64-mingw32-ranlib
6151
62-
- name: Upload Windows build artifact
63-
uses: actions/upload-artifact@v3
64-
with:
65-
name: windows-build
66-
path: build/
52+
# Debug: Check environment variables
53+
echo "Using cross-compiler: $CC"
54+
echo "Starting to compile TCC..."
55+
56+
# Configure and make with debugging output
57+
./configure --host=x86_64-w64-mingw32 --prefix=$PWD/mingw-windows
58+
make clean
59+
make -j$(nproc)
60+
61+
# Debug: Show make result
62+
echo "Compilation finished. Checking for errors in the build..."
63+
make check
64+
echo "TCC for Windows cross-compilation completed."
6765
68-
- name: Clean up
69-
run: |
70-
echo "Cleaning up after build process..."
71-
rm -rf build
66+
# Step 5: Archive the Windows binaries
67+
- name: Archive Windows Binaries
68+
run: |
69+
echo "Archiving Windows binaries..."
70+
tar -czf tcc-windows.tar.gz -C tcc_source mingw-windows
71+
echo "Windows binaries archived."
72+
73+
# Step 6: Upload the Windows binaries
74+
- name: Upload Windows Binaries
75+
uses: actions/upload-artifact@v2
76+
with:
77+
name: tcc-windows
78+
path: tcc-windows.tar.gz

0 commit comments

Comments
 (0)