#!/bin/bash

#
# This sets up the environment for using MingW32
#

# These are kind of assumed:
#   sudo apt-get install mingw32
#   sudo apt-get install wine

# Basic instructions from here:
#   http://retroshare.sourceforge.net/wiki/index.php/Ubuntu_cross_compilation_for_Windows

# cp -Rf /usr/share/qt4/mkspecs/win32-g++ win32-x-g++
wget http://download.qt.io/archive/qt/4.5/qt-win-opensource-4.5.3-mingw.exe
sudo mkdir /usr/local/qt-4.5.3-win32
sudo chmod a+rwx /usr/local/qt-4.5.3-win32
echo "When prompted, choose /usr/local/qt-4.5.3-win32 as the directory to install in to"
echo "No need to install MingW"
read
wine qt-win-opensource-4.5.3-mingw.exe
sudo chmod -R a-w /usr/local/qt-4.5.3-win32

# Prepare a bin folder with required binaries
mkdir bin
cp /usr/local/qt-4.5.3-win32/bin/Qt4Core.dll bin
cp /usr/local/qt-4.5.3-win32/bin/Qt4Gui.dll bin
mv qt-win-opensource-4.5.3-mingw.exe bin
cp /usr/share/doc/mingw32-runtime/mingwm10.dll.gz bin
gunzip bin/mingwm10.dll.gz


