Skip to content

Commit 45e047f

Browse files
committed
scripts: Rework Windows setup script for restructured bundle
This commit reworks the Windows Zephyr SDK distribution bundle setup script to work with the restructured distribution bundle. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 54fa30e commit 45e047f

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

scripts/template_setup_win

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ exit /b 0
2323

2424
:entry
2525

26-
REM # Initialise toolchain list
27-
set TOOLCHAINS=
28-
for /f %%t in (sdk_toolchains) do (
29-
set TOOLCHAINS=!TOOLCHAINS! %%t
26+
REM # Initialise GNU toolchain list
27+
set GNU_TOOLCHAINS=
28+
for /f %%t in (sdk_gnu_toolchains) do (
29+
set GNU_TOOLCHAINS=!GNU_TOOLCHAINS! %%t
3030
)
3131

32-
REM Initialise list of toolchains to install
33-
set INST_TOOLCHAINS=
32+
REM Initialise list of GNU toolchains to install
33+
set INST_GNU_TOOLCHAINS=
3434

3535
REM # Read bundle version from file
3636
set /p VERSION=<sdk_version
3737

3838
REM # Resolve release download base URI
3939
set DL_REL_BASE=https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v%VERSION%
40-
set DL_TOOLCHAIN_FILENAME=toolchain_windows-x86_64_%%t.7z
40+
set DL_GNU_TOOLCHAIN_FILENAME=toolchain_gnu_windows-x86_64_%%t.7z
4141

4242
REM # Print banner
4343
echo Zephyr SDK %VERSION% Setup
@@ -66,14 +66,14 @@ REM # Parse arguments if specified
6666
:parsearg
6767
if /i [%1] equ [/t] (
6868
if [%2] equ [all] (
69-
set INST_TOOLCHAINS=%TOOLCHAINS%
69+
set INST_GNU_TOOLCHAINS=%GNU_TOOLCHAINS%
7070
) else (
7171
set IS_VALID=
72-
for %%t in (%TOOLCHAINS%) do if [%%t] equ [%2] set IS_VALID=y
72+
for %%t in (%GNU_TOOLCHAINS%) do if [%%t] equ [%2] set IS_VALID=y
7373
if [!IS_VALID!] equ [y] (
74-
set INST_TOOLCHAINS=!INST_TOOLCHAINS! %2
74+
set INST_GNU_TOOLCHAINS=!INST_GNU_TOOLCHAINS! %2
7575
) else (
76-
echo ERROR: Unknown toolchain '%2'
76+
echo ERROR: Unknown GNU toolchain '%2'
7777
set EXITCODE=2
7878
goto end
7979
)
@@ -102,23 +102,23 @@ echo distribution bundle archive.
102102
echo.
103103

104104
REM # Check installation type
105-
for %%t in (%TOOLCHAINS%) do (
106-
if not exist %%t\ (
105+
for %%t in (%GNU_TOOLCHAINS%) do (
106+
if not exist gnu\%%t\ (
107107
set IS_PARTIAL_SDK=y
108108
)
109109
)
110110

111111
REM # Ask user for set-up choices
112112
if [%IS_PARTIAL_SDK%] neq [] (
113-
choice /c:yn /m:"Install toolchains for all targets"
113+
choice /c:yn /m:"Install GNU toolchains for all targets"
114114
if [!ERRORLEVEL!] equ [1] (
115-
set INST_TOOLCHAINS=%TOOLCHAINS%
115+
set INST_GNU_TOOLCHAINS=%GNU_TOOLCHAINS%
116116
) else (
117-
for %%t in (%TOOLCHAINS%) do (
118-
if not exist %%t\ (
119-
choice /c:yn /m:"Install '%%t' toolchain"
117+
for %%t in (%GNU_TOOLCHAINS%) do (
118+
if not exist gnu\%%t\ (
119+
choice /c:yn /m:"Install '%%t' GNU toolchain"
120120
if [!ERRORLEVEL!] equ [1] (
121-
set INST_TOOLCHAINS=!INST_TOOLCHAINS! %%t
121+
set INST_GNU_TOOLCHAINS=!INST_GNU_TOOLCHAINS! %%t
122122
)
123123
)
124124
)
@@ -134,27 +134,30 @@ if [%ERRORLEVEL%] equ [1] set DO_CMAKE_PKG=y
134134
echo.
135135

136136
:process
137-
REM # Install toolchains
138-
for %%t in (%INST_TOOLCHAINS%) do (
139-
set TOOLCHAIN_FILENAME=%DL_TOOLCHAIN_FILENAME%
137+
REM # Install GNU toolchains
138+
if not exist gnu\ mkdir gnu
139+
pushd gnu
140+
141+
for %%t in (%INST_GNU_TOOLCHAINS%) do (
142+
set TOOLCHAIN_FILENAME=%DL_GNU_TOOLCHAIN_FILENAME%
140143
set TOOLCHAIN_URI=%DL_REL_BASE%/!TOOLCHAIN_FILENAME!
141144

142145
if not exist %%t\ (
143-
echo Installing '%%t' toolchain ...
146+
echo Installing '%%t' GNU toolchain ...
144147

145148
REM # Download toolchain archive
146149
wget -q --show-progress -N -O !TOOLCHAIN_FILENAME! !TOOLCHAIN_URI!
147150
if [!ERRORLEVEL!] neq [0] (
148151
del /q !TOOLCHAIN_FILENAME!
149-
echo ERROR: Toolchain download failed
152+
echo ERROR: GNU toolchain download failed
150153
set EXITCODE=20
151154
goto end
152155
)
153156

154157
REM # Extract archive
155158
7z x -o. !TOOLCHAIN_FILENAME!
156159
if [!ERRORLEVEL!] neq [0] (
157-
echo ERROR: Toolchain archive extraction failed
160+
echo ERROR: GNU toolchain archive extraction failed
158161
set EXITCODE=21
159162
goto end
160163
)
@@ -163,6 +166,7 @@ for %%t in (%INST_TOOLCHAINS%) do (
163166
del /q !TOOLCHAIN_FILENAME!
164167
)
165168
)
169+
popd
166170

167171
REM # Install host tools
168172
if [%DO_HOSTTOOLS%] neq [] (
@@ -187,16 +191,16 @@ goto end
187191

188192
REM # Print scripting mode usage
189193
:usage
190-
echo %~n0 [/t ^<toolchain^>] [/h] [/c]
194+
echo %~n0 [/t ^<gnu_toolchain^>] [/h] [/c]
191195
echo.
192-
echo /t ^<toolchain^> Install specified toolchain
193-
echo all Install all toolchains
194-
echo /h Install host tools
195-
echo /c Register Zephyr SDK CMake package
196+
echo /t ^<gnu_toolchain^> Install specified GNU toolchain
197+
echo all Install all GNU toolchains
198+
echo /h Install host tools
199+
echo /c Register Zephyr SDK CMake package
196200
echo.
197-
echo Supported Toolchains:
201+
echo Supported GNU Toolchains:
198202
echo.
199-
for %%t in (%TOOLCHAINS%) do (
203+
for %%t in (%GNU_TOOLCHAINS%) do (
200204
echo %%t
201205
)
202206
echo.

0 commit comments

Comments
 (0)