From bfb244cf5021ad7c6b59e58add34136bf1672b0a Mon Sep 17 00:00:00 2001 From: brickviking Date: Sun, 11 Sep 2022 20:28:41 +1200 Subject: [PATCH 1/7] Work around missing CHOICE.EXE --- setup_win.cmd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup_win.cmd b/setup_win.cmd index da7c731b2..f8b705df6 100644 --- a/setup_win.cmd +++ b/setup_win.cmd @@ -55,8 +55,12 @@ rem ) reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && goto chose32 || goto choose :choose -choice /c 12 /M "Use (1) 64-bit or (2) 32-bit MINGW? " -if errorlevel == 1 goto chose64 +if not exist %SystemRoot%\system32\choice.exe ( + set /p errorlevel="Use (1) 64-bit or (2) 32-bit MINGW? " +) else ( + choice /c 12 /M "Use (1) 64-bit or (2) 32-bit MINGW? " +) +if errorlevel 1 goto chose64 goto chose32 :chose32 From a568095ad0fc1b043af36ab7b03f3907ad6d2b29 Mon Sep 17 00:00:00 2001 From: brickviking Date: Sun, 11 Sep 2022 20:29:03 +1200 Subject: [PATCH 2/7] Check if we downloaded curl previously --- findcurl.cmd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/findcurl.cmd b/findcurl.cmd index 54673b32e..9dd0b0d73 100755 --- a/findcurl.cmd +++ b/findcurl.cmd @@ -16,13 +16,17 @@ curl --version 2>NUL 1>&2 if %ERRORLEVEL == 9009 ( +rem check if we have it already + if exist internal\curl\curl.exe goto gotcurl mkdir internal\curl >NUL echo Fetching %LINK% explorer %LINK% - rem we should wait until the file is downloaded, because explorer returns straight away +:keeptesting + rem sleep 5 - we need to find something that'll work on XP, as timeout doesn't exist + rem if not exist "%USERPROFILE%\Desktop\%CURLVERSION%" goto keeptesting "%SystemRoot%\system32\expand.exe" "%USERPROFILE%\Desktop\%CURLVERSION%" /F:%ARCH%\* internal\curl - +:gotcurl rem Add to path PATH=%PATH%;%~dp0\internal\curl ) ELSE ( From 24f1893c396ee7db0e5079175321c22e3bac5442 Mon Sep 17 00:00:00 2001 From: brickviking Date: Mon, 12 Sep 2022 18:10:37 +1200 Subject: [PATCH 3/7] Correcting variable test --- findcurl.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/findcurl.cmd b/findcurl.cmd index 9dd0b0d73..6e63066e1 100755 --- a/findcurl.cmd +++ b/findcurl.cmd @@ -15,7 +15,7 @@ rem Check if curl exists curl --version 2>NUL 1>&2 -if %ERRORLEVEL == 9009 ( +if %ERRORLEVEL% == 9009 ( rem check if we have it already if exist internal\curl\curl.exe goto gotcurl mkdir internal\curl >NUL From 3fead708b4be706d8f0fc47cc9917a4bc9187dec Mon Sep 17 00:00:00 2001 From: brickviking Date: Mon, 12 Sep 2022 21:47:32 +1200 Subject: [PATCH 4/7] Checking if user has 7zip already --- setup_win.cmd | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/setup_win.cmd b/setup_win.cmd index f8b705df6..8b436d169 100644 --- a/setup_win.cmd +++ b/setup_win.cmd @@ -78,18 +78,28 @@ goto chosen echo Downloading %url%... curl -L %url% -o temp.7z -echo Downloading 7zr.exe... -curl -L https://www.7-zip.org/a/7zr.exe -o 7zr.exe +echo Testing for 7zip +7z >NUL 2>&1 -echo Extracting C++ Compiler... -7zr.exe x temp.7z -y +if ERRORLEVEL 9009 ( + + echo Downloading 7zr.exe... + curl -L https://www.7-zip.org/a/7zr.exe -o 7zr.exe + + echo Extracting C++ Compiler... + 7zr.exe x temp.7z -y +) else ( + echo Extracting C++ Compiler... + 7z x temp.7z -y +) echo Moving C++ compiler... for /f %%a in ('dir %MINGW% /b') do move /y "%MINGW%\%%a" internal\c\c_compiler\ echo Cleaning up.. rd %MINGW% -del 7zr.exe +if exist 7zr.exe del 7zr.exe + del temp.7z :skipccompsetup From fcc61cc7229c4af7f5cdf40345d7a950053f15cb Mon Sep 17 00:00:00 2001 From: brickviking Date: Mon, 12 Sep 2022 23:35:27 +1200 Subject: [PATCH 5/7] Checking Windows version If we're running on XP, add the insecure switch to curl You may also need this for Vista --- setup_win.cmd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup_win.cmd b/setup_win.cmd index 8b436d169..2afaf78d1 100644 --- a/setup_win.cmd +++ b/setup_win.cmd @@ -84,7 +84,13 @@ echo Testing for 7zip if ERRORLEVEL 9009 ( echo Downloading 7zr.exe... - curl -L https://www.7-zip.org/a/7zr.exe -o 7zr.exe + rem Check for XP (either 32-bit or 64-bit) + ver | findstr /R /C:"Version 5.[12]" + if errorlevel 0 ( + curl -Lk https://www.7-zip.org/a/7zr.exe -o 7zr.exe + ) else ( + curl -L https://www.7-zip.org/a/7zr.exe -o 7zr.exe + ) echo Extracting C++ Compiler... 7zr.exe x temp.7z -y From 319fc322ee4bb12f5ec247d44a92e73d1658b8da Mon Sep 17 00:00:00 2001 From: Brickviking Date: Sat, 17 Sep 2022 22:26:46 +1200 Subject: [PATCH 6/7] Reprodding CI build Minimal change just to get Github's CI to pass a build. Signed-off-by: Brickviking --- setup_win.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup_win.cmd b/setup_win.cmd index 2afaf78d1..bcce64b12 100644 --- a/setup_win.cmd +++ b/setup_win.cmd @@ -56,9 +56,9 @@ reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" :choose if not exist %SystemRoot%\system32\choice.exe ( - set /p errorlevel="Use (1) 64-bit or (2) 32-bit MINGW? " + set /p errorlevel="Install (1) 64-bit or (2) 32-bit MINGW? " ) else ( - choice /c 12 /M "Use (1) 64-bit or (2) 32-bit MINGW? " + choice /c 12 /M "Download (1) 64-bit or (2) 32-bit MINGW? " ) if errorlevel 1 goto chose64 goto chose32 From 97be38ec96d6851ccb64eeb875ffe0cd6b8c09ab Mon Sep 17 00:00:00 2001 From: brickviking Date: Tue, 27 Sep 2022 16:17:41 +1300 Subject: [PATCH 7/7] Correcting text to be the same as above string --- setup_win.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup_win.cmd b/setup_win.cmd index bcce64b12..4027f726c 100644 --- a/setup_win.cmd +++ b/setup_win.cmd @@ -58,7 +58,7 @@ reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" if not exist %SystemRoot%\system32\choice.exe ( set /p errorlevel="Install (1) 64-bit or (2) 32-bit MINGW? " ) else ( - choice /c 12 /M "Download (1) 64-bit or (2) 32-bit MINGW? " + choice /c 12 /M "Install (1) 64-bit or (2) 32-bit MINGW? " ) if errorlevel 1 goto chose64 goto chose32