summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott <[email protected]>2016-05-04 19:37:18 +0100
committerScott <[email protected]>2016-05-04 19:37:18 +0100
commitf76fc09f834b24cb43144c56ababa13b4367306a (patch)
treef25558b1853fae6363942a12e3667ba172af3113
parent6ae6fbcfd10b36f635e27c8f1f3dff6f9deed2a1 (diff)
parentbd552fd74916c30717f0ec1353b28fab55ba3077 (diff)
Merge pull request #179 from bradleysepos/toolchain
scripts: Add script to install prebuilt MinGW on Linux.
-rwxr-xr-xscripts/mingw-install-prebuilt.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/mingw-install-prebuilt.sh b/scripts/mingw-install-prebuilt.sh
new file mode 100755
index 000000000..4d7485508
--- /dev/null
+++ b/scripts/mingw-install-prebuilt.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# usage: mingw-install-prebuilt [install-dir]
+
+function mingw-install-prebuilt()
+{
+ local TC_PARAM TC_DIR MINGW_DIR MINGW_TAR MINGW_URL MINGW_MD5 LAS LA
+
+ TC_PARAM="${1}"
+ TC_DIR="${HOME}/toolchains"
+ if [[ "${TC_PARAM:=}" != "" ]]; then
+ TC_DIR="${TC_PARAM}"
+ fi
+
+ MINGW_DIR="mingw-w64-x86_64"
+ MINGW_TAR="mingw-w64-bin_x86_64-linux_20131228.tar.bz2"
+ MINGW_URL="http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/${MINGW_TAR}"
+ MINGW_MD5="17669566433998307f894d3476fcdc48"
+
+ if [[ -e "${TC_DIR}/${MINGW_DIR}" ]]; then
+ echo "directory exists: ${TC_DIR}/${MINGW_DIR}" >&2
+ exit 1
+ fi
+ mkdir -p "${TC_DIR}/${MINGW_DIR}"
+ cd "${TC_DIR}"
+ TC_DIR="$(pwd)"
+
+ if [[ ! -e "${MINGW_TAR}" ]] || [[ "$(md5sum ${MINGW_TAR} | awk '{ print $1 }')" != "${MINGW_MD5}" ]]; then
+ rm -f "${MINGW_TAR}"
+ wget "${MINGW_URL}"
+ fi
+ cd "${MINGW_DIR}"
+ tar -xf "../${MINGW_TAR}"
+
+ LAS=$(find . -type f -name \*.la)
+ for LA in ${LAS[@]}; do
+ sed -i \
+ -e "s;/home/mingw-w64/mingw-w64/linux-x86_64-x86_64/build/build/root/mingw/lib;${TC_DIR}/${MINGW_DIR}/mingw/lib;" \
+ -e "s;/home/mingw-w64/mingw-w64/linux-x86_64-x86_64/build/build/root/lib;${TC_DIR}/${MINGW_DIR}/lib;" \
+ -e "s;/home/mingw-w64/mingw-w64/linux-x86_64-x86_64/build/build/root/x86_64-w64-mingw32/lib;${TC_DIR}/${MINGW_DIR}/x86_64-w64-mingw32/lib;" \
+ "${LA}"
+ done
+
+ echo "export PATH=\${PATH}:${TC_DIR}/${MINGW_DIR}/bin" >> ~/.bashrc
+
+ return 0
+}
+
+mingw-install-prebuilt "$@"