Building gdbm 1.8.3 for Win32 using MSYS / MINGW (under Wine)

Binary builds of gdbm (ndbm compatible) for win32 deveopers are hard to
come by.  You can download gdbm 1.8.3 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 dlls need work, but
the static libraries are fine and tested: remember to add -DUSE_GDBM_STATIC
to any applications that use the static libraries: see testgdbms.exe
in the Makefile for an example.

What's included

A build and source code of gdbm 1.8.3 which is also ndbm compatible.
Pre-compiled static libraries.  Binaries.  DLL.

Caveats

The DLLs appear to be unhappy.  I have what I need (the static libraries)
and, also, there are other sources of gdbm DLLs available, so am not going
to be spending time fixing this.

I successfully compiled gdbm 1.8.3 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"

Modified for stand-alone build, from original GnuWin32

The source for gdbm originally came from GnuWin32 gdbm package.
Unlike the builds of bzip2, sqlite3 and zlib, this one was tricky.

Firstly, there is reliance on libgw32c, which is a cut-down version of
glibc.  There were two functions required from it: flock() and link().

Secondly, libtool runs like an absolute dog under MSYS, so it had to go.

Thirdly, gdbm_reorganise() relied on rename() succeeding on a Win32
platform when the new file and the old file were still open.
This Doesn't Happen.  The rename procedure was reorganised a bit, to
move the original file out the way, move the new file to the original
filename, and then finally, after syncing the new file to disk,
remove the temporary file.

How to build

1) Get the source (above)

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

Congratulations and hurrah.