summaryrefslogtreecommitdiff
path: root/docs/manual/platform/win_compiling.html
blob: ecfe11fcae150aa117bbd279ac0f7f0f75877194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org" />
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Compiling Apache for Microsoft Windows</title>
  </head>
  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->

  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
  vlink="#000080" alink="#FF0000">
    <!--#include virtual="header.html" -->

    <h1 align="center">Compiling Apache for Microsoft Windows</h1>

    <p>There are many important points before you begin compiling
    Apache. See <a href="windows.html">Using Apache with Microsoft
    Windows</a> before you begin.</p>

    <h3><a id="requirements"
    name="requirements">Requirements</a></h3>

    <p>Compiling Apache requires the following environment to be
    properly installed;</p>

    <ul>
      <li>Disk Space<br />
      <br />
       Make sure you have at least 50 MB of free disk space
      available. After installation Apache requires approximately
      10 MB of disk space, plus space for log and cache files,
      which can grow rapidly. The actual disk space requirements
      will vary considerably based on your chosen configuration and
      any third-party modules or libraries.<br />
      <br />
      </li>

      <li>
        Microsoft Visual C++ 5.0 or higher.<br />
        <br />
         Apache can be built using the command line tools, or from
        within the Visual Studio IDE Workbench.  The command line
        build requires the environment to reflect the PATH, INCLUDE,
        LIB and other variables that can be configured with the 
        vcvars32 batch file: 
<pre>
  "c:\Program Files\DevStudio\VC\Bin\vcvars32.bat"
</pre>
      </li>

      <li>
        The Windows Platform SDK.<br />
        <br />
         Visual C++ 5.0 builds require an updated Microsoft Windows 
        Platform SDK to enable some Apache features. For command line
        builds, the Platform SDK environment is prepared by the
        setenv batch file: 
<pre>
  "c:\Program Files\Platform SDK\setenv.bat"
</pre>
        The Platform SDK files distributed with Visual C++ 6.0 and
        later are sufficient, so users of later version may skip 
        this requirement.<br />
        <br />
         <strong>Note</strong> that the Windows Platform SDK update
        is required to enable all supported mod_isapi features.
        Without a recent update, Apache will issue warnings under
        MSVC++ 5.0 that some mod_isapi features will be disabled.
        Look for the update at <a
        href="http://msdn.microsoft.com/downloads/sdks/platform/platform.asp">
        http://msdn.microsoft.com/downloads/sdks/platform/platform.asp</a>.<br />
        <br />
      </li>

      <li>The awk utility (awk, gawk or similar.)<br />
        <br />
         To install Apache within the build system, several files are
        modified using the awk.exe utility.  awk was chosen since it 
        is a very small download (compared with Perl or WSH/VB) and
        accomplishes the task of generating files. Brian Kernighan's 
        <a href="http://cm.bell-labs.com/cm/cs/who/bwk/"
         >http://cm.bell-labs.com/cm/cs/who/bwk/</a>
        site has a compiled native Win32 binary, 
        <a href="http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe"
         >http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe</a> which 
        you must save with the name awk.exe rather than awk95.exe.<br />
        <br />
         Note that Developer Studio IDE will only find awk.exe from
        the <u>T</u>ools menu <u>O</u>ptions... Directories tab 
        (the Projects - VC++ Directories pane in Developer Studio 7.0)
        listing Executable file paths.  Add the path for awk.exe to this 
        list, and your system PATH environment variable, as needed.<br />
        <br />
         Also note that if you are using Cygwin (<a href="http://www.cygwin.com/"
         >http://www.cygwin.com/</a>) the awk utility is named gawk.exe and
         that the file awk.exe is really a symlink to the gawk.exe file. The
         Windows command shell does not recognize symlinks, and because of that
         building InstallBin will fail. A workaround is to delete awk.exe from
         the cygwin installation and rename gawk.exe to awk.exe.<br />
         <br />
      </li>

      <li>[Optional] OpenSSL libraries (for mod_ssl and ab.exe with ssl support)<br />
        <br />
         <strong>Caution:  there are significant restrictions and 
        prohibitions on the use and distribution of strong cryptography 
        and patented intellectual property throughout the world.</strong>
        OpenSSL includes strong cryptography controlled by both export 
        regulations and domestic law, as well as intellectual property 
        protected by patent, in the United States and elsewhere.  Neither 
        the Apache Software Foundation nor the OpenSSL project can provide 
        legal advise regarding possession, use, or distribution of the code 
        provided by the OpenSSL project.  <strong>Consult your own legal 
        counsel, you are responsible for your own actions.</strong><br />
        <br />
         OpenSSL must be installed into a srclib subdirectory named openssl, 
        obtained from <a href="http://www.openssl.org/source/"
         >http://www.openssl.org/source/</a>, in order to compile mod_ssl
        or the abs project (ab.exe with SSL support.)  To prepare OpenSSL 
        for both release and debug builds of Apache, and disable the patent 
        protected features in 0.9.6,  you might use the following build commands;
<pre>
  perl util\mkfiles.pl >MINFO
  perl util\mk1mf.pl dll no-asm no-mdc2 no-rc5 no-idea VC-WIN32 >makefile
  perl util\mk1mf.pl dll debug no-asm no-mdc2 no-rc5 no-idea VC-WIN32 >makefile.dbg
  perl util\mkdef.pl 32 libeay no-asm no-mdc2 no-rc5 no-idea >ms\libeay32.def
  perl util\mkdef.pl 32 ssleay no-asm no-mdc2 no-rc5 no-idea >ms\ssleay32.def
  nmake
  nmake -f makefile.dbg      
</pre>
      </li>

      <li>[Optional] zlib sources (for mod_deflate)<br />
        <br />
         Zlib must be installed into a srclib subdirectory named zlib, 
        however those sources need not be compiled.  The build system will
        compile the compression sources directly into the mod_deflate 
        module.  Zlib can be obtained from <a href="http://www.gzip.org/zlib/"
         >http://www.gzip.org/zlib/</a> -- mod_deflate is confirmed to
        build correctly with version 1.1.4.<br />
        <br />
      </li>

    </ul>

    <h3><a id="commandbuild" name="commandbuild">Command-Line
    Build</a></h3>

    <p>First, unpack the Apache distribution into an appropriate
    directory. Open a command-line prompt and cd to that
    directory.</p>

    <p>The master Apache makefile instructions are contained in the
    <code>Makefile.win</code> file. To compile Apache on Windows
    NT, simply use one of the following commands to compiled the
    release or debug build, respectively:</p>
<pre>
    nmake /f Makefile.win _apacher

    nmake /f Makefile.win _apached
</pre>

    <p>Either command will compile Apache. The latter will include
    debugging information in the resulting files, making it easier
    to find bugs and track down problems.</p>

    <h3><a id="workspacebuild" name="workspacebuild">Developer
    Studio Workspace IDE Build</a></h3>

    <p>Apache can also be compiled using VC++'s VisualStudio
    development environment. To simplify this process, a
    VisualStudio workspace, Apache.dsw, is provided. This workspace
    exposes the entire list of working .dsp projects that are
    required for the complete Apache binary release. It includes
    dependencies between the projects to assure that they are built
    in the appropriate order.</p>

    <p>Open the Apache.dsw workspace, and select InstallBin
    (Release or Debug build, as desired) as the Active Project.
    InstallBin causes all related project to be built, and then
    invokes Makefile.win to move the compiled executables and dlls.
    You may personalize the INSTDIR= choice by changing
    InstallBin's Settings, General tab, Build command line entry.
    INSTDIR defaults to the /Apache2 directory.  If you only want
    a test compile (without installing) you may build the BuildBin
    project instead.</p>

    <p>The .dsp project files are distributed in Visual C++ 6.0
    format. Visual C++ 5.0 (97) will recognize them.  Visual C++
    7.0 (.net) must convert Apache.dsw plus the .dsp files into an 
    Apache.sln plus .msproj files, be sure you reconvert the .msproj 
    file if any of the source .dsp files change!  This is really
    trivial, just open Apache.dsw in the VC++ 7.0 IDE once again.</p>

    <p>Visual C++ 7.0 (.net) users should also use the <u>B</u>uild
    menu, C<u>o</u>nfiguration Manager dialog to uncheck both the 
    Debug and Release Solution modules abs, mod_ssl, and mod_deflate.
    These modules are built by invoking nmake or the IDE directly with
    the BinBuild target to build those modules explicitly, only if the 
    srclib directories openssl and/or zlib exist.</p>

    <p>Exported .mak files pose a greater hassle, but they are
    required for Visual C++ 5.0 users to build mod_ssl, abs (ab
    with SSL support) and/or mod_deflate.  VC++ 7.0 (.net) users
    also benefit, nmake builds are faster than binenv builds.
    Build the entire project from within the VC++ 5.0 or 6.0 IDE, 
    then use the <u>P</u>roject Menu <u>E</u>xport for all makefiles.
    You must build the projects first in order to create all dynamic 
    auto-generated targets, so that dependencies can be parsed 
    correctly.  Run the following command to fix the paths so they 
    will build anywhere;</p>
<pre>
     perl srclib\apr\build\fixwin32mak.pl
</pre>
    <p>You must type this command from the <em>top level</em>
    directory of the httpd source tree. Every .mak and .dep project 
    file within the current directory and below will be corrected,
    and the timestamps adjusted to reflect the .dsp.</p>

    <p>If you contribute back a patch that revises project files, we
    must commit project files in Visual Studio 6.0 format.  Changes
    should be simple, with minimal compilation and linkage flags that
    will be recognized by all VC++ 5.0 through 7.0 environments.</p>

    <h3><a id="projectcomponents" name="projectcomponents">Project
    Components</a></h3>

    <p>The Apache.dsw workspace and makefile.win nmake script both
    build the .dsp projects of the Apache server in the following
    sequence:</p>

    <ol>
      <li><code>srclib\apr\apr.dsp</code></li>

      <li><code>srclib\apr\libapr.dsp</code></li>

      <li><code>srclib\apr-util\uri\gen_uri_delims.dsp</code></li>

      <li><code>srclib\apr-util\xml\expat\lib\xml.dsp</code></li>

      <li><code>srclib\apr-util\aprutil.dsp</code></li>

      <li><code>srclib\apr-util\libaprutil.dsp</code></li>

      <li><code>srclib\pcre\dftables.dsp</code></li>

      <li><code>srclib\pcre\pcre.dsp</code></li>

      <li><code>srclib\pcre\pcreposix.dsp</code></li>

      <li><code>server\gen_test_char.dsp</code></li>

      <li><code>libhttpd.dsp</code></li>

      <li><code>Apache.dsp</code></li>
    </ol>

    <p>In addition, the <code>modules\</code> subdirectory tree contains
    project files for the majority of the modules.</p>

    <p>The <code>support\</code> directory contains project files for
    additional programs that are not part of the Apache runtime,
    but are used by the administrator to test Apache and maintain
    password and log files.  Windows-specific support projects are
    broken out in the <code>support\win32\</code> directory.</p>

    <ol>
      <li><code>support\ab.dsp</code></li>

      <li><code>support\htdigest.dsp</code></li>

      <li><code>support\htpasswd.dsp</code></li>

      <li><code>support\logresolve.dsp</code></li>

      <li><code>support\rotatelogs.dsp</code></li>

      <li><code>support\win32\ApacheMonitor.dsp</code></li>

      <li><code>support\win32\wintty.dsp</code></li>
    </ol>

    <p>Once Apache has been compiled, it needs to be installed in
    its server root directory. The default is the
    <code>\Apache2</code> directory, of the same drive.</p>

    <p>To build and install all the files into the desired folder
    <em>dir</em> automatically, use one of the following nmake
    commands:</p>
<pre>
    nmake /f Makefile.win installr INSTDIR=<em>dir</em>

    nmake /f Makefile.win installd INSTDIR=<em>dir</em>
</pre>
    The <em>dir</em> argument to INSTDIR gives the installation
    directory; it can be omitted if Apache is to be installed into
    <samp>\Apache2</samp>.<br />
     <br />
     

    <p>This will install the following:</p>

    <ul>
      <li><code><em>dir</em>\bin\Apache.exe</code> - Apache
      executable</li>

      <li><code><em>dir</em>\bin\ApacheMonitor.exe</code> - Service
      monitor taskbar icon utility</li>

      <li><code><em>dir</em>\bin\htdigest.exe</code> - Digest auth
      password file utility</li>

      <li><code><em>dir</em>\bin\htdbm.exe</code> - SDBM auth
      database password file utility</li>

      <li><code><em>dir</em>\bin\htpasswd.exe</code> - Basic auth
      password file utility</li>

      <li><code><em>dir</em>\bin\logresolve.exe</code> - Log file
      dns name lookup utility</li>

      <li><code><em>dir</em>\bin\rotatelogs.exe</code> - Log file
      cycling utility</li>

      <li><code><em>dir</em>\bin\wintty.exe</code> - Console window
      utility</li>

      <li><code><em>dir</em>\bin\libapr.dll</code> - Apache
      Portable Runtime shared library</li>

      <li><code><em>dir</em>\bin\libaprutil.dll</code> - Apache
      Utility Runtime shared library</li>

      <li><code><em>dir</em>\bin\libhttpd.dll</code> - Apache Core
      library</li>

      <li><code><em>dir</em>\modules\mod_*.so</code> - Loadable
      Apache modules</li>

      <li><code><em>dir</em>\conf</code> - Configuration
      directory</li>

      <li><code><em>dir</em>\logs</code> - Empty logging
      directory</li>

      <li><code><em>dir</em>\include</code> - C language header
      files</li>

      <li><code><em>dir</em>\lib</code> - Link library files</li>
    </ul>

    <p><strong>Warning about building Apache from the development
    tree</strong></p>

    <p>Note; only the .dsp files are maintained between release builds.
    The .mak files are NOT regenerated, due to the tremendous waste
    of reviewer's time. Therefore, you cannot rely on the NMAKE
    commands above to build revised .dsp project files unless you
    then export all .mak files yourself from the project.  This is
    unnecessary if you build from within the Microsoft
    Developer Studio environment.</p>

    <p><strong>Note:</strong> it is very worthwhile to build the 
    BuildBin target project (or the command line _apacher or _apached 
    target) prior to exporting the make files.  Many files are 
    autogenerated in the build process.  Only a full build provides 
    all of the dependent files required to build proper dependency 
    trees for correct build behavior.</p>

    <p>In order to create distribution .mak files, always review
    the generated .mak (or .dep) dependencies for Platform SDK or
    other garbage includes.  The DevStudio\SharedIDE\bin\ (VC5) or
    DevStudio\Common\MSDev98\bin\ (VC6) directory contains the
    sysincl.dat file, which must list all exceptions.  Update this
    file (including both forward and backslashed paths, such as
    both sys/time.h and sys\time.h) to include such dependencies.
    Including local-install paths in a distributed .mak file will
    cause the build to fail completely.  And don't forget to run
    srclib/apr/build/fixwin32mak.pl in order to fix absolute
    paths within the .mak files.</p>

    <!--#include virtual="footer.html" -->  </body>
</html>