+# Abort if the user runs the script in an "MSYS2 MSYS" shell.
+if [ $MSYSTEM = "MSYS" ]; then
+ echo "Building in an 'MSYS2 MSYS' shell will not work, aborting."
+ echo "Please use the 'MSYS2 MinGW 64-bit' (or 32-bit) shell."
+ exit
+fi
+
+# The build target type: "i686" (32bit) or "x86_64" (64bit).
+# This is selected based on which MSYS2 shell is being used to do the build.
+TARGET=$MSYSTEM_CARCH
+
+VER_SIGROK_FIRMWARE_FX2LAFW=0.1.6
+
+WGET="wget -c --quiet"
+GIT_CLONE="git clone --depth=1"
+
+REPO_BASE="git://sigrok.org"
+
+# Construct the build and install directory pathnames.
+if [ $TARGET = "i686" ]; then
+ SUFFIX="32"
+else
+ SUFFIX="64"
+fi
+if [ $DEBUG = 1 ]; then
+ # CFLAGS/CXXFLAGS contains "-g" per default for autotools projects.
+ BUILD_TYPE="Debug"
+ PREFIX=$PREFIXBASE"_debug_"$SUFFIX
+ BUILDDIR=$BUILDBASE"_debug_"$SUFFIX
+else
+ BUILD_TYPE="Release"
+ PREFIX=$PREFIXBASE"_release_"$SUFFIX
+ BUILDDIR=$BUILDBASE"_release_"$SUFFIX
+fi
+
+PYPATH=$PREFIX/$PYBASE
+
+# Eliminate the host Python path environment variable, if any is set.
+export PYTHONPATH=