From bc125a75bff848fc0c7a8f08b165b0cbeb965cdb Mon Sep 17 00:00:00 2001 From: thunder2 Date: Fri, 10 Nov 2023 20:44:48 +0100 Subject: [PATCH] Fixed download of msys2 during Windows build --- .../Windows-msys2/env/tools/prepare-msys2.bat | 28 ++++++++++--------- .../Windows-msys2/env/tools/prepare-tools.bat | 2 +- .../env/tools/root/update-msys2.bat | 11 ++------ build_scripts/Windows/env/env-msys2.bat | 3 +- .../Windows/env/tools/prepare-msys2.bat | 25 ++++++++--------- .../Windows/env/tools/prepare-tools.bat | 18 ++++++------ 6 files changed, 42 insertions(+), 45 deletions(-) diff --git a/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat b/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat index d07c7a058..eaeba1482 100644 --- a/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat +++ b/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat @@ -16,7 +16,13 @@ if "%~1"=="clean" ( goto exit ) -if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" ( +set MSYS2Version=20231026 + +set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe +set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install% +set MSYS2UnpackPath=%EnvMSYS2Path%\msys64 + +if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" ( if "%~1"=="reinstall" ( choice /M "Found existing MSYS2 version. Do you want to proceed?" if !ERRORLEVEL!==2 goto exit @@ -25,30 +31,26 @@ if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" ( ) ) -if "%MSYS2Architecture%"=="i686" set MSYS2Version=20210705 -if "%MSYS2Architecture%"=="x86_64" set MSYS2Version=20210725 +if exist "%MSYS2UnpackPath%" ( + %cecho% info "Remove previous MSYS2 version" + call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%" +) -set MSYS2Install=msys2-base-%MSYS2Architecture%-%MSYS2Version%.tar.xz -set MSYS2Url=https://repo.msys2.org/distrib/%MSYS2Architecture%/%MSYS2Install% - -%cecho% info "Remove previous MSYS2 version" -call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%" - -%cecho% info "Download installation files" +%cecho% info "Download MSYS2 installation files" if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error %cecho% info "Unpack MSYS2" -"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%" +"%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%" -set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh +set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh %cecho% info "Initialize MSYS2" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "pacman --noconfirm -Sy" "%MSYS2SH%" -lc "pacman --noconfirm -Su" -call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat" +call "%MSYS2UnpackPath%\autorebase.bat" :exit endlocal diff --git a/build_scripts/Windows-msys2/env/tools/prepare-tools.bat b/build_scripts/Windows-msys2/env/tools/prepare-tools.bat index c6b14a787..66f5f9120 100644 --- a/build_scripts/Windows-msys2/env/tools/prepare-tools.bat +++ b/build_scripts/Windows-msys2/env/tools/prepare-tools.bat @@ -34,7 +34,7 @@ if not exist "%EnvToolsPath%\cecho.exe" ( if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error echo Unpack cecho - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0 copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" diff --git a/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat b/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat index a3d2398cd..ddd5bdd0f 100644 --- a/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat +++ b/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat @@ -2,18 +2,13 @@ setlocal -if exist "%~dp0msys2\msys32" call :update 32 -if exist "%~dp0msys2\msys64" call :update 64 +if not exist "%~dp0msys2\msys64" goto :EOF -goto :EOF +set MSYS2SH=%~dp0msys2\msys64\usr\bin\sh -:update -set MSYS2SH=%~dp0msys2\msys%~1\usr\bin\sh - -echo Update MSYS2 %~1 +echo Update MSYS2 "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "pacman --noconfirm -Su" -:exit endlocal goto :EOF diff --git a/build_scripts/Windows/env/env-msys2.bat b/build_scripts/Windows/env/env-msys2.bat index fee7e46b9..47dd8d96a 100644 --- a/build_scripts/Windows/env/env-msys2.bat +++ b/build_scripts/Windows/env/env-msys2.bat @@ -22,11 +22,12 @@ if "%GCCArchitecture%"=="x64" ( ) set EnvMSYS2Path=%EnvRootPath%\msys2 +set EnvMSYS2BasePath=%EnvMSYS2Path%\msys64 call "%~dp0tools\prepare-msys2.bat" %1 if errorlevel 1 exit /B %ERRORLEVEL% -set EnvMSYS2SH=%EnvMSYS2Path%\msys64\usr\bin\sh.exe +set EnvMSYS2SH=%EnvMSYS2BasePath%\usr\bin\sh.exe if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc diff --git a/build_scripts/Windows/env/tools/prepare-msys2.bat b/build_scripts/Windows/env/tools/prepare-msys2.bat index 17fe6c36e..25f00ac30 100644 --- a/build_scripts/Windows/env/tools/prepare-msys2.bat +++ b/build_scripts/Windows/env/tools/prepare-msys2.bat @@ -16,15 +16,15 @@ if "%~1"=="clean" ( goto exit ) -set MSYS2Version=20230318 +set MSYS2Version=20231026 set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install% +set MSYS2UnpackPath=%EnvMSYS2Path%\msys64 set CMakeInstall=cmake-3.19.0-win32-x86.zip set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall% -set CMakeUnpackPath=%EnvMSYS2Path%\msys64 -if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" ( +if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" ( if "%~1"=="reinstall" ( choice /M "Found existing MSYS2 version. Do you want to proceed?" if !ERRORLEVEL!==2 goto exit @@ -33,13 +33,12 @@ if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" ( ) ) - -if exist "%CMakeUnpackPath%" ( +if exist "%MSYS2UnpackPath%" ( %cecho% info "Remove previous MSYS2 version" - call "%ToolsPath%\remove-dir.bat" "%CMakeUnpackPath%" + call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%" ) -%cecho% info "Download installation files" +%cecho% info "Download MSYS2 installation files" if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error @@ -50,29 +49,29 @@ if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download C "%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%" %cecho% info "Unpack CMake" -"%EnvSevenZipExe%" x -o"%CMakeUnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" +"%EnvSevenZipExe%" x -o"%MSYS2UnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0 %cecho% info "Install CMake" set CMakeVersion= -for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF +for /D %%F in (%MSYS2UnpackPath%\cmake*) do set CMakeVersion=%%~nxF if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit %cecho% info "Found CMake version %CMakeVersion%" set FoundProfile= -for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%CMakeUnpackPath%\etc\profile"') do set FoundProfile=%%F +for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%MSYS2UnpackPath%\etc\profile"') do set FoundProfile=%%F if "%FoundProfile%"=="0" ( - echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%CMakeUnpackPath%\etc\profile" + echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%MSYS2UnpackPath%\etc\profile" ) -set MSYS2SH=%CMakeUnpackPath%\usr\bin\sh +set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh %cecho% info "Initialize MSYS2" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "pacman --noconfirm -Sy" "%MSYS2SH%" -lc "pacman --noconfirm -Su" -call "%CMakeUnpackPath%\autorebase.bat" +call "%MSYS2UnpackPath%\autorebase.bat" :exit endlocal diff --git a/build_scripts/Windows/env/tools/prepare-tools.bat b/build_scripts/Windows/env/tools/prepare-tools.bat index 189ac73cd..88549faed 100644 --- a/build_scripts/Windows/env/tools/prepare-tools.bat +++ b/build_scripts/Windows/env/tools/prepare-tools.bat @@ -53,7 +53,7 @@ if not exist "%EnvToolsPath%\cecho.exe" ( if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error echo Unpack cecho - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0 copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" @@ -69,7 +69,7 @@ if not exist "%EnvToolsPath%\depends.exe" ( if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error %cecho% info "Unpack Dependency Walker" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" -y -bso0 copy "%EnvTempPath%\*" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" @@ -85,7 +85,7 @@ if not exist "%EnvToolsPath%\cut.exe" ( if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error %cecho% info "Unpack Unix Tools" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0 copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" @@ -101,7 +101,7 @@ if not exist "%EnvToolsPath%\sed.exe" ( if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error %cecho% info "Unpack Unix Tools" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0 copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" @@ -121,7 +121,7 @@ if not exist "%NSISInstallPath%\nsis.exe" ( if not exist "%EnvDownloadPath%\%NSISInstall%" %cecho% error "Cannot download NSIS installation" & goto error %cecho% info "Unpack NSIS" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" -y -bso0 if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%" xcopy /s "%EnvTempPath%" "%NSISInstallPath%" @@ -135,7 +135,7 @@ if not exist "%MinGitInstallPath%\cmd\git.exe" ( if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error %cecho% info "Unpack MinGit" - "%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%" + "%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%" -y -bso0 ) if not exist "%EnvDownloadPath%\%DoxygenInstall%" call "%ToolsPath%\remove-dir.bat" "%DoxygenInstallPath%" @@ -148,7 +148,7 @@ if not exist "%DoxygenInstallPath%\doxygen.exe" ( if not exist "%EnvDownloadPath%\%DoxygenInstall%" %cecho% error "Cannot download doxygen installation" & goto error %cecho% info "Unpack Doxygen" - "%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%" + "%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%" -y -bso0 ) if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\remove-dir.bat" "%CMakeInstallPath%" @@ -163,7 +163,7 @@ if not exist "%CMakeInstallPath%\bin\cmake.exe" ( if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake installation" & goto error %cecho% info "Unpack CMake" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0 move "%EnvTempPath%\%CMakeVersion%" "%CMakeInstallPath%" @@ -189,7 +189,7 @@ if not exist "%EnvTorPath%\Tor\tor.exe" ( if not exist "%EnvDownloadPath%\%TorInstall%" %cecho% error "Cannot download Tor installation" & goto error %cecho% info "Unpack Tor" - "%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%" + "%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%" -y -bso0 ) :exit