6666# -gcc-7.3.0 (mingw-w64 project)
6767# -gcc-8.1.0 (mingw-w64 project)
6868# -winlibs-gcc-8.4.0 (winlibs)
69+ # -equation-gcc-8.3.0 (Equation)
6970#
7071# Requirements:
7172# - MSYS environment on Windows with: bash, wget/curl, zip, unzip, patch, make, findutils
@@ -250,6 +251,41 @@ download_mingw() {
250251 download " MinGW.org/$1 " " http://downloads.sourceforge.net/mingw/${1} ?download"
251252}
252253
254+ repack_equation_exe () {
255+ packname=" $1 "
256+ instname=" $packname -installer"
257+
258+ echo " Removing previous repack directories"
259+ rm -rf repack
260+ mkdir repack
261+
262+ cd repack
263+ mkdir $packname
264+ mkdir $instname
265+
266+ echo " Extracting installer files from $packname .exe"
267+ cd $instname
268+ 7z x -y ../../$packname .exe > /dev/null
269+
270+ echo " Copying directory structure"
271+ cd source
272+ find . -type d | xargs -L 1 -I % mkdir -p ../../$packname /%
273+
274+ echo " Decompressing individual files"
275+ # careful here with the quoting; this uses stdout redirection
276+ find . -type f -exec sh -c " bzip2 -d -c '{}' > '../../$packname /{}'" \;
277+
278+ cd ../..
279+
280+ echo " Creating normal 7z archive $packname .7z in cache"
281+ 7z a ../$packname .7z $packname > /dev/null
282+
283+ cd ..
284+
285+ # clean-up
286+ rm -rf ./repack
287+ }
288+
253289get_mingww64_toolchain () {
254290 bits=" $1 "
255291 arch=" $2 "
@@ -262,6 +298,12 @@ get_mingww64_toolchain() {
262298 mingwruntime=7.0.0-r1
263299 toolchain=winlibs
264300 ;;
301+ -equation-gcc-8.3.0)
302+ gccversion=8.3.0
303+ mingwbuildsrev=
304+ mingwruntime=
305+ toolchain=equation
306+ ;;
265307 -gcc-8.1.0)
266308 gccversion=8.1.0
267309 mingwbuildsrev=rev0
@@ -298,6 +340,29 @@ get_mingww64_toolchain() {
298340 esac
299341
300342 case " $toolchain " in
343+ equation)
344+ dir=http://www.equation.com/ftpdir/gcc/
345+
346+ file=gcc-$gccversion -$bits
347+ binUrl=$dir$file .exe
348+
349+ srcfile=gcc-$gccversion .tar.xz
350+ srcUrl=$dir$srcfile
351+
352+ mkdir -p ../input/equation
353+ download " equation/$file .exe" $binUrl
354+ download " equation/$srcfile " $srcUrl
355+ if [ -f " ../input/equation/$file .7z" ]; then
356+ echo " found $file .7z already repacked"
357+ else
358+ lastdir=" $PWD "
359+ cd ../input/equation
360+ repack_equation_exe $file
361+ cd " $lastdir "
362+ fi
363+ 7z x " ../input/equation/$file .7z" > /dev/null
364+ mv ./$file ./mingw$bits
365+ ;;
301366 winlibs)
302367 dir=brechtsanders/winlibs_mingw/releases/download/$gccversion -$mingwruntime /
303368
@@ -306,8 +371,12 @@ get_mingww64_toolchain() {
306371
307372 srcfile=src-$gccversion -$mingwruntime .tar.gz
308373 srcUrl=https://github.com/brechtsanders/winlibs_mingw/archive/refs/tags/$gccversion -$mingwruntime .tar.gz
309- ;;
310374
375+ mkdir -p ../input/winlibs
376+ download " winlibs/$file " $binUrl
377+ download " winlibs/$srcfile " $srcUrl
378+ 7z x " ../input/winlibs/$file " > /dev/null
379+ ;;
311380 * )
312381 # mingw-w64 project - personal builds
313382 dir=Toolchains%20targetting%20Win$bits /Personal%20Builds/mingw-builds/$gccversion /threads-win32/sjlj/
@@ -317,13 +386,13 @@ get_mingww64_toolchain() {
317386
318387 srcfile=src-$gccversion -release-rt_$mingwruntime -$mingwbuildsrev .tar.7z
319388 srcUrl=http://sourceforge.net/projects/mingw-w64/files/Toolchain%20sources/Personal%20Builds/mingw-builds/$gccversion /$srcfile /download
389+
390+ mkdir -p ../input/MinGW-w64
391+ download " MinGW-w64/$file " $binUrl
392+ download " MinGW-w64/$srcfile " $srcUrl
393+ 7z x " ../input/MinGW-w64/$file " > /dev/null
320394 ;;
321395 esac
322-
323- mkdir -p ../input/MinGW-w64
324- download " MinGW-w64/$file " $binUrl
325- download " MinGW-w64/$srcfile " $srcUrl
326- 7z x " ../input/MinGW-w64/$file " > /dev/null
327396}
328397
329398case " $target " in
@@ -484,7 +553,12 @@ case $fbtarget in
484553win32|win64)
485554 # libffi sources
486555 # TODO : new libffi package? at https://github.com/libffi/libffi/releases/download/v3.3-rc0/libffi-3.3-rc0.tar.gz
487- libffi_title=libffi-3.2.1
556+ # always use libffi-3.3 for equation
557+ if [ " $recipe " = " -equation-gcc-8.3.0" ]; then
558+ libffi_title=libffi-3.3
559+ else
560+ libffi_title=libffi-3.2.1
561+ fi
488562 libffi_package=" ${libffi_title} .tar.gz"
489563 download " $libffi_package " " ftp://sourceware.org/pub/libffi/$libffi_package "
490564 echo " extracting $libffi_package "
@@ -634,10 +708,20 @@ windowsbuild() {
634708
635709 libffibuild
636710 # copy our stored files to the build
637- case " $target " in
638- win32) cp ../input/$libffi_title /$target$recipe /ffi.h ../input/$libffi_title /$target$recipe /ffitarget.h ./i686-w64-mingw32/include;;
639- win32-mingworg) cp ../input/$libffi_title /$target$recipe /ffi.h ../input/$libffi_title /$target$recipe /ffitarget.h ./include;;
640- win64) cp ../input/$libffi_title /$target$recipe /ffi.h ../input/$libffi_title /$target$recipe /ffitarget.h ./x86_64-w64-mingw32/include;;
711+ case " $toolchain " in
712+ equation)
713+ case " $target " in
714+ win32) cp ../input/$libffi_title /$target$recipe /ffi.h ../input/$libffi_title /$target$recipe /ffitarget.h ./i686-pc-mingw32/include;;
715+ win64) cp ../input/$libffi_title /$target$recipe /ffi.h ../input/$libffi_title /$target$recipe /ffitarget.h ./x86_64-w64-mingw32/include;;
716+ esac
717+ ;;
718+ * )
719+ case " $target " in
720+ win32) cp ../input/$libffi_title /$target$recipe /ffi.h ../input/$libffi_title /$target$recipe /ffitarget.h ./i686-w64-mingw32/include;;
721+ win32-mingworg) cp ../input/$libffi_title /$target$recipe /ffi.h ../input/$libffi_title /$target$recipe /ffitarget.h ./include;;
722+ win64) cp ../input/$libffi_title /$target$recipe /ffi.h ../input/$libffi_title /$target$recipe /ffitarget.h ./x86_64-w64-mingw32/include;;
723+ esac
724+ ;;
641725 esac
642726
643727 cd fbc
@@ -678,9 +762,27 @@ windowsbuild() {
678762 cp bin/gprof.exe fbc/bin/$fbtarget
679763 cp bin/ld.exe fbc/bin/$fbtarget
680764
681- echo $toolchain
682-
683765 case " $recipe " in
766+ -equation-gcc-8.3.0)
767+ cp bin/gcc.exe fbc/bin/$target
768+ cp bin/gdb.exe fbc/bin/$target
769+
770+ case " $target " in
771+ win32)
772+ # copy all the dll's from libexec; they are needed for cc1.exe
773+ cp --parents libexec/gcc/i686-pc-mingw32/$gccversion /cc1.exe fbc/bin
774+ ;;
775+ win64)
776+ # copy all the dll's from libexec; they are needed for cc1.exe
777+ cp --parents libexec/gcc/x86_64-w64-mingw32/$gccversion /cc1.exe fbc/bin
778+ ;;
779+ * )
780+ echo " invalid target $target "
781+ exit 1
782+ ;;
783+ esac
784+
785+ ;;
684786 -winlibs-gcc-8.4.0)
685787 # -winlibs-gcc-X.X is being built from winlibs and the binutils have a few dependencies
686788 # copy these to the bin directory - they go with the executables and should
@@ -715,6 +817,7 @@ windowsbuild() {
715817 case " $target " in
716818 win32)
717819 # !!! TODO !!! re-evaluate the gdb used with later gcc versions
820+ # !!! TODO !!! maybe package the 32-bit gcc too even for mingw-w64
718821 # Take MinGW.org's gdb, because the gdb from the MinGW-w64 toolchain has much more
719822 # dependencies (e.g. Python for scripting purposes) which we probably don't want/need.
720823 # (this should probably be reconsidered someday)
0 commit comments