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