3 # win_sdk_install.sh - Windows toolchain install script.
4 # Copyright (c) 2013, The OpenPilot Team, http://www.openpilot.org
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # This script should be launched from git bash prompt. It assumes MSYS
22 # environment and expects path names in the form of /C/some/path, where
23 # C is a drive letter, and paths are in MSYS format. It probably won't
25 SCRIPT_PATH
="`echo "$BASH_SOURCE" | sed 's|\\\\|/|g; s|^\(.\):|/\1|'`"
26 SCRIPT_NAME
="`basename \"$SCRIPT_PATH\"`"
27 SCRIPT_DIR
="`dirname \"$SCRIPT_PATH\"`"
28 ROOT_DIR
="`pushd \"$SCRIPT_DIR/../..\" >/dev/null && pwd && popd >/dev/null`"
29 TOOLS_DIR
="$ROOT_DIR/tools"
35 WGET_URL
="http://wiki.openpilot.org/download/attachments/18612236/wget.exe"
36 MAKE_URL
="http://wiki.openpilot.org/download/attachments/18612236/make.exe"
37 SEVENZIP_URL
="http://wiki.openpilot.org/download/attachments/18612236/7za.exe"
39 # Expected tools paths
40 WGET
="$TOOLS_DIR/bin/`basename \"$WGET_URL\"`"
41 MAKE
="$TOOLS_DIR/bin/`basename \"$MAKE_URL\"`"
42 SEVENZIP
="$TOOLS_DIR/bin/`basename \"$SEVENZIP_URL\"`"
44 # wget is necessary to fetch other files
45 WGET_NAME
="`basename \"$WGET\"`"
46 if [ ! -x "$WGET" ]; then
47 echo "$SCRIPT_NAME: $WGET_NAME not found, fetching from $WGET_URL"
48 mkdir
-p "`dirname \"$WGET\"`"
50 VBSCRIPT
="$TOOLS_DIR/fetch.$$.vbs"
51 cat >"$VBSCRIPT" <<-EOF
52 url = WScript.Arguments.Item(0)
53 file = WScript.Arguments.Item(1)
55 Dim xHttp: Set xHttp = CreateObject("MSXML2.ServerXMLHTTP")
56 xHttp.Open "GET", url, False
57 xHttp.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
60 If xHttp.Status = 200 Then
61 Dim bStrm: Set bStrm = CreateObject("AdoDb.Stream")
65 .Write xHttp.ResponseBody
66 .SaveToFile file, 2 '// overwrite
75 cscript
"$VBSCRIPT" "$WGET_URL" "$WGET"
79 if [ $rc -ne 0 ]; then
80 echo "$SCRIPT_NAME: $WGET_NAME fetch error, hope it's in the path..."
85 # make is necessary to fetch all SDKs
86 if [ ! -x "$MAKE" ]; then
87 echo "$SCRIPT_NAME: $MAKE_NAME not found, fetching from $MAKE_URL"
88 MAKE_DIR
="`dirname \"$MAKE\"`"
90 $WGET -N --content-disposition -P "$MAKE_DIR" "$MAKE_URL"
92 echo "$SCRIPT_NAME: $MAKE_NAME fetch error, hope it's in the path..."
93 MAKE_NAME
="`basename \"$MAKE\"`"
98 # 7-Zip is necessary to install some SDKs
99 if [ ! -x "$SEVENZIP" ]; then
100 echo "$SCRIPT_NAME: $SEVENZIP_NAME not found, fetching from $SEVENZIP_URL"
101 SEVENZIP_DIR
="`dirname \"$SEVENZIP\"`"
102 mkdir
-p "$SEVENZIP_DIR"
103 $WGET -N --content-disposition -P "$SEVENZIP_DIR" "$SEVENZIP_URL"
104 if [ $?
-ne 0 ]; then
105 echo "$SCRIPT_NAME: $SEVENZIP_NAME fetch error, hope it's in the path..."
106 SEVENZIP_NAME
="`basename \"$SEVENZIP\"`"
107 SEVENZIP
="$SEVENZIP_NAME"
111 # Finally we can fetch all SDKs using top level Makefile
113 echo "Run 'tools/bin/make all_sdk_install' to install the other tools"
114 echo " or 'tools/bin/make help' for more info on make targets"