5959#
6060# --recipe name
6161# specify which build recipe to use. Not all recipes are supported on all targets.
62- # -gcc-5.2.0
63- # -gcc-7.1.0
64- # -gcc-7.1.0r0
65- # -gcc-7.1.0r2
66- # -gcc-7.3.0
67- # -gcc-8.1.0
62+ # -gcc-5.2.0 (mingw-w64 project)
63+ # -gcc-7.1.0 (mingw-w64 project)
64+ # -gcc-7.1.0r0 (mingw-w64 project)
65+ # -gcc-7.1.0r2 (mingw-w64 project)
66+ # -gcc-7.3.0 (mingw-w64 project)
67+ # -gcc-8.1.0 (mingw-w64 project)
68+ # -winlibs-gcc-8.4.0 (winlibs)
6869#
6970# Requirements:
7071# - MSYS environment on Windows with: bash, wget/curl, zip, unzip, patch, make, findutils
@@ -192,7 +193,7 @@ if [ ! -z "$repo_url" ]; then
192193fi
193194
194195# grab the FBSHA1 now, instead of forcing fbc/makefile to do it
195- # and we don't want to rely on host having git it the path
196+ # and we don't want to rely on host having git in the path
196197FBSHA1=" $( git rev-parse HEAD) "
197198
198199cd ../..
@@ -252,8 +253,15 @@ download_mingw() {
252253get_mingww64_toolchain () {
253254 bits=" $1 "
254255 arch=" $2 "
256+ toolchain=mingw-w64
255257
256258 case " $recipe " in
259+ -winlibs-gcc-8.4.0)
260+ gccversion=8.4.0
261+ mingwbuildsrev=
262+ mingwruntime=7.0.0-r1
263+ toolchain=winlibs
264+ ;;
257265 -gcc-8.1.0)
258266 gccversion=8.1.0
259267 mingwbuildsrev=rev0
@@ -279,22 +287,42 @@ get_mingww64_toolchain() {
279287 mingwbuildsrev=rev0
280288 mingwruntime=v4
281289 ;;
282- * )
290+ " " )
283291 gccversion=5.2.0
284292 mingwbuildsrev=rev0
285293 mingwruntime=v4
286294 ;;
295+ * )
296+ echo " unknown recipe $recipe "
297+ exit 1
287298 esac
288299
289- dir=Toolchains%20targetting%20Win$bits /Personal%20Builds/mingw-builds/$gccversion /threads-win32/sjlj/
290- file=$arch -$gccversion -release-win32-sjlj-rt_$mingwruntime -$mingwbuildsrev .7z
300+ case " $toolchain " in
301+ winlibs)
302+ dir=brechtsanders/winlibs_mingw/releases/download/$gccversion -$mingwruntime /
291303
292- mkdir -p ../input/MinGW-w64
293- download " MinGW-w64/$file " " http://sourceforge.net/projects/mingw-w64/files/$dir$file /download"
304+ file=mingw-w64-$arch -$gccversion -$mingwruntime .7z
305+ binUrl=https://github.com/$dir$file
306+
307+ srcfile=src-$gccversion -$mingwruntime .tar.gz
308+ srcUrl=https://github.com/brechtsanders/winlibs_mingw/archive/refs/tags/$gccversion -$mingwruntime .tar.gz
309+ ;;
310+
311+ * )
312+ # mingw-w64 project - personal builds
313+ dir=Toolchains%20targetting%20Win$bits /Personal%20Builds/mingw-builds/$gccversion /threads-win32/sjlj/
314+
315+ file=$arch -$gccversion -release-win32-sjlj-rt_$mingwruntime -$mingwbuildsrev .7z
316+ binUrl=http://sourceforge.net/projects/mingw-w64/files/$dir$file /download
294317
295- srcfile=src-$gccversion -release-rt_$mingwruntime -$mingwbuildsrev .tar.7z
296- download " MinGW-w64/$srcfile " " http://sourceforge.net/projects/mingw-w64/files/Toolchain%20sources/Personal%20Builds/mingw-builds/$gccversion /$srcfile /download"
318+ srcfile=src-$gccversion -release-rt_$mingwruntime -$mingwbuildsrev .tar.7z
319+ srcUrl=http://sourceforge.net/projects/mingw-w64/files/Toolchain%20sources/Personal%20Builds/mingw-builds/$gccversion /$srcfile /download
320+ ;;
321+ esac
297322
323+ mkdir -p ../input/MinGW-w64
324+ download " MinGW-w64/$file " $binUrl
325+ download " MinGW-w64/$srcfile " $srcUrl
298326 7z x " ../input/MinGW-w64/$file " > /dev/null
299327}
300328
@@ -650,32 +678,69 @@ windowsbuild() {
650678 cp bin/gprof.exe fbc/bin/$fbtarget
651679 cp bin/ld.exe fbc/bin/$fbtarget
652680
681+ echo $toolchain
682+
683+ case " $recipe " in
684+ -winlibs-gcc-8.4.0)
685+ # -winlibs-gcc-X.X is being built from winlibs and the binutils have a few dependencies
686+ # copy these to the bin directory - they go with the executables and should
687+ # not be used as general libraries
688+ cp bin/libdl.dll fbc/bin/$fbtarget
689+ cp bin/libiconv-2.dll fbc/bin/$fbtarget
690+ cp bin/libintl-8.dll fbc/bin/$fbtarget
691+ cp bin/libwinpthread-1.dll fbc/bin/$fbtarget
692+ cp bin/zlib1.dll fbc/bin/$fbtarget
693+ cp bin/gcc.exe fbc/bin/$target
694+
695+ case " $target " in
696+ win32)
697+ cp bin/libgcc_s_dw2-1.dll fbc/bin/$fbtarget
698+ # copy all the dll's from libexec; they are needed for cc1.exe
699+ cp --parents libexec/gcc/i686-w64-mingw32/$gccversion /cc1.exe fbc/bin
700+ cp --parents libexec/gcc/i686-w64-mingw32/$gccversion /* .dll fbc/bin
701+ ;;
702+ win64)
703+ cp bin/libgcc_s_seh-1.dll fbc/bin/$fbtarget
704+ # copy all the dll's from libexec; they are needed for cc1.exe
705+ cp --parents libexec/gcc/x86_64-w64-mingw32/$gccversion /cc1.exe fbc/bin
706+ cp --parents libexec/gcc/x86_64-w64-mingw32/$gccversion /* .dll fbc/bin
707+ ;;
708+ * )
709+ echo " invalid target $target "
710+ exit 1
711+ ;;
712+ esac
713+ ;;
714+ * )
715+ case " $target " in
716+ win32)
717+ # !!! TODO !!! re-evaluate the gdb used with later gcc versions
718+ # Take MinGW.org's gdb, because the gdb from the MinGW-w64 toolchain has much more
719+ # dependencies (e.g. Python for scripting purposes) which we probably don't want/need.
720+ # (this should probably be reconsidered someday)
721+ cp mingworg-gdb/bin/gdb.exe fbc/bin/win32
722+ cp mingworg-gdb/bin/libgcc_s_dw2-1.dll fbc/bin/win32
723+ cp mingworg-gdb/bin/zlib1.dll fbc/bin/win32
724+ ;;
725+ win32-mingworg)
726+ cp bin/gdb.exe fbc/bin/win32
727+ cp bin/libgcc_s_dw2-1.dll fbc/bin/win32
728+ cp bin/zlib1.dll fbc/bin/win32
729+ ;;
730+ win64)
731+ cp bin/gcc.exe fbc/bin/win64
732+ cp --parents libexec/gcc/x86_64-w64-mingw32/$gccversion /cc1.exe fbc/bin
733+ ;;
734+ esac
735+ ;;
736+ esac
737+
653738 cd fbc && make mingw-libs ENABLE_STANDALONE=1 && cd ..
654739
655740 if [ $fbtarget = " win32" ]; then
656741 cd fbc/lib/win32 && make && cd ../../..
657742 fi
658743
659- case " $target " in
660- win32)
661- # Take MinGW.org's gdb, because the gdb from the MinGW-w64 toolchain has much more
662- # dependencies (e.g. Python for scripting purposes) which we probably don't want/need.
663- # (this should probably be reconsidered someday)
664- cp mingworg-gdb/bin/gdb.exe fbc/bin/win32
665- cp mingworg-gdb/bin/libgcc_s_dw2-1.dll fbc/bin/win32
666- cp mingworg-gdb/bin/zlib1.dll fbc/bin/win32
667- ;;
668- win32-mingworg)
669- cp bin/gdb.exe fbc/bin/win32
670- cp bin/libgcc_s_dw2-1.dll fbc/bin/win32
671- cp bin/zlib1.dll fbc/bin/win32
672- ;;
673- win64)
674- cp bin/gcc.exe fbc/bin/win64
675- cp --parents libexec/gcc/x86_64-w64-mingw32/$gccversion /cc1.exe fbc/bin
676- ;;
677- esac
678-
679744 cp ../input/$libffi_title /$target$recipe /libffi.a fbc/lib/$fbtarget
680745
681746 # Reduce .exe sizes by dropping debug info
0 commit comments