Building bzip2 1.0.5 for Win32 using MSYS / MINGW (under Wine)

Binary builds of bzip2 for win32 deveopers are hard to come by.  You can
download bzip2 1.0.5 for win32 here or you can try building it yourself.
Included in the download is the libraries and header files, as well as
the binaries and the dll, for developers.  The build process has been
re-patched so that the DLL produced compiles to "__stdcall" format for its
exports (whereas the GNUWin32-compiled version has had __stdcall removed).
If the static library is sufficient for your needs, then this is obviously
of no interest to you, but if you would like a non-stdcall build, then
either download the GNUWin32 version of bzip2.dll, or read on.

I successfully compiled bzip 1.0.5 using MSYS and MinGW running under Wine,
the Windows Emulator, but the process will work equally as well on "Native"
Win32 platforms.

The only gotcha that a Wine user has to watch out for is to add a DLLOverride
for msvcrt, and to use the "native" MSVCRT.DLL, because windres.exe will
not work due to bugs in Wine at the time of writing (1.1.13 and probably
slightly beyond).

Manually add this to user.reg (exit all wine apps first) if you find that
winecfg is being a pain and crashes when you add a new dlloverride app:

[Software\\Wine\\AppDefaults\\windres.exe\\DllOverrides] 1232063734
"msvcrt"="native"

If you want to build yourself, download the GNUWin32-modified version of bzip2.
it contains the Makefile _almost_ ready to go:
bzip2-src-zip

Then, apply the following patch: bzip2-1.0.5-patch.
What this will get you is no need to install o2dll from GNUWin32, and it
will also get you __stdcall format back for DLL exports.  If you don't want
this, edit bzlib.h and remove __stdcall:
-#define BZ_API(func) func
+#define BZ_API(func) __stdcall func

You've downloaded MSYS and MinGW - simply type make, and then
make install PREFIX=/mingw

Congratulations and hurrah.