]> granicus.if.org Git - apache/blob - README.cmake
mod_lua: Add a fixups hook that checks if the original request is intended
[apache] / README.cmake
1 Experimental cmake-based build support for Apache httpd on Microsoft Windows
2
3 Status
4 ------
5
6 This build support is currently intended only for Microsoft Windows.
7
8 This build support is experimental.  Specifically,
9
10 * It does not support all features of Apache httpd.
11 * Some components may not be built correctly and/or in a manner
12   compatible with the previous Windows build support.
13 * Build interfaces, such as the mechanisms which are used to enable
14   optional functionality or specify prerequisites, may change from
15   release to release as feedback is received from users and bugs and
16   limitations are resolved.
17
18 Important: Refer to the "Known Bugs and Limitations" section for further
19            information.
20
21            It is beyond the scope of this document to document or explain
22            how to utilize the various cmake features, such as different
23            build backends or provisions for finding support libraries.
24
25            Please refer to the cmake documentation for additional information
26            that applies to building any project with cmake.
27
28 Prerequisites
29 -------------
30
31 The following tools must be in PATH:
32
33 * cmake, version 2.8 or later
34 * Perl
35 * If the WITH_MODULES feature is used: awk
36 * If using a command-line compiler: compiler and linker and related tools
37   (Refer to the cmake documentation for more information.)
38
39 The following support libraries are mandatory:
40
41 * APR, built with cmake
42   + Either APR 2.0-dev (trunk) or APR 1.5.x and APR-Util 1.5.x.
43   + When building APR (but not APR-Util), specify the build option
44     APR_INSTALL_PRIVATE_H so that non-standard files required for building
45     Apache httpd are installed.
46   + Additional APR settings affect httpd but are not mandatory, such as
47     APR_HAVE_IPV6.
48 * PCRE
49
50 Certain optional features of APR 2.0-dev (trunk) or APR-Util 1.5.x
51 allow some optional features of httpd to be enabled.  For example,
52 APU_HAVE_CRYPTO is required for mod_session_crypto.
53
54 Additional support libraries allow some optional features of httpd to be
55 enabled:
56
57 * libxml2 (e.g., mod_proxy_html)
58 * lua 5.1 (mod_lua)
59 * openssl (mod_ssl and https support for ab)
60 * zlib (mod_deflate)
61
62 How to build
63 ------------
64
65 1. cd to a clean directory for building (i.e., don't build in your
66    source tree)
67
68 2. Make sure cmake and Perl are in PATH.  Additionally, some backends 
69    require compile tools in PATH.  (Hint: "Visual Studio Command Prompt")
70    In the unlikely event that you use -DWITH_MODULES, described below, make
71    sure awk is in PATH.
72
73 3. cmake -G "some backend, like 'NMake Makefiles'"
74      -DCMAKE_INSTALL_PREFIX=d:/path/to/httpdinst
75      -DENABLE_foo=A|I|O|a|i
76      -DENABLE_MODULES=A|I|O|a|i
77      d:/path/to/httpdsource
78
79    Alternately, you can use the cmake-gui and update settings in the GUI.
80
81    PCRE_INCLUDE_DIR, PCRE_LIBRARIES, APR_INCLUDE_DIR, APR_LIBRARIES:
82
83        cmake doesn't bundle FindXXX for these packages, so the crucial
84        information has to be specified in this manner if they aren't found
85        in their default location.
86
87      -DPCRE_INCLUDE_DIR=d:/path/to/pcreinst/include
88      -DPCRE_LIBRARIES=d:/path/to/pcreinst/lib/pcre[d].lib
89
90        These will have to be specified only if PCRE is installed to a different
91        directory than httpd, or if debug *and* release builds of PCRE were
92        installed there and you want to control which is used.  (Currently the
93        build will use pcred.lib (debug) if it is found in the default location
94        and not overridden with -DPCRE_LIBRARIES.)
95
96      -DAPR_INCLUDE_DIR=d:/path/to/aprinst/include
97      -DAPR_LIBRARIES="d:/path/to/aprinst/lib/libapr-1.lib;d:/path/to/aprinst/lib/libaprutil-1.lib"
98
99        These will have to be specified if APR[-Util] was installed to a
100        different directory than httpd.
101
102        When building with APR trunk (future APR 2.x, with integrated APR-Util),
103        specify just the path to libapr-2.lib:
104
105            -DAPR_LIBRARIES=d:/path/to/aprinst/lib/libapr-2.lib
106
107        APR+APR-Util 1.x vs. APR trunk will be detected automatically if they
108        are installed to the same location as httpd.
109
110        APR-Util 1.x has an optional LDAP library.  If APR-Util has LDAP enabled
111        and httpd's mod_ldap and mod_authnz_ldap are being used, include the
112        path to the LDAP library in the APR_LIBRARIES setting.  (If APR and
113        APR-Util are found in the default location, the LDAP library will be
114        included if it is present.
115
116    LIBXML2_ICONV_INCLUDE_DIR, LIBXML2_ICONV_LIBRARIES
117
118       If using a module that requires libxml2 *and* the build of libxml2 requires
119       iconv, set these variables to allow iconv includes and libraries to be
120       used.  For example:
121
122       -DLIBXML2_ICONV_INCLUDE_DIR=c:\iconv-1.9.2.win32\include
123       -DLIBXML2_ICONV_LIBRARIES=c:\iconv-1.9.2.win32\lib\iconv.lib
124
125    CMAKE_C_FLAGS_RELEASE, _DEBUG, _RELWITHDEBINFO, _MINSIZEREL
126    CMAKE_BUILD_TYPE
127
128        For NMake Makefiles the choices are at least DEBUG, RELEASE,
129        RELWITHDEBINFO, and MINSIZEREL
130        Other backends may have other selections.
131
132    ENABLE_foo:
133
134        Each module has a default setting which can be overridden with one of
135        the following values:
136            A        build and Activate module
137            a        build and Activate module IFF prereqs are available; if
138                     prereqs are unavailable, don't build it
139            I        build module but leave it Inactive (commented-out
140                     LoadModule directive)
141            i        build module but leave it Inactive IFF prereqs are
142                     available; if prereqs are unavailable, don't build it
143            O        Omit module completely
144
145        Examples: -DENABLE_ACCESS_COMPAT=O
146                  -DENABLE_PROXY_HTML=i
147
148    ENABLE_MODULES:
149
150        This changes the *minimum* enablement of all modules to the specified
151        value (one of A, a, I, i, O, as described under ENABLE_foo above).
152
153        The ranking of enablement from lowest to highest is O, i, I, a, A.
154        If a specific module has a higher rank enablement setting, either from
155        a built-in default or from -DENABLE_foo, ENABLE_MODULES won't affect
156        that module.  However, if a specific module has a lower-rank enablement
157        setting, presumably from a built-in default, the value of ENABLE_MODULES
158        will be used for that module.
159
160        Explanations for possible values:
161
162        -DENABLE_MODULES=a      build and activate all possible modules,
163                                ignoring any with missing prereqs
164                                (doesn't affect modules with A for ENABLE_foo)
165
166        -DENABLE_MODULES=i      build but leave inactive all possible
167                                modules, ignoring any with missing
168                                prereqs
169                                (doesn't affect modules with A, a, or I for 
170                                ENABLE_foo)
171
172        -DENABLE_MODULES=O      no impact, since all modules are either
173                                already disabled or have a higher setting
174
175        -DENABLE_MODULES=A      build and activate all possible modules,
176                                failing the build if any module is missing
177                                a prereq
178
179        -DENABLE_MODULES=I      similar to -DENABLE_MODULES=A
180                                (doesn't affect modules with A or a for
181                                ENABLE_foo)
182
183    WITH_MODULES:
184
185        Comma-separated paths to single file modules to statically linked into
186        the server, like the --with-module=modpath:/path/to/mod_foo.c with
187        the autoconf-based build.  Key differences: The modpath (e.g., 
188        "generators") isn't provided or used, and the copy of the module
189        source being built is automatically updated when it changes.
190        See also EXTRA_COMPILE_FLAGS, EXTRA_INCLUDES, and EXTRA_LIBS.
191
192    EXTRA_COMPILE_FLAGS:
193
194        Space-delimited compile flags to define with the build.
195
196    EXTRA_INCLUDES:
197
198        List of additional directories to search for .h files.  This may
199        be necessary when including third-party modules in the httpd build
200        via WITH_MODULES.
201
202    EXTRA_LIBS:
203
204        List of additional libraries to link with.  This may be necessary when
205        including third-party modules in the httpd build via WITH_MODULES.
206
207    Port and SSLPort:
208
209        Port numbers for substitution into default .conf files.  (The defaults
210        are 80 and 443.)
211
212    INSTALL_PDB:
213
214        If .pdb files are generated for debugging, install them.
215        Default: ON
216
217        The .pdb files are generally needed for debugging low-level code
218        problems.  If they aren't installed, they are still available in the
219        build directory for use by alternate packaging implementations or when
220        debugging on the build machine.
221
222    INSTALL_MANUAL:
223
224        Install the Apache HTTP Server manual.
225        Default: ON
226
227        This could be turned off when developing changes in order to speed up
228        installation time.
229
230 4. Build using the chosen generator (e.g., "nmake install" for cmake's "NMake
231    Makefiles" generator).
232
233 Running the server and support programs
234 ---------------------------------------
235
236 This build system does not copy binaries such as dlls from other projects
237 into the httpd install location.  Without taking some precautions, httpd
238 and support programs can fail to start or modules can fail to load because
239 a support library can't be found in PATH or in the directory of the httpd
240 binary.
241
242 This can be resolved in several different ways:
243
244 * Install httpd and the various support libraries to a common install
245   prefix so that support libraries and httpd programs are installed in
246   the same bin directory and are found without setting PATH.
247
248 * Update PATH to include the bin directories of all necessary support
249   libraries.
250
251   Depending on where PATH is set, it may not affect starting httpd as
252   a service.
253
254 * Maintain a script which combines required binaries into a common 
255   location, such as the httpd installion bin directory, and use that
256   script after building or otherwise installing or updating support
257   libraries.
258
259 * AVOID THE USE of any unrepeatable process of copying dll files around
260   from different install locations until something starts working.  The
261   result is that when you later update a support library to pick up a
262   security fix, httpd will likely continue to use the old, vulnerable
263   library file.
264
265 Known Bugs and Limitations
266 --------------------------
267
268 * no standard script or makefile is provided to tie together the builds
269   of httpd and support libraries in a manner suitable for typical users
270 * no logic to find support libraries or otherwise build these modules:
271   + mod_socache_dc (requires distcache), mod_serf (requires serf)
272   + additionally, mod_lbmethod_rr and mod_firehose don't compile on Windows
273     anyway
274 * buildmark.c isn't necessarily rebuilt when httpd.exe is regenerated
275 * ApacheMonitor has a build error and is disabled
276 * CGI examples aren't installed
277 * dbmmanage.pl and wintty aren't built/installed
278 * module enablement defaults are not in sync with the autoconf-based build
279 * no support for static support library builds; unclear if that is a
280   requirement; if so: taking PCRE as an example, we'd need to detect that it
281   is static and then turn on PCRE_STATIC for the libhttpd build
282
283 Generally:
284
285 * Many httpd features have not been tested with this build.
286 * Developers need to examine the existing Windows build in great detail and see
287   what is missing from the cmake-based build, whether a feature or some build
288   nuance.
289 * Any feedback you can provide on your experiences with this build will be
290   helpful.