Overhaul build script, make more reliable
This commit is contained in:
parent
5c5d8f3e21
commit
91dddb4214
@ -1,3 +1,6 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
REM
|
REM
|
||||||
REM Generate Standalone MSVC17 x86/x64 Toolchain from VS Installation
|
REM Generate Standalone MSVC17 x86/x64 Toolchain from VS Installation
|
||||||
REM
|
REM
|
||||||
@ -20,22 +23,25 @@ REM
|
|||||||
REM For other Visual Studio versions, you may need to update the version numbers.
|
REM For other Visual Studio versions, you may need to update the version numbers.
|
||||||
REM
|
REM
|
||||||
|
|
||||||
@echo off
|
|
||||||
setlocal
|
|
||||||
|
|
||||||
REM Configuration (NOTE: Update arch to either, "x86", "x64" or "x86 x64" for both toolchains).
|
REM Configuration (NOTE: Update arch to either, "x86", "x64" or "x86 x64" for both toolchains).
|
||||||
set arch=x64
|
set arch=x86 x64
|
||||||
|
|
||||||
REM Source Directories (NOTE: Update the directories for your desired version)
|
REM Source Directories (NOTE: Update the directories for your desired version)
|
||||||
set vs1=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023
|
set vs_version=2017
|
||||||
set vs2=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0
|
set msvc_version=14.16.27023
|
||||||
set vs3=C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0
|
set win_sdk_version=10.0.17763.0
|
||||||
set vs4=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0
|
|
||||||
set dll1=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\api-ms-win-*.dll
|
set vs_root=C:\Program Files (x86)\Microsoft Visual Studio\%vs_version%\Community
|
||||||
|
set vs1=%vs_root%\VC\Tools\MSVC\%msvc_version%
|
||||||
|
set vs2=C:\Program Files (x86)\Windows Kits\10\bin\%win_sdk_version%
|
||||||
|
set vs3=C:\Program Files (x86)\Windows Kits\10\Include\%win_sdk_version%
|
||||||
|
set vs4=C:\Program Files (x86)\Windows Kits\10\Lib\%win_sdk_version%
|
||||||
|
set dll1=%vs_root%\Common7\Tools\api-ms-win-*.dll
|
||||||
set dll2=C:\Windows\System32\*140*.dll
|
set dll2=C:\Windows\System32\*140*.dll
|
||||||
set dll3=C:\Windows\System32\ucrtbase*.dll
|
set dll3=C:\Windows\System32\ucrtbase*.dll
|
||||||
set dll4=C:\Windows\System32\VsGraphicsHelper.dll
|
set dll4=C:\Windows\System32\VsGraphicsHelper.dll
|
||||||
|
|
||||||
|
|
||||||
REM Destination Directory
|
REM Destination Directory
|
||||||
set dest=%~1
|
set dest=%~1
|
||||||
if "%dest%"=="" echo Usage: %~nx0 ^<output folder^>
|
if "%dest%"=="" echo Usage: %~nx0 ^<output folder^>
|
104
Tools/generate_msvc19_toolchain.bat
Normal file
104
Tools/generate_msvc19_toolchain.bat
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
REM
|
||||||
|
REM Generate Standalone MSVC 2017/2019 x86/x64 Toolchain from VS Installation
|
||||||
|
REM
|
||||||
|
REM Collects the necessary includes, binaries, DLLs and libs to around ~300mb on
|
||||||
|
REM disk from a VS installation that can invoke cl, and link as you typically
|
||||||
|
REM would after calling "vcvarsall.bat x64"
|
||||||
|
REM
|
||||||
|
REM This script generates the helper scripts within the generated toolchain.
|
||||||
|
REM cl_[x64|x86].bat: Invokes the compiler with required environment variables set
|
||||||
|
REM link_[x64|x86].bat: Invokes the linker with required environment variables set
|
||||||
|
REM msvc_env_[x64|x86].bat: Setups the environment variables for the toolchain.
|
||||||
|
REM i.e. "call msvc_env_x64.bat" to set the current
|
||||||
|
REM session's environment variables for compiling with
|
||||||
|
REM the toolchain, akin to "vcvarsall.bat x64"
|
||||||
|
REM
|
||||||
|
REM Information about the necessary files and steps adapted from
|
||||||
|
REM Krouzu's Isolating MSVC19 https://gist.github.com/krouzu/19ddd4cb989264b11c7b3ba48c159be0
|
||||||
|
REM Paul Houle's Isolating MSVC14 Script
|
||||||
|
REM
|
||||||
|
REM For other Visual Studio versions, you may need to update the version numbers.
|
||||||
|
REM
|
||||||
|
|
||||||
|
REM Configuration (NOTE: Update arch to either, "x86", "x64" or "x86 x64" for both toolchains).
|
||||||
|
set arch=x86 x64
|
||||||
|
|
||||||
|
REM Source Directories (NOTE: Update the directories for your desired version)
|
||||||
|
set vs_version=2019
|
||||||
|
set msvc_version=14.28.29910
|
||||||
|
set win_sdk_version=10.0.19041.0
|
||||||
|
|
||||||
|
set vs_root=C:\Program Files (x86)\Microsoft Visual Studio\%vs_version%\Community
|
||||||
|
set vs1=%vs_root%\VC\Tools\MSVC\%msvc_version%
|
||||||
|
set vs2=C:\Program Files (x86)\Windows Kits\10\bin\%win_sdk_version%
|
||||||
|
set vs3=C:\Program Files (x86)\Windows Kits\10\Include\%win_sdk_version%
|
||||||
|
set vs4=C:\Program Files (x86)\Windows Kits\10\Lib\%win_sdk_version%
|
||||||
|
set dll1=%vs_root%\Common7\Tools\api-ms-win-*.dll
|
||||||
|
set dll2=C:\Windows\System32\*140*.dll
|
||||||
|
set dll3=C:\Windows\System32\ucrtbase*.dll
|
||||||
|
set dll4=C:\Windows\System32\VsGraphicsHelper.dll
|
||||||
|
|
||||||
|
REM Destination Directory
|
||||||
|
set dest=%~1
|
||||||
|
if "%dest%"=="" echo Usage: %~nx0 ^<output folder^>
|
||||||
|
if "%dest%"=="" goto :eof
|
||||||
|
|
||||||
|
if exist "%dest%" echo Directory "%dest%" already exists, exiting.
|
||||||
|
if exist "%dest%" goto :eof
|
||||||
|
|
||||||
|
REM Path/File Exist Check
|
||||||
|
for %%a in ("%vs1%" "%vs2%" "%dll1%" "%dll2%" "%dll3%" "%dll4%" "%vs3%" "%vs4%") do (
|
||||||
|
if not exist %%a echo Required file or path not found: %%a
|
||||||
|
if not exist %%a goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
set copy_cmd=xcopy /I /S
|
||||||
|
|
||||||
|
REM MSVC Includes
|
||||||
|
%copy_cmd% "%vs1%\include" "%dest%\include"
|
||||||
|
%copy_cmd% "%vs3%\ucrt\*" "%dest%\include"
|
||||||
|
%copy_cmd% "%vs3%\shared\*" "%dest%\sdk\include"
|
||||||
|
%copy_cmd% "%vs3%\um\*" "%dest%\sdk\include"
|
||||||
|
|
||||||
|
REM MSVC Binaries/Libraries/DLLs
|
||||||
|
for %%a in (%arch%) do (
|
||||||
|
%copy_cmd% "%vs1%\bin\Hostx64\%%a" "%dest%\bin\%%a"
|
||||||
|
%copy_cmd% "%vs1%\lib\%%a" "%dest%\lib\%%a"
|
||||||
|
|
||||||
|
%copy_cmd% "%vs2%\%%a" "%dest%\sdk\bin\%%a"
|
||||||
|
|
||||||
|
%copy_cmd% "%vs4%\ucrt\%%a" "%dest%\lib\%%a"
|
||||||
|
%copy_cmd% "%vs4%\um\%%a" "%dest%\sdk\lib\%%a"
|
||||||
|
|
||||||
|
%copy_cmd% "%dll1%" "%dest%\sdk\bin\%%a"
|
||||||
|
%copy_cmd% "%dll2%" "%dest%\sdk\bin\%%a"
|
||||||
|
%copy_cmd% "%dll3%" "%dest%\sdk\bin\%%a"
|
||||||
|
%copy_cmd% "%dll4%" "%dest%\sdk\bin\%%a"
|
||||||
|
|
||||||
|
REM Generate Compiler/Linker Scripts
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
set msvc_env_script="%dest%\msvc_env_%%a.bat"
|
||||||
|
set cl_script="%dest%\cl_%%a.bat"
|
||||||
|
set link_script="%dest%\link_%%a.bat"
|
||||||
|
|
||||||
|
for %%b in (!msvc_env_script! !cl_script! !link_script!) do (
|
||||||
|
echo @echo off>> %%b
|
||||||
|
)
|
||||||
|
|
||||||
|
for %%b in (!cl_script! !link_script!) do (
|
||||||
|
echo setlocal>> %%b
|
||||||
|
)
|
||||||
|
|
||||||
|
for %%b in (!msvc_env_script! !cl_script! !link_script!) do (
|
||||||
|
echo set msvc_root=%%~dp0>> %%b
|
||||||
|
echo set include=%%msvc_root%%\include;%%msvc_root%%\sdk\include>> %%b
|
||||||
|
echo set lib=%%msvc_root%%\lib\%%a;%%msvc_root%%\sdk\lib\%%a>> %%b
|
||||||
|
echo set path=%%msvc_root%%\bin\%%a;%%path%%>> %%b
|
||||||
|
)
|
||||||
|
|
||||||
|
echo cl %%*>> !cl_script!
|
||||||
|
echo link %%*>> !link_script!
|
||||||
|
)
|
@ -1,84 +1,199 @@
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
set root=%~dp0
|
REM ----------------------------------------------------------------------------
|
||||||
set home=!root!\home
|
REM Setup Folder Locations
|
||||||
set cmder_root=!root!\Cmder
|
REM ----------------------------------------------------------------------------
|
||||||
set installer_root=!root!\Installer
|
set root_dir=!CD!
|
||||||
set downloads_root=!installer_root!\Downloads
|
set home_dir=!root_dir!\home
|
||||||
set vim_root=!home!\vimfiles
|
set cmder_dir=!root_dir!\Cmder
|
||||||
set tools_root=!root!\Tools
|
set installer_dir=!root_dir!\Installer
|
||||||
set compiler_root=!tools_root!\Compiler
|
set downloads_dir=!installer_dir!\Downloads
|
||||||
|
set vim_dir=!home_dir!\vimfiles
|
||||||
|
set tools_dir=!root_dir!\Tools
|
||||||
|
|
||||||
if not exist !home! mkdir !home!
|
if not exist !home_dir! mkdir !home_dir!
|
||||||
if not exist !installer_root! mkdir !installer_root!
|
if not exist !installer_dir! mkdir !installer_dir!
|
||||||
if not exist !downloads_root! mkdir !downloads_root!
|
if not exist !downloads_dir! mkdir !downloads_dir!
|
||||||
if not exist !tools_root! mkdir !tools_root!
|
if not exist !tools_dir! mkdir !tools_dir!
|
||||||
if not exist !compiler_root! mkdir !compiler_root!
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM Setup tools for setting up the development environment
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM Bootstrap 7zip
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM We get an old version of 7z that is available as a .zip file which we can
|
||||||
|
REM extract on Windows with just PowerShell (i.e. no dependency).
|
||||||
|
set zip7_bootstrap_sha256=2a3afe19c180f8373fa02ff00254d5394fec0349f5804e0ad2f6067854ff28ac
|
||||||
|
set zip7_bootstrap_version=920
|
||||||
|
set zip7_bootstrap_zip=!downloads_dir!\win32_7zip_bootstrap_v!zip7_bootstrap_version!.zip
|
||||||
|
set zip7_bootstrap_dir=!tools_dir!\7zip_bootstrap-!zip7_bootstrap_version!
|
||||||
|
if not exist !zip7_bootstrap_dir! (
|
||||||
|
call :DownloadFile "https://www.7-zip.org/a/7za!zip7_bootstrap_version!.zip" "!zip7_bootstrap_zip!" || exit /B
|
||||||
|
call :VerifyFileSHA256 "!zip7_bootstrap_zip!" "!zip7_bootstrap_sha256!" || exit /B
|
||||||
|
)
|
||||||
|
if not exist "!zip7_bootstrap_dir!" powershell "Expand-Archive !zip7_bootstrap_zip! -DestinationPath !zip7_bootstrap_dir!" || exit /B
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM 7zip
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM Use our bootstrap 7z from above to download the latest 7zip version
|
||||||
|
REM NOTE: We do not use 7za because it can not unzip a NSIS installer. The full
|
||||||
|
REM version however can.
|
||||||
|
set zip7_sha256=0f5d4dbbe5e55b7aa31b91e5925ed901fdf46a367491d81381846f05ad54c45e
|
||||||
|
set zip7_version=1900
|
||||||
|
set zip7_zip=!downloads_dir!\win32_7zip_v!zip7_version!.exe
|
||||||
|
set zip7_dir=!tools_dir!\7zip-!zip7_version!
|
||||||
|
if not exist !zip7_dir! (
|
||||||
|
call :DownloadFile "https://www.7-zip.org/a/7z!zip7_version!-x64.exe" "!zip7_zip!" || exit /B
|
||||||
|
call :VerifyFileSHA256 "!zip7_zip!" "!zip7_sha256!" || exit /B
|
||||||
|
)
|
||||||
|
if not exist "!zip7_dir!" "!zip7_bootstrap_dir!\7za.exe" x -y -o"!zip7_dir!" !zip7_zip! || exit /B
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM GPG Signature Verification
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
set gpg_w32_sha256=77cec7f274ee6347642a488efdfa324e8c3ab577286e611c397e69b1b396ab16
|
||||||
|
set gpg_w32_version=2.3.1
|
||||||
|
set gpg_w32_date=20210420
|
||||||
|
set gpg_w32_zip=!downloads_dir!\win32_gpg_w32_v!gpg_w32_version!.exe
|
||||||
|
set gpg_w32_dir=!tools_dir!\gpg_w32-!gpg_w32_version!
|
||||||
|
if not exist !gpg_w32_dir! (
|
||||||
|
call :DownloadFile "https://gnupg.org/ftp/gcrypt/binary/gnupg-w32-!gpg_w32_version!_!gpg_w32_date!.exe" "!gpg_w32_zip!" || exit /B
|
||||||
|
call :VerifyFileSHA256 "!gpg_w32_zip!" "!gpg_w32_sha256!" || exit /B
|
||||||
|
call :Unzip "!gpg_w32_zip!" "!gpg_w32_dir!" || exit /B
|
||||||
|
)
|
||||||
|
|
||||||
|
set gpg_w32_bin_dir=!gpg_w32_dir!\bin
|
||||||
|
set PATH="!gpg_w32_bin_dir!";!PATH!
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM Application Setup
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM Download & verify the tools we want for development
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
REM Cmder
|
REM Cmder
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
set cmder_version=v1.3.16
|
set cmder_version=v1.3.16
|
||||||
set cmder_zip=!downloads_root!\win32_cmder_!cmder_version!.7z
|
set cmder_zip=!downloads_dir!\win32_cmder_!cmder_version!.7z
|
||||||
call :DownloadFile https://github.com/cmderdev/cmder/releases/download/!cmder_version!/cmder.7z "!cmder_zip!" || exit /b
|
if not exist !cmder_dir! (
|
||||||
call :Unzip "!cmder_zip!" "!cmder_root!" || exit /b
|
call :DownloadFile https://github.com/cmderdev/cmder/releases/download/!cmder_version!/cmder.7z "!cmder_zip!" || exit /B
|
||||||
|
call :Unzip "!cmder_zip!" "!cmder_dir!" || exit /B
|
||||||
|
)
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
REM Misc Tools
|
REM Dependencies (Walker) - For DLL dependency management
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
REM clang-format: C/C++ formatting tool
|
set dependencies_sha256=44df956dbe267e0a705224c3b85d515fee2adc87509861e24fb6c6b0ea1b86d6
|
||||||
REM ctags: C/C++ code annotation generator
|
set dependencies_version=v1.10
|
||||||
REM scanmapset: Bind capslock to escape via registry
|
set dependencies_zip=!downloads_dir!\win32_dependencies_!dependencies_version!.zip
|
||||||
REM uncap: Bind capslock to escape via run-time program
|
set dependencies_dir=!tools_dir!\dependencies-!dependencies_version!
|
||||||
REM clang-format: Default clang-format style
|
if not exist !dependencies_dir! (
|
||||||
call :CopyFile "!installer_root!\win32_clang_format.exe" "!cmder_root!\bin\clang-format.exe" || exit /b
|
call :DownloadFile "https://github.com/lucasg/Dependencies/releases/download/!dependencies_version!/Dependencies_x64_Release.zip" "!dependencies_zip!" || exit /B
|
||||||
call :CopyFile "!installer_root!\win32_ctags.exe" "!cmder_root!\bin\ctags.exe" || exit /b
|
call :VerifyFileSHA256 "!dependencies_zip!" "!dependencies_sha256!" || exit /B
|
||||||
call :CopyFile "!installer_root!\win32_scanmapset.exe" "!cmder_root!\bin\scanmapset.exe" || exit /b
|
call :Unzip "!dependencies_zip!" "!dependencies_dir!" || exit /B
|
||||||
call :CopyFile "!installer_root!\win32_uncap.exe" "!cmder_root!\bin\uncap.exe" || exit /b
|
)
|
||||||
call :CopyFile "!installer_root!\clang-format-style-file" "!home!\_clang-format" || exit /b
|
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
|
||||||
REM GVim, Vim Plug, Vim Config
|
|
||||||
REM ----------------------------------------------------------------------------
|
|
||||||
set gvim_zip=!downloads_root!\win32_gvim_x64.7z
|
|
||||||
set gvim_path=!tools_root!\GVim
|
|
||||||
call :DownloadFile https://tuxproject.de/projects/vim/complete-x64.7z !gvim_zip! || exit /b
|
|
||||||
call :Unzip "!gvim_zip!" "!gvim_path!" || exit /b
|
|
||||||
|
|
||||||
call :CopyFile "!installer_root!\_vimrc" "!home!" || exit /b
|
|
||||||
call :CopyFile "!installer_root!\win32_gvim_fullscreen.dll" "!gvim_path!\gvim_fullscreen.dll" || exit /b
|
|
||||||
|
|
||||||
set vim_plug_path=!vim_root!\autoload
|
|
||||||
set vim_plug=!vim_plug_path!\plug.vim
|
|
||||||
if not exist "!vim_plug_path!" mkdir "!vim_plug_path!"
|
|
||||||
call :DownloadFile https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim "!vim_plug!" || exit /b
|
|
||||||
|
|
||||||
set vim_clang_format=!vim_root!\clang-format.py
|
|
||||||
call :DownloadFile https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/clang-format.py "!vim_clang_format!" || exit /b
|
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
|
||||||
REM ripgrep
|
|
||||||
REM ----------------------------------------------------------------------------
|
|
||||||
set rg_sha256=a47ace6f654c5ffa236792fc3ee3fefd9c7e88e026928b44da801acb72124aa8
|
|
||||||
set rg_version=13.0.0
|
|
||||||
set rg_zip=!downloads_root!\win32_rg_v!rg_version!.7z
|
|
||||||
set rg_exe=!cmder_root!\bin\rg.exe
|
|
||||||
call :DownloadFile https://github.com/BurntSushi/ripgrep/releases/download/!rg_version!/ripgrep-!rg_version!-x86_64-pc-windows-msvc.zip !rg_zip! || exit /b
|
|
||||||
call :VerifyFile !rg_zip! !rg_sha256!
|
|
||||||
call :Unzip "!rg_zip!" "!rg_exe!" || exit /b
|
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
REM everything (void tools search program)
|
REM everything (void tools search program)
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
set everything_sha256=f61b601acba59d61fb0631a654e48a564db34e279b6f2cc45e20a42ce9d9c466
|
set everything_sha256=f61b601acba59d61fb0631a654e48a564db34e279b6f2cc45e20a42ce9d9c466
|
||||||
set everything_version=1.4.1.1009
|
set everything_version=1.4.1.1009
|
||||||
set everything_zip=!downloads_root!\win32_everything_v!everything_version!.7z
|
set everything_zip=!downloads_dir!\win32_everything_v!everything_version!.7z
|
||||||
set everything_exe=!cmder_root!\bin\everything.exe
|
set everything_dir=!tools_dir!\everything-!everything_version!
|
||||||
call :DownloadFile https://www.voidtools.com/Everything-!everything_version!.x64.zip !everything_zip! || exit /B
|
if not exist !everything_dir! (
|
||||||
call :VerifyFile !everything_zip! !everything_sha256! || exit /B
|
call :DownloadFile "https://www.voidtools.com/Everything-!everything_version!.x64.zip" "!everything_zip!" || exit /B
|
||||||
REM TODO(doyle): Doesn't work because the cache is not smart
|
call :VerifyFileSHA256 "!everything_zip!" "!everything_sha256!" || exit /B
|
||||||
call :Unzip "!everything_zip!" "!tools_root!" || exit /B
|
call :Unzip "!everything_zip!" "!everything_dir!" || exit /B
|
||||||
|
)
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM GVim, Vim Plug, Vim Config
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
set gvim_zip=!downloads_dir!\win32_gvim_x64.7z
|
||||||
|
set gvim_dir=!tools_dir!\GVim
|
||||||
|
if not exist !gvim_dir! (
|
||||||
|
call :DownloadFile https://tuxproject.de/projects/vim/complete-x64.7z !gvim_zip! || exit /B
|
||||||
|
call :Unzip "!gvim_zip!" "!gvim_dir!" || exit /B
|
||||||
|
)
|
||||||
|
|
||||||
|
call :CopyFile "!installer_dir!\_vimrc" "!home_dir!" || exit /B
|
||||||
|
call :CopyFile "!installer_dir!\win32_gvim_fullscreen.dll" "!gvim_dir!\gvim_fullscreen.dll" || exit /B
|
||||||
|
|
||||||
|
set vim_plug_dir=!vim_dir!\autoload
|
||||||
|
set vim_plug=!vim_plug_dir!\plug.vim
|
||||||
|
if not exist "!vim_plug_dir!" mkdir "!vim_plug_dir!"
|
||||||
|
call :DownloadFile "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" "!vim_plug!" || exit /B
|
||||||
|
|
||||||
|
set vim_clang_format=!vim_dir!\clang-format.py
|
||||||
|
call :DownloadFile "https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/clang-format.py" "!vim_clang_format!" || exit /B
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM LLVM/Clang
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
set llvm_version=12.0.1
|
||||||
|
set llvm_zip=!downloads_dir!\win32_llvm_x64_v!llvm_version!.exe
|
||||||
|
set llvm_dir=!tools_dir!\llvm-!llvm_version!
|
||||||
|
set llvm_gpg_key=!downloads_dir!\llvm-tstellar-gpg-key.asc
|
||||||
|
set llvm_gpg_sig=!llvm_zip!.sig
|
||||||
|
if not exist !llvm_dir! (
|
||||||
|
call :DownloadFile "https://github.com/llvm/llvm-project/releases/download/llvmorg-9.0.1/tstellar-gpg-key.asc" "!llvm_gpg_key!" || exit /B
|
||||||
|
call :DownloadFile "https://github.com/llvm/llvm-project/releases/download/llvmorg-!llvm_version!/LLVM-!llvm_version!-win64.exe.sig" "!llvm_gpg_sig!" || exit /B
|
||||||
|
call :DownloadFile "https://github.com/llvm/llvm-project/releases/download/llvmorg-!llvm_version!/LLVM-!llvm_version!-win64.exe" "!llvm_zip!" || exit /B
|
||||||
|
|
||||||
|
gpg --import "!llvm_gpg_key!" || exit /B
|
||||||
|
gpg --verify "!llvm_gpg_sig!" "!llvm_zip!" || exit /B
|
||||||
|
call :Unzip "!llvm_zip!" "!llvm_dir!" || exit /B
|
||||||
|
)
|
||||||
|
|
||||||
|
set llvm_bin_dir=!llvm_dir!\bin
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM Misc Tools
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM ctags: C/C++ code annotation generator
|
||||||
|
REM scanmapset: Bind capslock to escape via registry
|
||||||
|
REM uncap: Bind capslock to escape via run-time program
|
||||||
|
call :CopyFile "!installer_dir!\win32_ctags.exe" "!cmder_dir!\bin\ctags.exe" || exit /B
|
||||||
|
call :CopyFile "!installer_dir!\win32_scanmapset.exe" "!cmder_dir!\bin\scanmapset.exe" || exit /B
|
||||||
|
call :CopyFile "!installer_dir!\win32_uncap.exe" "!cmder_dir!\bin\uncap.exe" || exit /B
|
||||||
|
call :CopyFile "!installer_dir!\clang-format-style-file" "!home_dir!\_clang-format" || exit /B
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM Python
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
set python_sha256=93cc3db75dffb4d56b9f64af43294f130f2c222a66de7a1325d0ce8f1ed62e26
|
||||||
|
set python_version=3.9.0.2dot
|
||||||
|
set python_version_nodot=3902
|
||||||
|
set python_version_dot=3.9.0
|
||||||
|
set python_url=https://github.com/winpython/winpython/releases/download/3.0.20201028/Winpython64-!python_version!.exe
|
||||||
|
set python_zip=!downloads_dir!\win32_Winpython64-!python_version!.exe
|
||||||
|
set python_dir=!tools_dir!\Winpython64-!python_version_nodot!
|
||||||
|
set python_subfolder=!python_dir!\WPy64-!python_version_nodot!
|
||||||
|
if not exist !python_dir! (
|
||||||
|
call :DownloadFile !python_url! "!python_zip!" || exit /B
|
||||||
|
call :VerifyFileSHA256 "!python_zip!" "!python_sha256!" || exit /B
|
||||||
|
call :Unzip "!python_zip!" "!python_dir!" || exit /B
|
||||||
|
call :Move "!python_subfolder!" "!python_dir!" || exit /B
|
||||||
|
)
|
||||||
|
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
REM ripgrep
|
||||||
|
REM ----------------------------------------------------------------------------
|
||||||
|
set rg_sha256=a47ace6f654c5ffa236792fc3ee3fefd9c7e88e026928b44da801acb72124aa8
|
||||||
|
set rg_version=13.0.0
|
||||||
|
set rg_zip=!downloads_dir!\win32_rg_v!rg_version!.7z
|
||||||
|
set rg_dir=!tools_dir!\ripgrep-!rg_version!
|
||||||
|
set rg_subfolder=!rg_dir!\ripgrep-!rg_version!-x86_64-pc-windows-msvc
|
||||||
|
if not exist !rg_dir! (
|
||||||
|
call :DownloadFile "https://github.com/BurntSushi/ripgrep/releases/download/!rg_version!/ripgrep-!rg_version!-x86_64-pc-windows-msvc.zip" "!rg_zip!" || exit /B
|
||||||
|
call :VerifyFileSHA256 "!rg_zip!" "!rg_sha256!" || exit /B
|
||||||
|
call :Unzip "!rg_zip!" "!rg_dir!" || exit /B
|
||||||
|
call :Move "!rg_subfolder!" "!rg_dir!" || exit /B
|
||||||
|
)
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
REM Zig
|
REM Zig
|
||||||
@ -86,47 +201,47 @@ REM ----------------------------------------------------------------------------
|
|||||||
set zig_sha256=8580fbbf3afb72e9b495c7f8aeac752a03475ae0bbcf5d787f3775c7e1f4f807
|
set zig_sha256=8580fbbf3afb72e9b495c7f8aeac752a03475ae0bbcf5d787f3775c7e1f4f807
|
||||||
set zig_version=0.8.0
|
set zig_version=0.8.0
|
||||||
set zig_file=zig-windows-x86_64-!zig_version!.zip
|
set zig_file=zig-windows-x86_64-!zig_version!.zip
|
||||||
set zig_zip=!downloads_root!\win32_!zig_file!
|
set zig_zip=!downloads_dir!\win32_!zig_file!
|
||||||
set zig_path=!compiler_root!\zig-windows-x86_64-!zig_version!
|
set zig_dir=!tools_dir!\zig-windows-x86_64-!zig_version!
|
||||||
call :DownloadFile https://ziglang.org/download/!zig_version!/!zig_file! !zig_zip! || exit /b
|
if not exist !zig_dir! (
|
||||||
call :VerifyFile !zig_zip! !zig_sha256!
|
call :DownloadFile "https://ziglang.org/download/!zig_version!/!zig_file!" "!zig_zip!" || exit /B
|
||||||
call :Unzip "!zig_zip!" "!compiler_root!" || exit /b
|
call :VerifyFileSHA256 "!zig_zip!" "!zig_sha256!" || exit /B
|
||||||
|
call :Unzip "!zig_zip!" "!zig_dir!" || exit /B
|
||||||
|
)
|
||||||
|
|
||||||
|
set python_bin_dir=!tools_dir!\Winpython64-!python_version_nodot!\python-!python_version_dot!.amd64
|
||||||
|
set python_scripts_bin_dir=!python_bin_dir!\Scripts
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
REM Python
|
REM Super Terminal
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
set python_version=3.9.0.2dot
|
set terminal_script=!root_dir!\terminal.bat
|
||||||
set python_version_nodot=3902
|
echo @echo off> "!terminal_script!"
|
||||||
set python_url=https://github.com/winpython/winpython/releases/download/3.0.20201028/Winpython64-!python_version!.exe
|
echo set PATH=!gpg_w32_bin_dir!;%%PATH%%>> "!terminal_script!"
|
||||||
set python_zip=!downloads_root!\win32_Winpython64-!python_version!.exe
|
echo set PATH=!llvm_bin_dir!;%%PATH%%>> "!terminal_script!"
|
||||||
set python_path=!tools_root!\WPy64-!python_version_nodot!
|
echo set PATH=!python_bin_dir!;%%PATH%%>> "!terminal_script!"
|
||||||
call :DownloadFile !python_url! "!python_zip!" || exit /b
|
echo set PATH=!python_scripts_bin_dir!;%%PATH%%>> "!terminal_script!"
|
||||||
call :Unzip "!python_zip!" "!tools_root!" || exit /b
|
echo set PATH=!rg_dir!;%%PATH%%>> "!terminal_script!"
|
||||||
|
echo set PATH=!zig_dir!;%%PATH%%>> "!terminal_script!"
|
||||||
REM ----------------------------------------------------------------------------
|
echo set PATH=!zip7_dir!;%%PATH%%>> "!terminal_script!"
|
||||||
REM Generate Cmder Startup Config File
|
echo set PYTHONHOME=!python_bin_dir!>> "!terminal_script!"
|
||||||
REM ----------------------------------------------------------------------------
|
echo set HOME=!home_dir!>> "!terminal_script!"
|
||||||
set cmder_config_file=!cmder_root!\config\user_profile.cmd
|
echo set HOMEPATH=!home_dir!>> "!terminal_script!"
|
||||||
echo - Generate cmder config at !cmder_config_file!
|
echo set USERPROFILE=!home_dir!>> "!terminal_script!"
|
||||||
echo @echo off> !cmder_config_file!
|
echo set gvim=!gvim_dir!\gvim.exe $*>> "!terminal_script!"
|
||||||
echo set PATH=!zig_path!;%%PATH%%>> "!cmder_config_file!"
|
echo call !tools_dir!\MSVC-2019-v16.9.2-VC-v14.28.29910-Win10-SDK-v10.0.19041.0-x64\msvc_env_x64.bat>> "!terminal_script!"
|
||||||
echo set PATH=!python_path!\python-3.9.0.amd64;%%PATH%%>> "!cmder_config_file!"
|
echo !cmder_dir!\cmder.exe>> "!terminal_script!"
|
||||||
echo set PATH=!python_path!\python-3.9.0.amd64\Scripts;%%PATH%%>> "!cmder_config_file!"
|
|
||||||
echo set PYTHONHOME=!python_path!\python-3.9.0.amd64>> "!cmder_config_file!"
|
|
||||||
echo set HOME=!cmder_root!\..\Home>> "!cmder_config_file!"
|
|
||||||
echo set HOMEPATH=!cmder_root!\..\Home>> "!cmder_config_file!"
|
|
||||||
echo set USERPROFILE=!cmder_root!\..\Home>> "!cmder_config_file!"
|
|
||||||
echo alias gvim=!cmder_root!\..\Tools\GVim\gvim.exe $*>> "!cmder_config_file!"
|
|
||||||
|
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
REM CTags Helper Script
|
REM CTags Helper Script
|
||||||
REM ----------------------------------------------------------------------------
|
REM ----------------------------------------------------------------------------
|
||||||
set ctags_file=!cmder_root!\bin\ctags_cpp.bat
|
set ctags_file=!cmder_dir!\bin\ctags_cpp.bat
|
||||||
echo @echo off> !ctags_file!
|
echo @echo off> "!ctags_file!"
|
||||||
echo ctags --c++-kinds=+p --fields=+iaS --extras=+q !!*>> !ctags_file!
|
echo ctags --c++-kinds=+p --fields=+iaS --extras=+q %%*>> !ctags_file!
|
||||||
|
|
||||||
echo - Setup complete. Launch !cmder_root!\cmder.exe [or restart Cmder instance if you're updating an existing installation]
|
echo - Setup complete. Launch !cmder_dir!\cmder.exe [or restart Cmder instance if you're updating an existing installation]
|
||||||
exit /b
|
pause
|
||||||
|
exit /B
|
||||||
|
|
||||||
REM ------------------------------------------------------------------------------------------------
|
REM ------------------------------------------------------------------------------------------------
|
||||||
REM Functions
|
REM Functions
|
||||||
@ -166,12 +281,12 @@ if exist !dest! (
|
|||||||
echo - [Cached] !msg!
|
echo - [Cached] !msg!
|
||||||
) else (
|
) else (
|
||||||
echo - !msg!
|
echo - !msg!
|
||||||
call !installer_root!\win32_7za.exe x -y -o!dest! !zip_file!
|
call !zip7_dir!\7z.exe x -y -spe -o!dest! !zip_file!
|
||||||
)
|
)
|
||||||
exit /B
|
exit /B
|
||||||
|
|
||||||
REM ------------------------------------------------------------------------------------------------
|
REM ------------------------------------------------------------------------------------------------
|
||||||
:VerifyFile
|
:VerifyFileSHA256
|
||||||
set file=%~1
|
set file=%~1
|
||||||
set expected_sha256=%~2
|
set expected_sha256=%~2
|
||||||
|
|
||||||
@ -182,10 +297,19 @@ call powershell "$FileHash = Get-FileHash -algorithm sha256 !file!; $FileHash.Ha
|
|||||||
REM Verify Hash
|
REM Verify Hash
|
||||||
set /p actual_sha256=< !calculated_sha256_file!
|
set /p actual_sha256=< !calculated_sha256_file!
|
||||||
if "!expected_sha256!" neq "!actual_sha256!" (
|
if "!expected_sha256!" neq "!actual_sha256!" (
|
||||||
echo - [Verify] Hash BAD: Expected: !expected_sha256!
|
echo - [Verify] !file! Hash BAD: Expected: !expected_sha256!
|
||||||
echo Calculated: !actual_sha256!
|
echo Calculated: !actual_sha256!
|
||||||
exit /B -1
|
exit /B -1
|
||||||
) else (
|
) else (
|
||||||
echo - [Verify] Hash OK: !expected_sha256!
|
echo - [Verify] !file! Hash OK: !expected_sha256!
|
||||||
exit /B 0
|
exit /B 0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
REM ------------------------------------------------------------------------------------------------
|
||||||
|
:Move
|
||||||
|
set src=%~1
|
||||||
|
set dest=%~2
|
||||||
|
|
||||||
|
if exist !src! robocopy !src! !dest! /E /MOVE /NP /NJS /NJS /NS /NC /NFL /NDL
|
||||||
|
|
||||||
|
exit /B
|
||||||
|
Loading…
Reference in New Issue
Block a user