Skip to content

Commit be94c5f

Browse files
committed
scripts: template_setup_posix: Use wget from host tools on macOS
The GNU Project does not distribute official binaries for wget on macOS, and obtaining trustworthy pre-compiled wget binary on macOS outside package managers can be difficult. This commit updates the POSIX setup script to use the wget executable included in the Zephyr SDK host tools to download the SDK components on macOS. Note that the system wget is still used on Linux because wget availability is not an issue on Linux. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 3a52bde commit be94c5f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

scripts/template_setup_posix

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,19 @@ echo
213213

214214
# Check dependencies
215215
check_command cmake 90
216-
check_command wget 91
216+
[[ "${host}" =~ ^linux-.* ]] && check_command wget 91
217+
218+
# Resolve wget binary path
219+
if [[ "${host}" =~ ^macos-.* ]]; then
220+
# Use wget from the SDK host tools on macOS
221+
wget=" \
222+
${PWD}/hosttools/opt/wget/bin/wget \
223+
--ca-certificate ${PWD}/hosttools/opt/wget/etc/ssl/cert.pem \
224+
"
225+
else
226+
# Use the system wget on Linux
227+
wget="wget"
228+
fi
217229

218230
# Ask for user inputs if no argument is specified
219231
if [ "${interactive}" = "y" ]; then
@@ -238,7 +250,7 @@ if [ "${do_gnu_toolchain}" = "y" ]; then
238250
echo "Installing '${toolchain}' GNU toolchain ..."
239251

240252
# Download toolchain archive
241-
wget -q --show-progress -N -O "${toolchain_filename}" "${toolchain_uri}"
253+
${wget} -q --show-progress -N -O "${toolchain_filename}" "${toolchain_uri}"
242254
if [ $? != 0 ]; then
243255
rm -f "${toolchain_filename}"
244256
echo "ERROR: GNU toolchain download failed"
@@ -265,7 +277,7 @@ if [ "${do_llvm_toolchain}" = "y" ] && [ ! -d "llvm" ]; then
265277
toolchain_uri="${dl_rel_base}/${toolchain_filename}"
266278

267279
# Download toolchain archive
268-
wget -q --show-progress -N -O "${toolchain_filename}" "${toolchain_uri}"
280+
${wget} -q --show-progress -N -O "${toolchain_filename}" "${toolchain_uri}"
269281
if [ $? != 0 ]; then
270282
rm -f "${toolchain_filename}"
271283
echo "ERROR: LLVM toolchain download failed"

0 commit comments

Comments
 (0)