]> granicus.if.org Git - apache/blob - docs/manual/platform/win_compiling.html
Obtained from: docs@httpd
[apache] / docs / manual / platform / win_compiling.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml">
5   <head>
6     <meta name="generator" content="HTML Tidy, see www.w3.org" />
7     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
8     <title>Compiling Apache for Microsoft Windows</title>
9   </head>
10   <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
11
12   <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
13   vlink="#000080" alink="#FF0000">
14     <!--#include virtual="header.html" -->
15
16     <h1 align="center">Compiling Apache for Microsoft Windows</h1>
17
18     <p>There are many important points before you begin compiling
19     Apache. See <a href="windows.html">Using Apache with Microsoft
20     Windows</a> before you begin.</p>
21
22     <h3><a id="requirements"
23     name="requirements">Requirements</a></h3>
24
25     <p>Compiling Apache requires the following environment to be
26     properly installed;</p>
27
28     <ul>
29       <li>Disk Space<br />
30       <br />
31        Make sure you have at least 50 MB of free disk space
32       available. After installation Apache requires approximately
33       10 MB of disk space, plus space for log and cache files,
34       which can grow rapidly. The actual disk space requirements
35       will vary considerably based on your chosen configuration and
36       any third-party modules or libraries.<br />
37       <br />
38       </li>
39
40       <li>
41         Microsoft Visual C++ 5.0 or higher.<br />
42         <br />
43          Apache can be built using the command line tools, or from
44         within the Visual Studio IDE Workbench.  The command line
45         build requires the environment to reflect the PATH, INCLUDE,
46         LIB and other variables that can be configured with the 
47         vcvars32 batch file: 
48 <pre>
49   "c:\Program Files\DevStudio\VC\Bin\vcvars32.bat"
50 </pre>
51       </li>
52
53       <li>
54         The Windows Platform SDK.<br />
55         <br />
56          Visual C++ 5.0 builds require an updated Microsoft Windows 
57         Platform SDK to enable some Apache features. For command line
58         builds, the Platform SDK environment is prepared by the
59         setenv batch file: 
60 <pre>
61   "c:\Program Files\Platform SDK\setenv.bat"
62 </pre>
63         The Platform SDK files distributed with Visual C++ 6.0 and
64         later are sufficient, so users of later version may skip 
65         this requirement.<br />
66         <br />
67          <strong>Note</strong> that the Windows Platform SDK update
68         is required to enable all supported mod_isapi features.
69         Without a recent update, Apache will issue warnings under
70         MSVC++ 5.0 that some mod_isapi features will be disabled.
71         Look for the update at <a
72         href="http://msdn.microsoft.com/downloads/sdks/platform/platform.asp">
73         http://msdn.microsoft.com/downloads/sdks/platform/platform.asp</a>.<br />
74         <br />
75       </li>
76
77       <li>The awk utility (awk, gawk or similar.)<br />
78         <br />
79          To install Apache within the build system, several files are
80         modified using the awk.exe utility.  awk was chosen since it 
81         is a very small download (compared with Perl or WSH/VB) and
82         accomplishes the task of generating files. Brian Kernighan's 
83         <a href="http://cm.bell-labs.com/cm/cs/who/bwk/"
84          >http://cm.bell-labs.com/cm/cs/who/bwk/</a>
85         site has a compiled native Win32 binary, 
86         <a href="http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe"
87          >http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe</a> which 
88         you must save with the name awk.exe rather than awk95.exe.<br />
89         <br />
90          Note that Developer Studio IDE will only find awk.exe from
91         the <u>T</u>ools menu <u>O</u>ptions... Directories tab 
92         (the Projects - VC++ Directories pane in Developer Studio 7.0)
93         listing Executable file paths.  Add the path for awk.exe to this 
94         list, and your system PATH environment variable, as needed.<br />
95         <br />
96          Also note that if you are using Cygwin (<a href="http://www.cygwin.com/"
97          >http://www.cygwin.com/</a>) the awk utility is named gawk.exe and
98          that the file awk.exe is really a symlink to the gawk.exe file. The
99          Windows command shell does not recognize symlinks, and because of that
100          building InstallBin will fail. A workaround is to delete awk.exe from
101          the cygwin installation and rename gawk.exe to awk.exe.<br />
102          <br />
103       </li>
104
105       <li>[Optional] OpenSSL libraries (for mod_ssl and ab.exe with ssl support)<br />
106         <br />
107          <strong>Caution:  there are significant restrictions and 
108         prohibitions on the use and distribution of strong cryptography 
109         and patented intellectual property throughout the world.</strong>
110         OpenSSL includes strong cryptography controlled by both export 
111         regulations and domestic law, as well as intellectual property 
112         protected by patent, in the United States and elsewhere.  Neither 
113         the Apache Software Foundation nor the OpenSSL project can provide 
114         legal advise regarding possession, use, or distribution of the code 
115         provided by the OpenSSL project.  <strong>Consult your own legal 
116         counsel, you are responsible for your own actions.</strong><br />
117         <br />
118          OpenSSL must be installed into a srclib subdirectory named openssl, 
119         obtained from <a href="http://www.openssl.org/source/"
120          >http://www.openssl.org/source/</a>, in order to compile mod_ssl
121         or the abs project (ab.exe with SSL support.)  To prepare OpenSSL 
122         for both release and debug builds of Apache, and disable the patent 
123         protected features in 0.9.6,  you might use the following build commands;
124 <pre>
125   perl util\mkfiles.pl >MINFO
126   perl util\mk1mf.pl dll no-asm no-mdc2 no-rc5 no-idea VC-WIN32 >makefile
127   perl util\mk1mf.pl dll debug no-asm no-mdc2 no-rc5 no-idea VC-WIN32 >makefile.dbg
128   perl util\mkdef.pl 32 libeay no-asm no-mdc2 no-rc5 no-idea >ms\libeay32.def
129   perl util\mkdef.pl 32 ssleay no-asm no-mdc2 no-rc5 no-idea >ms\ssleay32.def
130   nmake
131   nmake -f makefile.dbg      
132 </pre>
133       </li>
134
135       <li>[Optional] zlib sources (for mod_deflate)<br />
136         <br />
137          Zlib must be installed into a srclib subdirectory named zlib, 
138         however those sources need not be compiled.  The build system will
139         compile the compression sources directly into the mod_deflate 
140         module.  Zlib can be obtained from <a href="http://www.gzip.org/zlib/"
141          >http://www.gzip.org/zlib/</a> -- mod_deflate is confirmed to
142         build correctly with version 1.1.4.<br />
143         <br />
144       </li>
145
146     </ul>
147
148     <h3><a id="commandbuild" name="commandbuild">Command-Line
149     Build</a></h3>
150
151     <p>First, unpack the Apache distribution into an appropriate
152     directory. Open a command-line prompt and cd to that
153     directory.</p>
154
155     <p>The master Apache makefile instructions are contained in the
156     <code>Makefile.win</code> file. To compile Apache on Windows
157     NT, simply use one of the following commands to compiled the
158     release or debug build, respectively:</p>
159 <pre>
160     nmake /f Makefile.win _apacher
161
162     nmake /f Makefile.win _apached
163 </pre>
164
165     <p>Either command will compile Apache. The latter will include
166     debugging information in the resulting files, making it easier
167     to find bugs and track down problems.</p>
168
169     <h3><a id="workspacebuild" name="workspacebuild">Developer
170     Studio Workspace IDE Build</a></h3>
171
172     <p>Apache can also be compiled using VC++'s VisualStudio
173     development environment. To simplify this process, a
174     VisualStudio workspace, Apache.dsw, is provided. This workspace
175     exposes the entire list of working .dsp projects that are
176     required for the complete Apache binary release. It includes
177     dependencies between the projects to assure that they are built
178     in the appropriate order.</p>
179
180     <p>Open the Apache.dsw workspace, and select InstallBin
181     (Release or Debug build, as desired) as the Active Project.
182     InstallBin causes all related project to be built, and then
183     invokes Makefile.win to move the compiled executables and dlls.
184     You may personalize the INSTDIR= choice by changing
185     InstallBin's Settings, General tab, Build command line entry.
186     INSTDIR defaults to the /Apache2 directory.  If you only want
187     a test compile (without installing) you may build the BuildBin
188     project instead.</p>
189
190     <p>The .dsp project files are distributed in Visual C++ 6.0
191     format. Visual C++ 5.0 (97) will recognize them.  Visual C++
192     7.0 (.net) must convert Apache.dsw plus the .dsp files into an 
193     Apache.sln plus .msproj files, be sure you reconvert the .msproj 
194     file if any of the source .dsp files change!  This is really
195     trivial, just open Apache.dsw in the VC++ 7.0 IDE once again.</p>
196
197     <p>Visual C++ 7.0 (.net) users should also use the <u>B</u>uild
198     menu, C<u>o</u>nfiguration Manager dialog to uncheck both the 
199     Debug and Release Solution modules abs, mod_ssl, and mod_deflate.
200     These modules are built by invoking nmake or the IDE directly with
201     the BinBuild target to build those modules explicitly, only if the 
202     srclib directories openssl and/or zlib exist.</p>
203
204     <p>Exported .mak files pose a greater hassle, but they are
205     required for Visual C++ 5.0 users to build mod_ssl, abs (ab
206     with SSL support) and/or mod_deflate.  VC++ 7.0 (.net) users
207     also benefit, nmake builds are faster than binenv builds.
208     Build the entire project from within the VC++ 5.0 or 6.0 IDE, 
209     then use the <u>P</u>roject Menu <u>E</u>xport for all makefiles.
210     You must build the projects first in order to create all dynamic 
211     auto-generated targets, so that dependencies can be parsed 
212     correctly.  Run the following command to fix the paths so they 
213     will build anywhere;</p>
214 <pre>
215      perl srclib\apr\build\fixwin32mak.pl
216 </pre>
217     <p>You must type this command from the <em>top level</em>
218     directory of the httpd source tree. Every .mak and .dep project 
219     file within the current directory and below will be corrected,
220     and the timestamps adjusted to reflect the .dsp.</p>
221
222     <p>If you contribute back a patch that revises project files, we
223     must commit project files in Visual Studio 6.0 format.  Changes
224     should be simple, with minimal compilation and linkage flags that
225     will be recognized by all VC++ 5.0 through 7.0 environments.</p>
226
227     <h3><a id="projectcomponents" name="projectcomponents">Project
228     Components</a></h3>
229
230     <p>The Apache.dsw workspace and makefile.win nmake script both
231     build the .dsp projects of the Apache server in the following
232     sequence:</p>
233
234     <ol>
235       <li><code>srclib\apr\apr.dsp</code></li>
236
237       <li><code>srclib\apr\libapr.dsp</code></li>
238
239       <li><code>srclib\apr-util\uri\gen_uri_delims.dsp</code></li>
240
241       <li><code>srclib\apr-util\xml\expat\lib\xml.dsp</code></li>
242
243       <li><code>srclib\apr-util\aprutil.dsp</code></li>
244
245       <li><code>srclib\apr-util\libaprutil.dsp</code></li>
246
247       <li><code>srclib\pcre\dftables.dsp</code></li>
248
249       <li><code>srclib\pcre\pcre.dsp</code></li>
250
251       <li><code>srclib\pcre\pcreposix.dsp</code></li>
252
253       <li><code>server\gen_test_char.dsp</code></li>
254
255       <li><code>libhttpd.dsp</code></li>
256
257       <li><code>Apache.dsp</code></li>
258     </ol>
259
260     <p>In addition, the <code>modules\</code> subdirectory tree contains
261     project files for the majority of the modules.</p>
262
263     <p>The <code>support\</code> directory contains project files for
264     additional programs that are not part of the Apache runtime,
265     but are used by the administrator to test Apache and maintain
266     password and log files.  Windows-specific support projects are
267     broken out in the <code>support\win32\</code> directory.</p>
268
269     <ol>
270       <li><code>support\ab.dsp</code></li>
271
272       <li><code>support\htdigest.dsp</code></li>
273
274       <li><code>support\htpasswd.dsp</code></li>
275
276       <li><code>support\logresolve.dsp</code></li>
277
278       <li><code>support\rotatelogs.dsp</code></li>
279
280       <li><code>support\win32\ApacheMonitor.dsp</code></li>
281
282       <li><code>support\win32\wintty.dsp</code></li>
283     </ol>
284
285     <p>Once Apache has been compiled, it needs to be installed in
286     its server root directory. The default is the
287     <code>\Apache2</code> directory, of the same drive.</p>
288
289     <p>To build and install all the files into the desired folder
290     <em>dir</em> automatically, use one of the following nmake
291     commands:</p>
292 <pre>
293     nmake /f Makefile.win installr INSTDIR=<em>dir</em>
294
295     nmake /f Makefile.win installd INSTDIR=<em>dir</em>
296 </pre>
297     The <em>dir</em> argument to INSTDIR gives the installation
298     directory; it can be omitted if Apache is to be installed into
299     <samp>\Apache2</samp>.<br />
300      <br />
301      
302
303     <p>This will install the following:</p>
304
305     <ul>
306       <li><code><em>dir</em>\bin\Apache.exe</code> - Apache
307       executable</li>
308
309       <li><code><em>dir</em>\bin\ApacheMonitor.exe</code> - Service
310       monitor taskbar icon utility</li>
311
312       <li><code><em>dir</em>\bin\htdigest.exe</code> - Digest auth
313       password file utility</li>
314
315       <li><code><em>dir</em>\bin\htdbm.exe</code> - SDBM auth
316       database password file utility</li>
317
318       <li><code><em>dir</em>\bin\htpasswd.exe</code> - Basic auth
319       password file utility</li>
320
321       <li><code><em>dir</em>\bin\logresolve.exe</code> - Log file
322       dns name lookup utility</li>
323
324       <li><code><em>dir</em>\bin\rotatelogs.exe</code> - Log file
325       cycling utility</li>
326
327       <li><code><em>dir</em>\bin\wintty.exe</code> - Console window
328       utility</li>
329
330       <li><code><em>dir</em>\bin\libapr.dll</code> - Apache
331       Portable Runtime shared library</li>
332
333       <li><code><em>dir</em>\bin\libaprutil.dll</code> - Apache
334       Utility Runtime shared library</li>
335
336       <li><code><em>dir</em>\bin\libhttpd.dll</code> - Apache Core
337       library</li>
338
339       <li><code><em>dir</em>\modules\mod_*.so</code> - Loadable
340       Apache modules</li>
341
342       <li><code><em>dir</em>\conf</code> - Configuration
343       directory</li>
344
345       <li><code><em>dir</em>\logs</code> - Empty logging
346       directory</li>
347
348       <li><code><em>dir</em>\include</code> - C language header
349       files</li>
350
351       <li><code><em>dir</em>\lib</code> - Link library files</li>
352     </ul>
353
354     <p><strong>Warning about building Apache from the development
355     tree</strong></p>
356
357     <p>Note; only the .dsp files are maintained between release builds.
358     The .mak files are NOT regenerated, due to the tremendous waste
359     of reviewer's time. Therefore, you cannot rely on the NMAKE
360     commands above to build revised .dsp project files unless you
361     then export all .mak files yourself from the project.  This is
362     unnecessary if you build from within the Microsoft
363     Developer Studio environment.</p>
364
365     <p><strong>Note:</strong> it is very worthwhile to build the 
366     BuildBin target project (or the command line _apacher or _apached 
367     target) prior to exporting the make files.  Many files are 
368     autogenerated in the build process.  Only a full build provides 
369     all of the dependent files required to build proper dependency 
370     trees for correct build behavior.</p>
371
372     <p>In order to create distribution .mak files, always review
373     the generated .mak (or .dep) dependencies for Platform SDK or
374     other garbage includes.  The DevStudio\SharedIDE\bin\ (VC5) or
375     DevStudio\Common\MSDev98\bin\ (VC6) directory contains the
376     sysincl.dat file, which must list all exceptions.  Update this
377     file (including both forward and backslashed paths, such as
378     both sys/time.h and sys\time.h) to include such dependencies.
379     Including local-install paths in a distributed .mak file will
380     cause the build to fail completely.  And don't forget to run
381     srclib/apr/build/fixwin32mak.pl in order to fix absolute
382     paths within the .mak files.</p>
383
384     <!--#include virtual="footer.html" -->  </body>
385 </html>