Skip to content

Commit 1175028

Browse files
committed
Add mingw64 native toolchains
add mingw gcc dependency [no ci] add mingw cc native build [no ci] add mingw msys2 native target fix previous mistakes enable workflow for new mingw toolchain
1 parent e3001dc commit 1175028

File tree

7 files changed

+209
-5
lines changed

7 files changed

+209
-5
lines changed

.github/workflows/build.yml

+55-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
TIME: ${{ needs.gen_tag.outputs.TIME }}
3030
strategy:
3131
matrix:
32-
target: [linux-native, mingw64-cross, mingw64-legacy-cross, arm64-cross, arm32-cross, mingw64-legacy-super-cross, musl-cross]
32+
target: [linux-native, mingw64-win, mingw64-cross, mingw64-legacy-cross, arm64-cross, arm32-cross, mingw64-legacy-super-cross, musl-cross]
3333

3434
steps:
3535
- name: checkout repo
@@ -65,7 +65,7 @@ jobs:
6565
name: result_${{ matrix.target }}
6666
path: |
6767
./*native.tb2
68-
./*cross.tb2
68+
./*cross*.tb2
6969
- name: upload debug output
7070
if: (!cancelled())
7171
uses: actions/upload-artifact@v4
@@ -79,9 +79,61 @@ jobs:
7979
uses: ncipollo/[email protected]
8080
with:
8181
allowUpdates: true
82-
artifacts: "*native.tb2,*cross.tb2,conflogs*.tgz,onelog.txt,stdout_*.log"
82+
artifacts: "*native.tb2,*cross*.tb2,conflogs*.tgz,onelog.txt,stdout_*.log"
8383
commit: main
8484
makeLatest: true
8585
tag: ${{ env.TAG }}
8686
name: ${{ env.TAG }}_${{ env.TIME }}
8787
bodyFile: notes.txt
88+
89+
build-msys:
90+
runs-on: windows-latest
91+
needs: gen_tag
92+
env:
93+
TAG: ${{ needs.gen_tag.outputs.TAG }}
94+
TIME: ${{ needs.gen_tag.outputs.TIME }}
95+
NO_TC_DOWN: 1
96+
defaults:
97+
run:
98+
shell: msys2 {0}
99+
steps:
100+
- name: setup msys2
101+
uses: msys2/setup-msys2@v2
102+
with:
103+
msystem: UCRT64
104+
install: mingw-w64-ucrt-x86_64-toolchain python git gmp-devel mpfr-devel mpc-devel isl-devel zlib-devel libzstd-devel bison flex diffutils make
105+
update: true
106+
location: C:\
107+
- run: git config --global core.autocrlf input
108+
- name: checkout
109+
uses: actions/checkout@v4
110+
- name: build
111+
run: exec ./exec.sh mingw64-msys2
112+
- name: upload result
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: result_mingw64-msys2
116+
path: |
117+
./*native.tb2
118+
./*cross*.tb2
119+
- name: collect config log
120+
if: (!cancelled())
121+
run: exec ./logtar.sh
122+
- name: upload debug output
123+
if: (!cancelled())
124+
uses: actions/upload-artifact@v4
125+
with:
126+
name: debug_mingw64-msys2
127+
path: |
128+
./conflogs*.tgz
129+
./curouts*.tgz
130+
./stdout_*.log
131+
- name: release
132+
uses: ncipollo/[email protected]
133+
with:
134+
allowUpdates: true
135+
artifacts: "*native.tb2,*cross*.tb2,conflogs*.tgz,onelog.txt,stdout_*.log"
136+
commit: main
137+
makeLatest: true
138+
tag: ${{ env.TAG }}
139+
name: ${{ env.TAG }}_${{ env.TIME }}

exec.sh

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/sh
22

3+
if [ "$1" != "mingw64-msys2" ]; then
34
if [ x$IN0 = x ]; then
45
export IN0=1
56
exec stdbuf -oL $0 "$@"
@@ -9,12 +10,15 @@ if [ x$IN1 = x ]; then
910
export IN1=1
1011
exec script -q -e -c "$0 "$@"" ./out.log
1112
fi
13+
fi
1214

1315
ulimit -S -s 32768
1416
ulimit -S -a
1517
ulimit -H -a
1618

19+
if [ -e /etc/environment ]; then
1720
. /etc/environment
21+
fi
1822

1923
CUR=$PWD
2024

@@ -48,6 +52,12 @@ exec $CUR/native.sh
4852
linux-native-profile)
4953
exec $CUR/native.sh profile
5054
;;
55+
mingw64-win)
56+
exec $CUR/mingw64-n.sh
57+
;;
58+
mingw64-msys2)
59+
exec $CUR/mingw64-ms2.sh
60+
;;
5161
mingw64-cross)
5262
exec $CUR/mingw64.sh
5363
;;

gcc-dep.tb2

5.87 MB
Binary file not shown.

logtar.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo ID is $RND
99
echo "logs > $FILES"
1010
echo "taring logs"
1111
tar -zhcf conflogs_$RND.tgz $FILES
12-
LA=$(find . -type f -name "*cross.tb2")
12+
LA=$(find . -type f -name "*cross*.tb2")
1313
LB=$(find . -type f -name "*native.tb2")
1414
if [ "x$LA" = "x" ] && [ "x$LB" = "x" ]; then
1515
echo "taring current output"

mingw64-ms2.sh

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/sh
2+
3+
CUR=$PWD
4+
5+
if [ "x$(which ccache)" != "x" ]; then
6+
export CC="ccache gcc" CXX="ccache g++"
7+
fi
8+
9+
export CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 @$CUR/gccflags @$CUR/gccparam"
10+
export CXXFLAGS="$CFLAGS"
11+
export LDFLAGS="@$CUR/ldflagsm"
12+
13+
curl -L "https://github.com/eebssk1/mingw-crt-build/releases/latest/download/mingw-crt.tgz" | tar -zxf - || exit 255
14+
15+
16+
echo current utc time 1 is $(date -u)
17+
TMS=$(date +%s)
18+
19+
cd m_binutils; mkdir build; cd build
20+
21+
../configure --prefix=${MINGW_PREFIX} --target=x86_64-w64-mingw32 --enable-64-bit-bfd --enable-checking=release --disable-multilib --disable-nls --disable-rpath --with-libiconv-prefix=${MINGW_PREFIX} --with-sysroot=${MINGW_PREFIX} --enable-install-libiberty --enable-plugins --enable-deterministic-archives --disable-werror --enable-lto --with-system-zlib --with-zstd --disable-gdb --disable-gprof --disable-gprofng || exit 255
22+
make -j$(($N+3)) all MAKEINFO=true || exit 255
23+
24+
make -j install-strip prefix=$CUR/out MAKEINFO=true
25+
TMM=$(date +%s)
26+
27+
echo current utc time 2 is $(date -u)
28+
29+
cd $CUR
30+
31+
#not required under msys2?
32+
#tar --bzip -xf gcc-dep.tb2
33+
#cp -a gcc-dep/lib/*.a out/x86_64-w64-mingw32/lib/
34+
#cp -a gcc-dep/lib/*.dll out/bin/
35+
36+
cp -a mingw-crt/ucrt64-legacy/. out/x86_64-w64-mingw32/
37+
38+
cd m_gcc; mkdir build; cd build
39+
40+
export lt_cv_deplibs_check_method='pass_all'
41+
export CPPFLAGS_FOR_TARGET="-DWIN32_LEAN_AND_MEAN -DCOM_NO_WINDOWS_H @$CUR/gccflagsm @$CUR/gccparam"
42+
export LDFLAGS_FOR_TARGET="@$CUR/ldflagsm"
43+
export CFLAGS_FOR_TARGET="-O3 -g1"
44+
export CXXFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET"
45+
46+
echo current utc time 3 is $(date -u)
47+
48+
../configure --prefix=$CUR/out --target=x86_64-w64-mingw32 --enable-bootstrap --with-build-config=bootstrap-O3 --enable-version-specific-runtime-libs --enable-checking=release --with-local-prefix=$CUR/out/x86_64-w64-mingw32/local --with-native-system-header-dir=/ucrt64/include --with-arch=haswell --with-tune=icelake-client --with-gcc-major-version-only --with-default-libstdcxx-abi=new --disable-cet --disable-vtable-verify --enable-plugin --with-system-zlib --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --enable-libssp --enable-default-ssp --disable-libvtv --enable-shared=libgcc,libgcov --disable-multiarch --disable-multilib --disable-rpath --disable-nls --disable-werror --disable-symvers --disable-libstdcxx-debug --enable-languages=c,c++,lto --disable-sjlj-exceptions --with-specs-file="$CUR/mingw64.specs" || exit 255
49+
make -j$(($N+3)) bootstrap STAGE1_CFLAGS="-g1 -Os" MAKEINFO=true || exit 255
50+
make -j$(($N+3)) all MAKEINFO=true || exit 255
51+
52+
make -j install-strip MAKEINFO=true
53+
54+
echo current utc time 4 is $(date -u)
55+
TME=$(date +%s)
56+
TMT0=$((($TMM-$TMS)/60))
57+
TMT1=$((($TME-$TMM)/60))
58+
TMA=$(($TMT0+$TMT1))
59+
echo "part 1 took $TMT0 min, part 2 took $TMT1 min, which sum to $TMA min together!"
60+
61+
cd $CUR
62+
63+
mv out x86_64-w64-mingw32-msys2
64+
tar -I 'bzip2 -9' -cf x86_64-w64-mingw32-cross_msys2.tb2 x86_64-w64-mingw32-msys2
65+
66+
exit 0
67+

mingw64-n.sh

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/sh
2+
3+
CUR=$PWD
4+
5+
if [ -e /opt/newcc/bin ]; then
6+
export PATH=/opt/newcc/bin:$PATH
7+
export LD_LIBRARY_PATH=/opt/newcc/lib
8+
fi
9+
10+
wget https://github.com/eebssk1/aio_tc_build/releases/latest/download/x86_64-w64-mingw32-cross.tb2 || exit 255
11+
tar --bzip -xf x86_64-w64-mingw32-cross.tb2
12+
mv x86_64-w64-mingw32 x86_64-w64-mingw32-boot
13+
rm x86_64-w64-mingw32-cross.tb2
14+
15+
export PATH=$CUR/x86_64-w64-mingw32-boot/bin:$PATH
16+
17+
tar --bzip -xf gcc-dep.tb2
18+
rm gcc-dep.tb2
19+
20+
export CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 @$CUR/gccflags @$CUR/gccparam"
21+
export CXXFLAGS="$CFLAGS"
22+
export LDFLAGS="-L$CUR/gcc-dep/lib @$CUR/ldflagsm"
23+
export CPPFLAGS="-I$CUR/gcc-dep/include"
24+
25+
curl -L "https://github.com/eebssk1/mingw-crt-build/releases/latest/download/mingw-crt.tgz" | tar -zxf - || exit 255
26+
27+
echo current utc time 1 is $(date -u)
28+
TMS=$(date +%s)
29+
30+
mkdir -p out/x86_64-w64-mingw32
31+
cp -a mingw-crt/ucrt64-legacy/. out/x86_64-w64-mingw32/
32+
mkdir out/x86_64-w64-mingw32/lib/32
33+
cp -a mingw-crt/msvcrt32/lib/. out/x86_64-w64-mingw32/lib/32
34+
cp -a $CUR/gcc-dep/lib/*.a out/x86_64-w64-mingw32/lib
35+
cp -a $CUR/gcc-dep/lib/*.dll out/bin
36+
37+
cd m_binutils; mkdir build; cd build
38+
39+
../configure --prefix=$CUR/out --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --program-prefix=x86_64-w64-mingw32- --with-sysroot=$CUR/out/x86_64-w64-mingw32 --enable-multilib --enable-64-bit-bfd --enable-checking=release --disable-nls --disable-rpath --enable-install-libiberty --enable-plugins --enable-deterministic-archives --with-system-zlib --with-zstd --disable-werror --enable-lto --disable-gdb --disable-gprof --disable-gprofng || exit 255
40+
make -j$(($N+2)) all MAKEINFO=true || exit 255
41+
42+
make -j install-strip MAKEINFO=true
43+
TMM=$(date +%s)
44+
45+
echo current utc time 2 is $(date -u)
46+
47+
cd $CUR
48+
49+
cd m_gcc; mkdir build; cd build
50+
51+
export lt_cv_deplibs_check_method='pass_all'
52+
export CPPFLAGS_FOR_TARGET="-DWIN32_LEAN_AND_MEAN -DCOM_NO_WINDOWS_H @$CUR/gccflagsm @$CUR/gccparam"
53+
export LDFLAGS_FOR_TARGET="@$CUR/ldflagsm"
54+
export CFLAGS_FOR_TARGET="-O3 -g1"
55+
export CXXFLAGS_FOR_TARGET="$CFLAGS_FOR_TARGET"
56+
57+
echo current utc time 3 is $(date -u)
58+
59+
../configure --prefix=$CUR/out --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --program-prefix=x86_64-w64-mingw32- --enable-version-specific-runtime-libs --enable-checking=release --with-local-prefix=$CUR/out/x86_64-w64-mingw32/local --with-arch=haswell --with-tune=icelake-client --with-gcc-major-version-only --with-default-libstdcxx-abi=new --disable-cet --disable-vtable-verify --enable-plugin --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --enable-libssp --enable-default-ssp --disable-libvtv --enable-shared=libgcc,libgcov --enable-multiarch --enable-multilib --with-arch-32=prescott --with-multilib-list=m32,m64 --with-abi=m64 --disable-rpath --disable-nls --disable-werror --disable-symvers --disable-libstdcxx-debug --enable-languages=c,c++,lto --disable-sjlj-exceptions --with-specs-file="$CUR/mingw64.specs" || exit 255
60+
make -j$(($N+2)) all MAKEINFO=true || exit 255
61+
62+
make -j install-strip MAKEINFO=true
63+
64+
echo current utc time 4 is $(date -u)
65+
TME=$(date +%s)
66+
TMT0=$((($TMM-$TMS)/60))
67+
TMT1=$((($TME-$TMM)/60))
68+
TMA=$(($TMT0+$TMT1))
69+
echo "part 1 took $TMT0 min, part 2 took $TMT1 min, which sum to $TMA min together!"
70+
71+
cd $CUR
72+
73+
mv out x86_64-w64-mingw32-indep
74+
tar -hI 'bzip2 -9' -cf x86_64-w64-mingw32-cross_indep.tb2 x86_64-w64-mingw32-indep
75+
exit 0

pre.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fi
4343

4444
rm -rf m_*/build
4545
rm -rf out
46-
rm -rf *.tgz *.tb2
46+
rm -rf *.tgz *cross*.tb2 *native*.tb2
4747
rm -rf time-*
4848
rm -rf tmp
4949
rm -rf x86_64-* i686-* aarch-* arm*-*

0 commit comments

Comments
 (0)