Skip to content

Commit fff907c

Browse files
committed
release: update contrib/release/build.sh with recipes for winlibs
1 parent 6d58837 commit fff907c

File tree

1 file changed

+157
-61
lines changed

1 file changed

+157
-61
lines changed

contrib/release/build.sh

Lines changed: 157 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@
6565
# -gcc-7.1.0r2 (mingw-w64 project)
6666
# -gcc-7.3.0 (mingw-w64 project)
6767
# -gcc-8.1.0 (mingw-w64 project)
68-
# -winlibs-gcc-8.4.0 (winlibs)
69-
# -equation-gcc-8.3.0 (Equation)
68+
# -winlibs-gcc-8.4.0 (winlibs mingwrt 7.0.0r1)
69+
# -winlibs-gcc-9.3.0 (winlibs mingwrt 7.0.0r3 - sjlj)
70+
# -winlibs-gcc-9.3.0 (winlibs mingwrt 7.0.0r4)
71+
# -winlibs-gcc-10.2.0 (winlibs mingwrt 8.0.0r8)
72+
# -winlibs-gcc-10.3.0 (winlibs mingwrt 8.0.0r1)
73+
# -equation-gcc-8.3.0 (Equation - experimental)
7074
#
7175
# Requirements:
7276
# - MSYS environment on Windows with: bash, wget/curl, zip, unzip, patch, make, findutils
@@ -286,24 +290,128 @@ repack_equation_exe() {
286290
rm -rf ./repack
287291
}
288292

289-
get_mingww64_toolchain() {
293+
get_equation_toolchain() {
290294
bits="$1"
291295
arch="$2"
292-
toolchain=mingw-w64
296+
toolchain=equation
293297

294298
case "$recipe" in
295-
-winlibs-gcc-8.4.0)
296-
gccversion=8.4.0
297-
mingwbuildsrev=
298-
mingwruntime=7.0.0-r1
299-
toolchain=winlibs
300-
;;
301299
-equation-gcc-8.3.0)
302300
gccversion=8.3.0
303301
mingwbuildsrev=
304302
mingwruntime=
305-
toolchain=equation
306303
;;
304+
*)
305+
echo "invalid recipe $receipe"
306+
;;
307+
esac
308+
309+
dir=http://www.equation.com/ftpdir/gcc/
310+
311+
file=gcc-$gccversion-$bits
312+
binUrl=$dir$file.exe
313+
314+
srcfile=gcc-$gccversion.tar.xz
315+
srcUrl=$dir$srcfile
316+
317+
mkdir -p ../input/equation
318+
download "equation/$file.exe" $binUrl
319+
download "equation/$srcfile" $srcUrl
320+
if [ -f "../input/equation/$file.7z" ]; then
321+
echo "found $file.7z already repacked"
322+
else
323+
lastdir="$PWD"
324+
cd ../input/equation
325+
repack_equation_exe $file
326+
cd "$lastdir"
327+
fi
328+
7z x "../input/equation/$file.7z" > /dev/null
329+
mv ./$file ./mingw$bits
330+
}
331+
332+
get_winlibs_toolchain() {
333+
bits="$1"
334+
arch="$2"
335+
toolchain=winlibs
336+
337+
if [ "$bits" = "32" ]; then
338+
default_eh=dwarf
339+
else
340+
default_eh=seh
341+
fi
342+
343+
case "$recipe" in
344+
-winlibs-gcc-10.3.0)
345+
gccversion=10.3.0
346+
llvmversion=11.1.0
347+
mingwruntime=8.0.0
348+
mingwbuildsrev=r1
349+
winlibsdir=$gccversion-$llvmversion-$mingwruntime-$mingwbuildsrev
350+
file=winlibs-$arch-posix-$default_eh-gcc-$gccversion-mingw-w64-$mingwruntime-$mingwbuildsrev.7z
351+
;;
352+
-winlibs-gcc-10.2.0)
353+
gccversion=10.2.0
354+
llvmversion=10.0.1
355+
mingwruntime=7.0.0
356+
mingwbuildsrev=r4
357+
winlibsdir=$gccversion-$mingwruntime-$mingwbuildsrev
358+
file=winlibs-$arch-posix-$default_eh-gcc-$gccversion-mingw-w64-$mingwruntime-$mingwbuildsrev.7z
359+
;;
360+
# -winlibs-gcc-9.3.0)
361+
# gccversion=9.3.0
362+
# llvmversion=10.0.0
363+
# mingwruntime=7.0.0
364+
# mingwbuildsrev=r3
365+
# toolchain=winlibs
366+
# winlibsdir=$gccversion-$llvmversion-$mingwruntime-$mingwbuildsrev
367+
# file=winlibs-$arch-posix-$default_eh-gcc-$gccversion-llvm-$llvmversion-mingw-w64-$mingwruntime-$mingwbuildsrev.7z
368+
# ;;
369+
-winlibs-gcc-9.3.0)
370+
gccversion=9.3.0
371+
llvmversion=
372+
mingwruntime=7.0.0
373+
mingwbuildsrev=r3
374+
winlibsdir=$gccversion-$mingwruntime-sjlj-$mingwbuildsrev
375+
file=winlibs-mingw-w64-$arch-$gccversion-$mingwruntime-$mingwbuildsrev-sjlj.7z
376+
;;
377+
-winlibs-gcc-9.3.0)
378+
gccversion=9.3.0
379+
llvmversion=
380+
mingwruntime=7.0.0
381+
mingwbuildsrev=r3
382+
winlibsdir=$gccversion-$mingwruntime-sjlj-$mingwbuildsrev
383+
file=winlibs-mingw-w64-$arch-$gccversion-$mingwruntime-$mingwbuildsrev-sjlj.7z
384+
;;
385+
-winlibs-gcc-8.4.0)
386+
gccversion=8.4.0
387+
llvmversion=
388+
mingwbuildsrev=r1
389+
mingwruntime=7.0.0
390+
winlibsdir=$gccversion-$mingwruntime-$mingwbuildsrev
391+
file=mingw-w64-$arch-$gccversion-$mingwruntime.7z
392+
;;
393+
*)
394+
echo "invalid recipe $receipe"
395+
;;
396+
esac
397+
398+
dir=brechtsanders/winlibs_mingw/releases/download/$winlibsdir/
399+
binUrl=https://github.com/$dir$file
400+
srcfile=src-$winlibsdir.tar.gz
401+
srcUrl=https://github.com/brechtsanders/winlibs_mingw/archive/refs/tags/$winlibsdir.tar.gz
402+
403+
mkdir -p ../input/winlibs
404+
download "winlibs/$file" $binUrl
405+
download "winlibs/$srcfile" $srcUrl
406+
7z x "../input/winlibs/$file" > /dev/null
407+
}
408+
409+
get_mingww64_toolchain() {
410+
bits="$1"
411+
arch="$2"
412+
toolchain=mingw-w64
413+
414+
case "$recipe" in
307415
-gcc-8.1.0)
308416
gccversion=8.1.0
309417
mingwbuildsrev=rev0
@@ -340,58 +448,34 @@ get_mingww64_toolchain() {
340448
exit 1
341449
esac
342450

343-
case "$toolchain" in
344-
equation)
345-
dir=http://www.equation.com/ftpdir/gcc/
451+
# mingw-w64 project - personal builds
452+
dir=Toolchains%20targetting%20Win$bits/Personal%20Builds/mingw-builds/$gccversion/threads-win32/sjlj/
346453

347-
file=gcc-$gccversion-$bits
348-
binUrl=$dir$file.exe
454+
file=$arch-$gccversion-release-win32-sjlj-rt_$mingwruntime-$mingwbuildsrev.7z
455+
binUrl=http://sourceforge.net/projects/mingw-w64/files/$dir$file/download
349456

350-
srcfile=gcc-$gccversion.tar.xz
351-
srcUrl=$dir$srcfile
457+
srcfile=src-$gccversion-release-rt_$mingwruntime-$mingwbuildsrev.tar.7z
458+
srcUrl=http://sourceforge.net/projects/mingw-w64/files/Toolchain%20sources/Personal%20Builds/mingw-builds/$gccversion/$srcfile/download
352459

353-
mkdir -p ../input/equation
354-
download "equation/$file.exe" $binUrl
355-
download "equation/$srcfile" $srcUrl
356-
if [ -f "../input/equation/$file.7z" ]; then
357-
echo "found $file.7z already repacked"
358-
else
359-
lastdir="$PWD"
360-
cd ../input/equation
361-
repack_equation_exe $file
362-
cd "$lastdir"
363-
fi
364-
7z x "../input/equation/$file.7z" > /dev/null
365-
mv ./$file ./mingw$bits
366-
;;
367-
winlibs)
368-
dir=brechtsanders/winlibs_mingw/releases/download/$gccversion-$mingwruntime/
369-
370-
file=mingw-w64-$arch-$gccversion-$mingwruntime.7z
371-
binUrl=https://github.com/$dir$file
460+
mkdir -p ../input/MinGW-w64
461+
download "MinGW-w64/$file" $binUrl
462+
download "MinGW-w64/$srcfile" $srcUrl
463+
7z x "../input/MinGW-w64/$file" > /dev/null
464+
}
372465

373-
srcfile=src-$gccversion-$mingwruntime.tar.gz
374-
srcUrl=https://github.com/brechtsanders/winlibs_mingw/archive/refs/tags/$gccversion-$mingwruntime.tar.gz
466+
get_windows_toolchain() {
467+
bits="$1"
468+
arch="$2"
375469

376-
mkdir -p ../input/winlibs
377-
download "winlibs/$file" $binUrl
378-
download "winlibs/$srcfile" $srcUrl
379-
7z x "../input/winlibs/$file" > /dev/null
470+
case "$recipe" in
471+
-winlibs-*)
472+
get_winlibs_toolchain $bits $arch
473+
;;
474+
-equation-*)
475+
get_equation_toolchain $bits $arch
380476
;;
381477
*)
382-
# mingw-w64 project - personal builds
383-
dir=Toolchains%20targetting%20Win$bits/Personal%20Builds/mingw-builds/$gccversion/threads-win32/sjlj/
384-
385-
file=$arch-$gccversion-release-win32-sjlj-rt_$mingwruntime-$mingwbuildsrev.7z
386-
binUrl=http://sourceforge.net/projects/mingw-w64/files/$dir$file/download
387-
388-
srcfile=src-$gccversion-release-rt_$mingwruntime-$mingwbuildsrev.tar.7z
389-
srcUrl=http://sourceforge.net/projects/mingw-w64/files/Toolchain%20sources/Personal%20Builds/mingw-builds/$gccversion/$srcfile/download
390-
391-
mkdir -p ../input/MinGW-w64
392-
download "MinGW-w64/$file" $binUrl
393-
download "MinGW-w64/$srcfile" $srcUrl
394-
7z x "../input/MinGW-w64/$file" > /dev/null
478+
get_mingww64_toolchain $bits $arch
395479
;;
396480
esac
397481
}
@@ -453,7 +537,7 @@ dos)
453537
patch -p0 < ../djgpp-fix-pthread.patch
454538
;;
455539
win32)
456-
get_mingww64_toolchain 32 i686
540+
get_windows_toolchain 32 i686
457541
mv mingw32/* . && rmdir mingw32
458542

459543
mkdir -p ../input/MinGW.org
@@ -501,7 +585,7 @@ win32-mingworg)
501585
patch -p0 < ../mingworg-fix-wcharh.patch
502586
;;
503587
win64)
504-
get_mingww64_toolchain 64 x86_64
588+
get_windows_toolchain 64 x86_64
505589
mv mingw64/* . && rmdir mingw64
506590
;;
507591
esac
@@ -703,6 +787,8 @@ windowsbuild() {
703787
origPATH="$PATH"
704788
export PATH="$PWD/bin:$PATH"
705789

790+
echo "Current Path: $PATH"
791+
706792
libffibuild
707793
# copy our stored files to the build
708794
case "$toolchain" in
@@ -792,7 +878,7 @@ windowsbuild() {
792878
;;
793879
esac
794880
;;
795-
-winlibs-gcc-8.4.0)
881+
-winlibs-gcc-8.4.0|-winlibs-gcc-9.3.0|-winlibs-gcc-10.2.0|-winlibs-gcc-10.3.0)
796882
# -winlibs-gcc-X.X is being built from winlibs and the binutils have a few dependencies
797883
# copy these to the bin directory - they go with the executables and should
798884
# not be used as general libraries
@@ -803,18 +889,28 @@ windowsbuild() {
803889
cp bin/zlib1.dll fbc/bin/$fbtarget
804890
cp bin/gcc.exe fbc/bin/$target
805891

892+
# copy the exception handling DLL
893+
# libgcc_s_sjlj-1.dll - SJLJ win32 or win53
894+
# libgcc_s_dw2.dll - dwarf2 win32
895+
# libgcc_s_seh.dll - SEH win64
896+
cp bin/libgcc_s_*-1.dll fbc/bin/$fbtarget
897+
806898
case "$target" in
807899
win32)
808-
cp bin/libgcc_s_dw2-1.dll fbc/bin/$fbtarget
809900
# copy all the dll's from libexec; they are needed for cc1.exe
810901
cp --parents libexec/gcc/i686-w64-mingw32/$gccversion/cc1.exe fbc/bin
811902
cp --parents libexec/gcc/i686-w64-mingw32/$gccversion/*.dll fbc/bin
903+
#also copy as.exe and ld.exe to satify 'gcc --help -v'
904+
cp bin/as.exe fbc/bin/libexec/gcc/i686-w64-mingw32/$gccversion/as.exe
905+
cp bin/ld.exe fbc/bin/libexec/gcc/i686-w64-mingw32/$gccversion/ld.exe
812906
;;
813907
win64)
814-
cp bin/libgcc_s_seh-1.dll fbc/bin/$fbtarget
815908
# copy all the dll's from libexec; they are needed for cc1.exe
816909
cp --parents libexec/gcc/x86_64-w64-mingw32/$gccversion/cc1.exe fbc/bin
817910
cp --parents libexec/gcc/x86_64-w64-mingw32/$gccversion/*.dll fbc/bin
911+
#also copy as.exe and ld.exe to satify 'gcc --help -v'
912+
cp bin/as.exe fbc/bin/libexec/gcc/x86_64-w64-mingw32/$gccversion/as.exe
913+
cp bin/ld.exe fbc/bin/libexec/gcc/x86_64-w64-mingw32/$gccversion/ld.exe
818914
;;
819915
*)
820916
echo "invalid target $target"

0 commit comments

Comments
 (0)