Skip to content

Commit bd940ff

Browse files
authored
Update release-crosscompile.yml
1 parent 196387f commit bd940ff

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

.github/workflows/release-crosscompile.yml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
repository: Tiny-C-Compiler/mirror-repository
2929
ref: mob
3030
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
31+
fetch-depth: 0
3132

3233
- name: Install build dependencies
3334
run: |
@@ -40,6 +41,12 @@ jobs:
4041
mingw-w64-x86-64-dev \
4142
build-essential
4243
44+
- name: Build Linux host compiler
45+
run: |
46+
./configure
47+
make
48+
mv tcc tcc-host
49+
4350
- name: Build Linux binary
4451
run: |
4552
./configure
@@ -48,45 +55,41 @@ jobs:
4855
4956
- name: Build Windows binary
5057
run: |
51-
# Configure for Windows target with static linking
52-
./configure --cross-prefix=x86_64-w64-mingw32- \
58+
# Clean previous build
59+
make distclean || true
60+
61+
# Configure for Windows with static linking
62+
./configure \
63+
--cross-prefix=x86_64-w64-mingw32- \
64+
--enable-cross-prefix \
5365
--cpu=x86_64 \
5466
--extra-cflags="-static" \
55-
--extra-ldflags="-static" \
56-
--with-sysroot=/usr/x86_64-w64-mingw32
67+
--extra-ldflags="-static"
5768
58-
# Remove Linux-specific libraries from Makefile
59-
sed -i 's/-ldl//g' Makefile
60-
sed -i 's/-lpthread//g' Makefile
69+
# Use host compiler for libtcc1 generation
70+
sed -i 's/^\(HOST_CC\s*=\s*\).*/\1gcc/' Makefile
71+
sed -i 's/^\(HOST_LD\s*=\s*\).*/\1gcc/' Makefile
6172
62-
make
73+
# Build only the necessary targets
74+
make tcc.exe
6375
mv tcc.exe tcc-windows.exe
6476
65-
- name: Upload Linux artifact
66-
uses: actions/upload-artifact@v4
67-
with:
68-
name: tcc-linux
69-
path: tcc-linux
70-
71-
- name: Upload Windows artifact
77+
- name: Upload artifacts
7278
uses: actions/upload-artifact@v4
7379
with:
74-
name: tcc-windows.exe
75-
path: tcc-windows.exe
80+
name: binaries
81+
path: |
82+
tcc-linux
83+
tcc-windows.exe
7684
7785
create-release:
7886
needs: build-binaries
7987
runs-on: ubuntu-latest
8088
steps:
81-
- name: Download Linux binary
82-
uses: actions/download-artifact@v4
83-
with:
84-
name: tcc-linux
85-
86-
- name: Download Windows binary
89+
- name: Download artifacts
8790
uses: actions/download-artifact@v4
8891
with:
89-
name: tcc-windows.exe
92+
name: binaries
9093

9194
- name: Create GitHub Release
9295
uses: softprops/action-gh-release@v1
@@ -102,5 +105,4 @@ jobs:
102105
Automated cross-platform build containing:
103106
- Linux executable (ELF64)
104107
- Windows executable (PE32+)
105-
106108
Built from mob branch at $(date -u +"%Y-%m-%dT%H:%M:%SZ")

0 commit comments

Comments
 (0)