-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathinstall_deps_windows_msys2.bat
More file actions
54 lines (42 loc) · 2.57 KB
/
Copy pathinstall_deps_windows_msys2.bat
File metadata and controls
54 lines (42 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
@echo off
rem This script installs (or updates) MSYS2, and some Clang tools in it.
rem Which is everything you need to generate MRBind bindings on Windows.
rem We create a separate copy of MSYS2 at C:\msys64_meshlib_mrbind for simplicity.
rem If you don't like that, you can manually install all dependencies into
rem some other MSYS2 copy.
setlocal
if "%MSYS2_DIR%" == "" set MSYS2_DIR=C:\msys64_meshlib_mrbind
rem ------ Ensure MSYS2 is installed
if exist %MSYS2_DIR% (
echo MSYS2 is already installed to `%MSYS2_DIR%`.
) else (
echo MSYS2 was NOT found at `%MSYS2_DIR%`.
rem --- Download installer
if exist %TMP%\msys2-base-x86_64-latest.sfx.exe (
echo Will use existing installer at `%TMP%\msys2-base-x86_64-latest.sfx.exe`.
echo If it misbehaves, delete it and restart this script to download a new one. Or install manually to `%MSYS2_DIR%` and restart this script to download the required packages into it.
) else (
echo Downloading installer to `%TMP%\msys2-base-x86_64-latest.sfx.exe`...
rem This seems to automatically overwrite the file!
powershell -Command "Invoke-WebRequest https://github.com/msys2/msys2-installer/releases/latest/download/msys2-base-x86_64-latest.sfx.exe -OutFile %TMP%\msys2-base-x86_64-latest.sfx.exe.part"
move /Y %TMP%\msys2-base-x86_64-latest.sfx.exe.part %TMP%\msys2-base-x86_64-latest.sfx.exe
)
rem --- Run the installer
echo Installing MSYS2...
%TMP%\msys2-base-x86_64-latest.sfx.exe -y -o%MSYS2_DIR%
rem Move files out of the `msys64` subdirectory.
for %%a in ("%MSYS2_DIR%\msys64\*") do move /y "%%~fa" %MSYS2_DIR%
for /d %%a in ("%MSYS2_DIR%\msys64\*") do move /y "%%~fa" %MSYS2_DIR%
rmdir msys64
)
rem ------ Update MSYS2
rem Note that we're running the update twice, because MSYS2 can close itself during the initial update,
rem and requires re-running the same command to finish the update.
rem It's not entirely optimal to run the command twice even if the first one finishes successfully, but I'm not sure how to check that it failed.
call %MSYS2_DIR%\msys2_shell.cmd -no-start -defterm -c "pacman -Syu --noconfirm"
call %MSYS2_DIR%\msys2_shell.cmd -no-start -defterm -c "pacman -Syu --noconfirm"
rem ------ Install needed packages
call %MSYS2_DIR%\msys2_shell.cmd -no-start -defterm -clang64 -c "pacman -S --noconfirm --needed gawk make procps-ng $MINGW_PACKAGE_PREFIX-cmake"
rem ------ Install a specific version of Clang
call %MSYS2_DIR%\msys2_shell.cmd -no-start -defterm -clang64 -c "'%~dp0'/msys2_install_clang_ver.sh $('%~dp0'/select_clang_version.sh)"
endlocal