Download the Windows compiler
We use this for building code to run on the driver's station.
Change-Id: I03cb907f67419e45a3a7204fa61ba2dd73b6687c
diff --git a/motors/pistol_grip/BUILD b/motors/pistol_grip/BUILD
index 0a24ba8..75cab98 100644
--- a/motors/pistol_grip/BUILD
+++ b/motors/pistol_grip/BUILD
@@ -80,6 +80,7 @@
output_to_bindir = True,
tools = [
"usb_forward_windows_build.sh",
+ "@mingw_compiler//:all_files",
],
)
diff --git a/motors/pistol_grip/usb_forward_windows_build.sh b/motors/pistol_grip/usb_forward_windows_build.sh
index 3f1022b..64a42d7 100755
--- a/motors/pistol_grip/usb_forward_windows_build.sh
+++ b/motors/pistol_grip/usb_forward_windows_build.sh
@@ -6,15 +6,6 @@
set -u
set -o pipefail
-check_installed() {
- if ! dpkg -l "$1" > /dev/null 2>&1 ; then
- echo "Must install $1" >&2
- exit 1
- fi
-}
-
-check_installed g++-mingw-w64-x86-64
-
readonly SOURCE_FILE="$1"
readonly LIBUSB_ARCHIVE="$2"
readonly OUTPUT="$3"
@@ -24,6 +15,12 @@
mkdir -p "${TEMP}/libusb"
tar xJf "${LIBUSB_ARCHIVE}" -C "${TEMP}/libusb"
+mkdir -p "${TEMP}/compiler_bin"
+ln -s $(readlink -f external/mingw_compiler/usr/bin/x86_64-w64-mingw32-as) "${TEMP}/compiler_bin/as"
+
+export LD_LIBRARY_PATH=external/mingw_compiler/usr/lib/x86_64-linux-gnu:external/mingw_compiler/lib/x86_64-linux-gnu:external/mingw_compiler/usr/lib
+export PATH=external/mingw_compiler/usr/bin:$PATH
+
x86_64-w64-mingw32-g++-posix \
--std=gnu++11 \
-D__USE_MINGW_ANSI_STDIO \
@@ -32,4 +29,5 @@
"${SOURCE_FILE}" \
-static -static-libgcc -static-libstdc++ \
-lws2_32 \
- -L "${TEMP}/libusb/MinGW64/static" -lusb-1.0
+ -L "${TEMP}/libusb/MinGW64/static" -lusb-1.0 \
+ -B"${TEMP}/compiler_bin"