批处理安装配置GCC,MSYS环境

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

@echo off
echo Setting Mingw-w64 Environment

::Check Your System,Must Win64

if /i "%PROCESSOR_IDENTIFIER:~0,3%"=="X86" goto X86NotSupport

for /f "tokens=3" %%i in (' reg query "HKCU\Control Panel\International" /v 
 "sLanguage" ' ) do (
 set LocalEvar=%%i
)
if /i "%LocalEvar%"=="CHS" ( call :PrintReadMeCHS ) else ( call :PrintReadMeENU )
::goto :EOF
cd /d %~dp0

:InitMingwFileSystem
::Mount Mingw to /mingw
if not exist "%~dp0msys\1.0" goto ExitConfigError
if not exist "%~dp0msys\1.0\etc" ( mkdir %~dp0msys\1.0\etc &&  call :CopyConfig )
if not exist "%~dp0msys\1.0\etc\fstab" call :MKFSTAB
echo.>>%~dp0msys\1.0\etc\fstab
echo %~dp0  /mingw>>%~dp0msys\1.0\etc\fstab

call :CreateTerminalConfig
call :InitPath
goto EndConfig
:MKFSTAB
echo  #fstab >%~dp0msys\1.0\etc\fstab
goto :EOF

:CopyConfig
copy /Y %~dp0package\etc\*.*  %~dp0msys\1.0\etc
mkdir %~dp0msys\1.0\etc\ssh
copy /Y %~dp0package\etc\ssh\*.* %~dp0msys\1.0\etc\ssh
goto :EOF

:CreateTerminalConfig
if exist "%~dp0msys\1.0\home\%username%" (
del /S /Q %~dp0msys\1.0\home\%username%
rd /S /Q %~dp0msys\1.0\home\%username%
)
mkdir %~dp0msys\1.0\home\%username%
copy /Y %~dp0msys\1.0\home\Default\*.* %~dp0msys\1.0\home\%username%
goto :EOF

:InitPath
if not exist "%~dp0EnvironmentCall.bat" (
 echo Not EnvironmentCall.bat In this Folder,Please retry Unzip InstallPack.
 SET Ruslt=2
)

if not exist "%~dp0MSYSShellCall.bat" (
   echo Not MsysShellCall.bat In this Folder,Please retry Unzip InstallPack.
   SET Ruslt=3
)
::goto :EOF
goto :EOF

:PrintReadMeCHS
echo X86_64-w64-mingw32(Huxizero) ReadMe >%~dp0ReadMe.txt
echo ReadMe.CHS>>%~dp0ReadMe.txt
echo EnvironmentCall.bat 设置环境>>%~dp0ReadMe.txt
echo MSYSShellCall.bat 启动MSYS Shell>>%~dp0ReadMe.txt
echo Install.bat 安装配置 X86_64-w64-mingw32(Huxizero)>>%~dp0ReadMe.txt
echo GCC: 4.8.2 x64>>%~dp0ReadMe.txt
echo MSYS: 1.0 X32>>%~dp0ReadMe.txt
echo If Your User Build GCC Binutils ... Must add --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 to ./configure >>%~dp0ReadMe.txt

goto :EOF
:PrintReadMeENU
echo X86_64-w64-mingw32(Huxizero) ReadMe >%~dp0ReadMe.txt
echo ReadMe.ENU>>%~dp0ReadMe.txt
echo EnvironmentCall.bat Setting Environment>>%~dp0ReadMe.txt
echo MSYSShellCall.bat StartMSYS Shell>>%~dp0ReadMe.txt
echo Install.bat Install^&^&Config X86_64-w64-mingw32(Huxizero)>>%~dp0ReadMe.txt
echo GCC: 4.8.2 x64>>%~dp0ReadMe.txt
echo MSYS: 1.0 X32>>%~dp0ReadMe.txt
echo If Your User Build GCC Binutils ... Must add --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 to ./configure >>%~dp0ReadMe.txt

goto :EOF

:X86NotSupport
echo Error ! This is X86_64-w64-mingw32 and Not Support Win32.
pause
goto :EOF

:EndConfig
echo %Ruslt%
exit /B 0

:ExitConfigError
echo Error Config Please Check X86_64-w64-mingw32(Huxizero) install.
exit /B 2