*******************
** Install MinGW **
*******************

1.  Go to https://sourceforge.net/downloads/mingw
2.  Download and execute mingw-get-setup.exe
3.  Complete the installation wizard leaving default values

*********************
** Configure MinGW **
*********************

1.  Launch the MinGW Installation Manager
2.  Select Basic Setup on the left
3.  Mark the following packages for installation: mingw-developer-toolkit, mingw32-base, mingw-gcc-g++, and msys-base
4.  Select All Packages on the left
5.  Mark the following packages for installation: mingw32-pthreads-w32 (dev), mingw32-libpdcurses (dev), mingw32-pdcurses (bin), msys-libopenssl (dev)
6.  Click Installation > Apply Changes
7.  Click Apply
8.  Wait...
9.  Click Close
10. Close MinGW Installation Manager

************************
** MinGW Post-Install **
************************

1.  Check your Start menu for “MinGW Shell”
2.  If the shortcut exists, continue to the next section, otherwise:
3.  Navigate to C:\MinGW\msys\1.0\postinstall
4.  Run pi.bat & answer the questions
5.  Navigate to C:\MinGW\msys\1.0
6.  Right-click msys.bat and click Copy 
7.  Click the Start button
8.  Right-click All Programs and click Open
9.  Right-click on the opened folder and click “Paste shortcut”
10. Right-click the new shortcut and click Properties
11. On the General tab, rename the shortcut to “MinGW Shell”
12. On the Shortcut tab, change Start in to C:\MinGW\msys\1.0\bin
13. Click OK

******************************************
** Install YASM (optional - CPU mining) **
******************************************

1.  Visit http://yasm.tortall.net/Download.html
2.  Download the Win32 or Win64 .exe, depending on your version of Windows
3.  Rename the downloaded executable to yasm.exe
4.  Copy the executable to C:\MinGW\bin

********************
** Install uthash **
********************

1.  Visit http://troydhanson.github.io/uthash/
2.  Download the uthash-master.zip file
3.  Extract the contents of the uthash-master/src folder into C:\MinGW\include

******************************
** Install GTK+ for Windows **
******************************

1.  Visit http://sourceforge.net/projects/gtk-win/
2.  Download and execute the gtk2-runtime installer
3.  Complete the installation wizard leaving default values
4.  Copy libglib-2.0-0.dll from C:\Program Files\GTK2-Runtime\bin to C:\MinGW\bin

************************
** Install pkg-config **
************************

1.  Visit http://www.gtk.org/download/win32.php
2.  Search for a version of pkg-config that includes both the Tool and Dev downloads
3.  Click and download both the Tool link and the Dev link
4.  Open the pkg-config zip file and extract the bin folder to C:\MinGW
5.  Open the pkg-config-dev zip file and extract the share folder to C:\MinGW

*********************
** Install libcurl **
*********************

1.  Visit http://curl.haxx.se/download.html#Win32
2.  Look for the Win32 - Generic heading
3.  Download the link that indicates both *libcurl* (not just binary) and *SSL*
4.  Open the zip file and extract the lib, include, and bin folders to C:\MinGW
5.  Edit C:\MinGW\lib\pkgconfig\libcurl.pc
6.  Change "-lcurl" to "-lcurl -lcurldll"

************************
** Install libjansson **
************************

1.  Visit http://www.digip.org/jansson/releases/
2.  Download the latest .tar.gz file (not doc.tar.gz)
3.  Open the .tar.gz file and extract the jansson folder to C:\MinGW\msys\1.0\home\USER (where USER is your user name)
4.  Click Start and launch MinGW Shell
5.  Type the following (replace X.X with actual version):

	cd ~/jansson-X.X
	./configure --prefix=/MinGW
	make
	make check
	make install

********************
** Install libusb **
********************

1.  Visit http://git.libusb.org/?p=libusb.git;a=snapshot;h=master;sf=zip
2.  Download and open the resulting zip file
3.  Extract the libusb-master folder to C:\MinGW\msys\1.0\home\USER
4.  Return to the MinGW Shell
5.  Type the following (replace XYZ with actual identifier):

	cd ~/libusb-master-XYZ
	./autogen.sh --disable-debug-log --prefix=/MinGW
	make
	make install 

******************************************************
** Install libmicrohttpd (optional - Stratum Proxy) **
******************************************************

1.  Visit http://ftp.gnu.org/gnu/libmicrohttpd/
2.  Download the latest w32.zip file
3.  Open the zip file and extract the share, lib, include, and bin folders to C:\MinGW

*************************************************
** Install libevent (optional - Stratum Proxy) **
*************************************************

1.  Visit http://libevent.org/
2.  Download the latest stable.tar.gz file
3.  Open the .tar.gz file and extract the libevent-X.Y.Z-stable folder to C:\MinGW\msys\1.0\home\USER
4.  Return to the MinGW Shell
5.  Type the following (replace X.Y.Z with actual version):

	cd ~/libevent-X.Y.Z-stable
	./configure --disable-openssl --prefix=/MinGW
	make
	make install

*******************************************************
** Install HIDAPI (optional - Hashbuster & Nanofury) **
*******************************************************

1.  Visit https://github.com/signal11/hidapi
2.  Click Releases and download the latest zip file
3.  Open the zip file and extract the hidapi-hidapi folder to C:\MinGW\msys\1.0\home\USER
4.  Return to the MinGW Shell
5.  Type the following (replace X.Y.Z with actual version):

	cd ~/hidapi-hidapi-X.Y.Z
	./bootstrap
	./configure --prefix=/MinGW
	make
	make install

*****************
** Install Git **
*****************

1.  Visit http://git-scm.com/downloads
2.  Click the Download for Windows
3.  Run the resulting installer once downloaded
4.  Complete the installation wizard leaving default values

****************************
** Configure Git in MinGW **
****************************

1.  Navigate to C:\MinGW\msys\1.0\home\USER
2.  Create a new text file with Notepad called profile.txt with the contents:

PATH=$PATH:/c/Program\ Files/Git/bin

3.  Return to the MinGW Shell
4.  Type the following:

	mv ~/profile.txt ~/.profile

5.  Restart the MinGW Shell

******************
** OS Header(s) **
******************

1.  Navigate to C:\MinGW\include
2.  Use Notepad to create a new file called mstcpip.h (not .txt) with the contents:

struct tcp_keepalive
{
    u_long onoff;
    u_long keepalivetime;
    u_long keepaliveinterval;
};

#ifndef USE_WS_PREFIX

#define SIO_KEEPALIVE_VALS    _WSAIOW(IOC_VENDOR, 4)

#else

#define WS_SIO_KEEPALIVE_VALS    _WSAIOW(WS_IOC_VENDOR, 4)

#endif

**********************
** Compile bfgminer **
**********************

1.  Return to the MinGW Shell
2.  Type the following:

	cd ~/
	git clone git://github.com/luke-jr/bfgminer.git
	cd bfgminer/
	./autogen.sh
	./configure
	make

* Note: see the README for bfgminer ./configure options

**********************
** Package Binaries **
**********************

Create a new folder anywhere and copy the following items there:

C:\MinGW\msys\1.0\home\USER\bfgminer

	bfgminer.exe
	bfgminer-rpc.exe
	COPYING
	LICENSE 
	README*

C:\MinGW\msys\1.0\home\USER\bfgminer\opencl

	*.cl

C:\MinGW\msys\1.0\home\USER\bfgminer\libblkmaker\.libs  

	libblkmaker-0.1-0.dll
	libblkmaker_jansson-0.1-0.dll

C:\MinGW\bin

	libcurl.dll
	libjansson-4.dll
	libmicrohttpd-10.dll
	libpdcursesw.dll
	pthreadGC2.dll
	libusb-1.0.dll
	libidn-11.dll
	libeay32.dll
	ssleay32.dll
	libgcc_s_dw2-1.dll
	libgnutls-28.dll
	libgcrypt-11.dll
	libplibc-1.dll
	libgmp.dll
	libintl-8.dll
	libgpg-error-0.dll
	libiconv-2.dll
	libevent-2-0-5.dll
	zlib1.dll

