from dandev37:

Here's a step by step from a clean install to successfully setup MinGW and build
libusb-1.0 and stlink for MS Windows. Hopefully this helps someone.

1. Install MinGW and MSYS to C:\MinGW with the graphical installer from
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download
and add these packages:
mingw32-base
mingw-developer-toolkit

2. Add C:\MinGW\bin to your path.
Note: a user reports she had to use c:\MinGW\msys\1.0\bin

3. Create the C:\MinGW\msys\1.0\etc\fstab file to mount C:\MinGW as /mingw as per
http://www.mingw.org/wiki/MSYS:

#Win32_Path     Mount_Point
c:/mingw        /mingw

4. Download these three glib, pkg-config, pkg-config-dev archives and extract
contents to C:\MinGW
http://win32builder.gnome.org/packages/3.6/glib_2.34.3-1_win32.zip
http://win32builder.gnome.org/packages/3.6/pkg-config_0.28-1_win32.zip
http://win32builder.gnome.org/packages/3.6/pkg-config-dev_0.28-1_win32.zip

5. Download latest libusb-1.0 source from
https://github.com/libusb/libusb (newer repo, includes USB 3.0 hub support)
OR the old git://git.libusb.org/libusb.git (original repo, NO USB 3.0 support)
and build (prefix as per http://www.mingw.org/wiki/MSYS)

./autogen.sh
./configure --prefix=/mingw
make
make install

6. Repeat for stlink source from https://github.com/texane/stlink

./autogen.sh
./configure --prefix=/mingw
make
make install

7. Enjoy the fruits of the stlink developers.
