Include progs.h directly in openssl.c instead of via apps.h
[openssl.git] / NOTES.WIN
1
2  NOTES FOR THE WINDOWS PLATFORMS
3  ===============================
4
5  [Notes for Windows CE can be found in INSTALL.WCE]
6
7  Requirement details for native (Visual C++) builds
8  --------------------------------------------------
9
10  - You need Perl.  We recommend ActiveState Perl, available from
11    http://www.activestate.com/ActivePerl.
12    You also need the perl module Text::Template, available on CPAN.
13    Please read README.PERL for more information.
14
15  - You need a C compiler.  OpenSSL has been tested to build with these:
16
17    * Visual C++
18
19  - Netwide Assembler, a.k.a. NASM, available from http://www.nasm.us,
20    is required if you intend to utilize assembler modules. Note that NASM
21    is the only supported assembler. The Microsoft provided assembler is NOT
22    supported.
23
24
25  Visual C++ (native Windows)
26  ---------------------------
27
28  Installation directories
29
30  The default installation directories are derived from environment
31  variables.
32
33  For VC-WIN32, the following defaults are use:
34
35      PREFIX:      %ProgramFiles(86)%\OpenSSL
36      OPENSSLDIR:  %CommonProgramFiles(86)%\SSL
37
38  For VC-WIN32, the following defaults are use:
39
40      PREFIX:      %ProgramW6432%\OpenSSL
41      OPENSSLDIR:  %CommonProgramW6432%\SSL
42
43  Should those environment variables not exist (on a pure Win32
44  installation for examples), these fallbacks are used:
45
46      PREFIX:      %ProgramFiles%\OpenSSL
47      OPENSSLDIR:  %CommonProgramFiles%\SSL
48
49
50  GNU C (Cygwin)
51  --------------
52
53  Cygwin implements a Posix/Unix runtime system (cygwin1.dll) on top of the
54  Windows subsystem and provides a bash shell and GNU tools environment.
55  Consequently, a make of OpenSSL with Cygwin is virtually identical to the
56  Unix procedure.
57
58  To build OpenSSL using Cygwin, you need to:
59
60  * Install Cygwin (see http://cygwin.com/)
61
62  * Install Cygwin Perl and ensure it is in the path. Recall that
63    as least 5.10.0 is required.
64
65  * Run the Cygwin bash shell
66
67  Apart from that, follow the Unix instructions in INSTALL.
68
69  NOTE: "make test" and normal file operations may fail in directories
70  mounted as text (i.e. mount -t c:\somewhere /home) due to Cygwin
71  stripping of carriage returns. To avoid this ensure that a binary
72  mount is used, e.g. mount -b c:\somewhere /home.
73
74  It is also possible to create "conventional" Windows binaries that use
75  the Microsoft C runtime system (msvcrt.dll or crtdll.dll) using MinGW
76  development add-on for Cygwin. MinGW is supported even as a standalone
77  setup as described in the following section. In the context you should
78  recognize that binaries targeting Cygwin itself are not interchangeable
79  with "conventional" Windows binaries you generate with/for MinGW.
80
81  GNU C (MinGW/MSYS)
82  ------------------
83
84  * Compiler and shell environment installation:
85
86    MinGW and MSYS are available from http://www.mingw.org/, both are
87    required. Run the installers and do whatever magic they say it takes
88    to start MSYS bash shell with GNU tools and matching Perl on its PATH.
89    "Matching Perl" refers to chosen "shell environment", i.e. if built
90    under MSYS, then Perl compiled for MSYS is highly recommended.
91
92    Alternativelly, one can use MSYS2 from http://msys2.github.io/,
93    which includes MingW (32-bit and 64-bit).
94
95  * It is also possible to cross-compile it on Linux by configuring
96    with './Configure --cross-compile-prefix=i386-mingw32- mingw ...'.
97    Other possible cross compile prefixes include x86_64-w64-mingw32-
98    and i686-w64-mingw32-.
99
100
101  "Classic" builds (Visual C++)
102  ----------------
103
104  [OpenSSL was classically built using a script called mk1mf.  This is
105   still available by configuring with --classic.  The notes below are
106   using this flag, and are tentative.  Use with care.
107
108   NOTE: this won't be available for long.]
109
110  If you want to compile in the assembly language routines with Visual
111  C++, then you will need the Netwide Assembler binary, nasmw.exe or nasm.exe, to
112  be available on your %PATH%.
113
114  Firstly you should run Configure and generate the Makefiles. If you don't want
115  the assembly language files then add the "no-asm" option (without quotes) to
116  the Configure lines below.
117
118  For Win32:
119
120  > perl Configure VC-WIN32 --classic --prefix=c:\some\openssl\dir
121  > ms\do_nasm
122
123  Note: replace the last line above with the following if not using the assembly
124  language files:
125
126  > ms\do_ms
127
128  For Win64/x64:
129
130  > perl Configure VC-WIN64A --classic --prefix=c:\some\openssl\dir
131  > ms\do_win64a
132
133  For Win64/IA64:
134
135  > perl Configure VC-WIN64I --classic --prefix=c:\some\openssl\dir
136  > ms\do_win64i
137
138  Where the prefix argument specifies where OpenSSL will be installed to.
139
140  Then from the VC++ environment at a prompt do the following. Note, your %PATH%
141  and other environment variables should be set up for 32-bit or 64-bit
142  development as appropriate.
143
144  > nmake -f ms\ntdll.mak
145
146  If all is well it should compile and you will have some DLLs and
147  executables in out32dll. If you want to try the tests then do:
148
149  > nmake -f ms\ntdll.mak test
150
151  To install OpenSSL to the specified location do:
152
153  > nmake -f ms\ntdll.mak install
154
155  Tweaks:
156
157  There are various changes you can make to the Windows compile
158  environment. By default the library is not compiled with debugging
159  symbols. If you add --debug to the Configure lines above then debugging symbols
160  will be compiled in.
161
162  By default in 1.1.0 OpenSSL will compile builtin ENGINES into separate shared
163  libraries. If you specify the "enable-static-engine" option on the command line
164  to Configure the shared library build (ms\ntdll.mak) will compile the engines
165  into libcrypto32.dll instead.
166
167  You can also build a static version of the library using the Makefile
168  ms\nt.mak
169
170  Linking your application
171  ------------------------
172
173  This section applies to non-Cygwin builds.
174
175  If you link with static OpenSSL libraries then you're expected to
176  additionally link your application with WS2_32.LIB, ADVAPI32.LIB,
177  GDI32.LIB and USER32.LIB. Those developing non-interactive service
178  applications might feel concerned about linking with the latter two,
179  as they are justly associated with interactive desktop, which is not
180  available to service processes. The toolkit is designed to detect in
181  which context it's currently executed, GUI, console app or service,
182  and act accordingly, namely whether or not to actually make GUI calls.
183  Additionally those who wish to /DELAYLOAD:GDI32.DLL and /DELAYLOAD:USER32.DLL
184  and actually keep them off service process should consider
185  implementing and exporting from .exe image in question own
186  _OPENSSL_isservice not relying on USER32.DLL.
187  E.g., on Windows Vista and later you could:
188
189         __declspec(dllexport) __cdecl BOOL _OPENSSL_isservice(void)
190         {   DWORD sess;
191             if (ProcessIdToSessionId(GetCurrentProcessId(),&sess))
192                 return sess==0;
193             return FALSE;
194         }
195
196  If you link with OpenSSL .DLLs, then you're expected to include into
197  your application code small "shim" snippet, which provides glue between
198  OpenSSL BIO layer and your compiler run-time. See the OPENSSL_Applink
199  manual page for further details.