improvements in building dependent libraries for Windows

In preparation for additional libraries being downloaded/compiled, a helper
function download_tarball was added and the downloading/extraction process
was made more robust in the build script.