Howto build openssl on Windows
This howto is for building the latest version of openssl (1.0.1) on the latest version of the Microsoft Windows Desktop operating system (Windows 7 64 bit) using the latest Microsoft compiler (Visual Studio 2011 beta), targeting the 32 bit architecture.
-
Get the latest package of git for windows (this includes perl which we need)
-
Open the Visual Studio 2011 Developer Command Prompt
-
Launch sh from git-msys (look for the your correct command by inspecting the Git bash link):
C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
-
Move to the folder where you have extracted the openssl source archive
cd cd Desktop/openssl-1.0.1/
-
Run autoconfig and prepare make files; ignore the prefix; the sample below only builds suffort for a few ciphers: aes md5 rc4 rsa sha mac md2
perl Configure VC-WIN32 -DOPENSSL_NO_HW no-asm no-static-engine no-bf no-cast no-des no-dh no-dsa no-mdc2 no-rc2 no-rc5 no-capieng --prefix=c:/some/openssl/dir
-
Create a shell script to emulate the ms/do_ms.bat batch file:
cat > ms/do_ms.sh perl util/mkfiles.pl >MINFO perl util/mk1mf.pl no-asm VC-WIN32 > ms/nt.mak perl util/mk1mf.pl dll no-asm VC-WIN32 > ms/ntdll.mak perl util/mkdef.pl 32 libeay > ms/libeay32.def perl util/mkdef.pl 32 ssleay > ms/ssleay32.def ^D
-
Launch the shell script you just created
ms/do_ms.sh
-
Build the static and dynamic libraries:
nmake -f ms/nt.mak
-
At the end of the process copy the include files openssl-1.0.1/inc32/openssl as openssl to your preferred include path, then copy the static library out32/libeay32.lib to your preferred library path.