This page lists a script that I have used successfully to download and compile openssl. The script was extracted from Paul Kulchenko's Zerobrane Studio project build script for windows linked here.
The script is:
# In its current form this script generated the dlls successfully (Ran it from the msys console C:\mingw\msys\1.0\msys.bat)
# run this using the bash shell
BIN_DIR="$(dirname "$PWD")/bin"
# temporary installation directory for dependencies