Link to this batch file
rem
rem
rem MSYS2 GCC BUILD (INSTRUCTIONS FROM LH_MOUSE)
rem
rem 1. Install MSYS2 (script below assumes default install in c:\msys64)
rem 2. Run an MSYS2 terminal window
rem 3. Run mingw64_gcc1120_msys2_build_script script
rem
rem THE REST OF THIS SCRIPT (BELOW) SHOULD BE RUN AS A MS-DOS BATCH FILE
rem
rem EXTRACT PACKAGES CREATED BY MSYS2 TERMINAL SESSION
rem
rem Install folder
rem
set MINGW_INSTALL=d:\mingw64_gcc11.2.0-8_willus.com
rem
rem Folder containing rsxnt.dll and make.exe.  Not required.
rem Comment this out if you want.
rem
set RSXNT_DIR=c:\bin
rem
rem Folder where MSYS-2 was installed
rem
set MSYS=c:\msys64
set PKGDIR=%MINGW_INSTALL%\tarfiles
rem
rem Gcc versin
rem
set GCCVER=11.2.0
rem
rem (This will fail if it already exists anyway)
mkdir "%MINGW_INSTALL%"
cd /d "%MINGW_INSTALL%"
rmdir /s /q mingw64 mingw32
7z -y x "%PKGDIR%\*.tar"
del /q .PKGINFO .MTREE .BUILDINFO
rem
rem
rem BUILD MINIMAL GCC INSTALL FOR MULTILIB
rem
rmdir /s /q bin include lib
mkdir bin
cd bin
mkdir x64
cd x64
copy /y "%MSYS%\mingw64\bin\ar.exe"
copy /y "%MSYS%\mingw64\bin\as.exe"
copy /y "%MSYS%\mingw64\bin\addr2line.exe"
copy /y "%MSYS%\mingw64\bin\c++filt.exe"
copy /y "%MSYS%\mingw64\bin\dll*.exe"
copy /y "%MSYS%\mingw64\bin\gcov-dump.exe"
copy /y "%MSYS%\mingw64\bin\gprof.exe"
copy /y "%MSYS%\mingw64\bin\ld.bfd.exe"
copy /y "%MSYS%\mingw64\bin\ld.exe"
copy /y "%MSYS%\mingw64\bin\nm.exe"
copy /y "%MSYS%\mingw64\bin\objcopy.exe"
copy /y "%MSYS%\mingw64\bin\objdump.exe"
copy /y "%MSYS%\mingw64\bin\ranlib.exe"
copy /y "%MSYS%\mingw64\bin\readelf.exe"
copy /y "%MSYS%\mingw64\bin\size.exe"
copy /y "%MSYS%\mingw64\bin\strings.exe"
copy /y "%MSYS%\mingw64\bin\strip.exe"
copy /y "%MSYS%\mingw64\bin\windmc.exe"
copy /y "%MSYS%\mingw64\bin\windres.exe"
copy /y "%MSYS%\mingw64\bin\libwinpthread-1.dll"
copy /y "%MSYS%\mingw64\bin\libgmp-10.dll"
copy /y "%MSYS%\mingw64\bin\zlib1.dll"
if "%RSXNT_DIR%"=="" goto skip1
copy /y "%RSXNT_DIR%\make.exe"
copy /y "%RSXNT_DIR%\rsxnt.dll"
:skip1
copy /y ..\..\mingw64\bin\*
copy /y "..\..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.exe"
copy /y "..\..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.spec"
cd ..
mkdir x32
cd x32
copy /y "%MSYS%\mingw32\bin\ar.exe"
copy /y "%MSYS%\mingw32\bin\as.exe"
copy /y "%MSYS%\mingw32\bin\addr2line.exe"
copy /y "%MSYS%\mingw32\bin\c++filt.exe"
copy /y "%MSYS%\mingw32\bin\dll*.exe"
copy /y "%MSYS%\mingw32\bin\gcov-dump.exe"
copy /y "%MSYS%\mingw32\bin\gprof.exe"
copy /y "%MSYS%\mingw32\bin\ld.bfd.exe"
copy /y "%MSYS%\mingw32\bin\ld.exe"
copy /y "%MSYS%\mingw32\bin\nm.exe"
copy /y "%MSYS%\mingw32\bin\objcopy.exe"
copy /y "%MSYS%\mingw32\bin\objdump.exe"
copy /y "%MSYS%\mingw32\bin\ranlib.exe"
copy /y "%MSYS%\mingw32\bin\readelf.exe"
copy /y "%MSYS%\mingw32\bin\size.exe"
copy /y "%MSYS%\mingw32\bin\strings.exe"
copy /y "%MSYS%\mingw32\bin\strip.exe"
copy /y "%MSYS%\mingw32\bin\windmc.exe"
copy /y "%MSYS%\mingw32\bin\windres.exe"
copy /y "%MSYS%\mingw32\bin\libwinpthread-1.dll"
copy /y "%MSYS%\mingw32\bin\libgmp-10.dll"
copy /y "%MSYS%\mingw32\bin\zlib1.dll"
if "%RSXNT_DIR%"=="" goto skip2
copy /y "%RSXNT_DIR%\make.exe"
copy /y "%RSXNT_DIR%\rsxnt.dll"
:skip2
copy /y ..\..\mingw32\bin\*
copy /y "..\..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.exe"
copy /y "..\..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.spec"
cd ..
rem
rem Put liblto_plugin-0.dll in the right folders.  MUST be in these folders rel. to bin.
rem
mkdir lib
mkdir lib\gcc
mkdir lib\gcc\i686-w64-mingw32
mkdir "lib\gcc\i686-w64-mingw32\%GCCVER%"
copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.dll" "lib\gcc\i686-w64-mingw32\%GCCVER%"
mkdir lib\gcc\x86_64-w64-mingw32
mkdir "lib\gcc\x86_64-w64-mingw32\%GCCVER%"
copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.dll" "lib\gcc\x86_64-w64-mingw32\%GCCVER%"
cd ..
rem
rem LIBRARY DIR
rem
mkdir lib
cd lib
mkdir x64
xcopy /e /y "%MSYS%\mingw64\x86_64-w64-mingw32\lib\*" x64
copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.a" x64
copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.o" x64
mkdir x64\adalib
copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\adalib\*" x64\adalib
del /q x64\*dll*
mkdir x32
xcopy /e /y "%MSYS%\mingw32\i686-w64-mingw32\lib\*" x32
copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.a" x32
copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.o" x32
mkdir x32\adalib
copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\adalib\*" x32\adalib
del /q x32\*dll*
cd ..
rem
rem INCLUDE DIR
rem
mkdir include
cd include
mkdir x64
xcopy /y /e "%MSYS%\mingw64\x86_64-w64-mingw32\include\*" x64
xcopy /e /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\include\*" x64
mkdir x64\adainclude
copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\adainclude\*" x64\adainclude
copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\adainclude" x64\adainclude
mkdir x64\finclude
copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\finclude\*" x64\finclude
copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\finclude" x64\finclude
mkdir x64\c++
xcopy /e /y "..\mingw64\include\c++\%GCCVER%\*" x64\c++
xcopy /e /y x64\c++\x86_64-w64-mingw32\* x64\c++
rmdir /s /q x64\c++\x86_64-w64-mingw32
mkdir x32
xcopy /y /e "%MSYS%\mingw32\i686-w64-mingw32\include\*" x32
xcopy /e /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\include\*" x32
mkdir x32\adainclude
copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\adainclude\*" x32\adainclude
copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\adainclude" x32\adainclude
mkdir x32\finclude
copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\finclude\*" x32\finclude
copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\finclude" x32\finclude
mkdir x32\c++
xcopy /e /y "..\mingw32\include\c++\%GCCVER%\*" x32\c++
xcopy /e /y x32\c++\i686-w64-mingw32\* x32\c++
rmdir /s /q x32\c++\i686-w64-mingw32
cd ..
rem
rem My utility to combine include folders
rem
cd include
mkdir inc
cd inc
rem
rem The folders:  %MSYS%\mingw64\x86_64-w64-mingw32\include
rem          and  %MSYS%\mingw32\i686-w64-mingw32\include
rem          are IDENTICAL.
rem
xcopy /e "%MSYS%\mingw64\x86_64-w64-mingw32\include\*" .
cd ..
imerge inc x64 x32
cd ..
rem
rem Copy DLLs
rem
copy /y "%MSYS%\mingw32\bin\libzstd.dll" bin\x32
copy /y "%MSYS%\mingw64\bin\libzstd.dll" bin\x64
rem
rem Clean up
rem
rmdir /s /q mingw64 mingw32