Patch for windows

This patch is inspired by https://github.com/bitcoin/bitcoin
and https://github.com/zalanyib/leveldb-mingw