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