]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb/docs/Building.md
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / prometheus-cpp / 3rdparty / civetweb / docs / Building.md
1 Building CivetWeb
2 =========
3
4 This guide covers the build instructions for the stand-alone web server.
5 See [Embedding.md](https://github.com/civetweb/civetweb/blob/master/docs/Embedding.md) for information on extending an existing C or C++ application. A brief overview of the source code files can be found in [Embedding.md](https://github.com/civetweb/civetweb/blob/master/docs/Embedding.md) as well.
6
7 #### Where to get the source code?
8
9 The latest development version can be found at
10 https://github.com/civetweb/civetweb
11
12 Tested and released versions can be found at
13 https://github.com/civetweb/civetweb/releases
14
15
16 Building for Windows
17 ---------
18
19 #### Using Visual Studio
20
21 Open the *VS/civetweb.sln* in Visual Studio.
22 To include SSL support, you may have to add an extra library for the cryptography support. You might wish to use yaSSL. However, it is GPL licensed or uses a commercial license. See [yaSSL.md](https://github.com/civetweb/civetweb/blob/master/docs/yaSSL.md) for more information.
23 Alternatively, you might wish to use OpenSSL. See [OpenSSL.md](https://github.com/civetweb/civetweb/blob/master/docs/OpenSSL.md) for more information.
24
25 #### Using MinGW-w64 or TDM-GCC
26 In the start menu locate and run the "Run terminal" batch file. For TDM-GCC this is named "MinGW Command Prompt".
27 Navigate to the civetweb sources directory and run:
28 ```
29 mingw32-make CC=gcc
30 ```
31
32 #### Using Qt Creator
33 Open the Qt Designer project in the Qt folder
34
35 #### Using CMake
36 Except for the components in the `third_party` folder (e.g., Lua and Duktape), CivetWeb can also be built with CMake.
37 CMake can be used for all supported operating systems.
38
39
40 Building for Linux, BSD, and OSX
41 ---------
42
43 ## Using Make
44
45 ```
46 make help
47 ```
48 Get a list of all supported make option
49
50 ```
51 make build
52 make WITH_ALL=1
53 ```
54 Compile the code.
55 Using the option "WITH_ALL=1" enables all optional features.
56
57 ```
58 make install
59 ```
60 Install on the system, Linux only.
61
62 ```
63 make lib WITH_IPV6=1
64 make clean slib WITH_LUA=1 WITH_WEBSOCKET=1
65 ```
66 Build the static and shared libraries.
67 The additional make options configure the library just as it would the application.
68
69 The *slib* option should be done on a separate clean build as position
70 independent code (PIC) is required for it. Trying to run it after
71 building the static library or the server will result in a link error.
72
73 ```
74 make clean
75 ```
76 Clean up files generated during the build
77
78
79 ## Setting build options
80
81 Make options can be set on the command line with the make command like so.
82 ```
83 make build WITH_LUA=1
84 ```
85
86
87 | Make Options | Description |
88 | --------------------------- | ------------------------------------------------- |
89 | `WITH_LUA=1` | build with Lua support |
90 | `WITH_DUKTAPE=1` | build with server-side JavaScript support |
91 | `WITH_IPV6=1` | with IPV6 support |
92 | `WITH_WEBSOCKET=1` | build with web socket support |
93 | `WITH_X_DOM_SOCKET=1` | build with unix domain socket support |
94 | `WITH_SERVER_STATS=1` | build with support for server statistics |
95 | `WITH_EXPERIMENTAL=1` | include experimental features (version depending) |
96 | `WITH_ALL=1` | Include all of the above features |
97 | `WITH_DEBUG=1` | build with GDB debug support |
98 | `WITH_CPP=1` | build libraries with c++ classes |
99 | `CONFIG_FILE=file` | use 'file' as the config file |
100 | `CONFIG_FILE2=file` | use 'file' as the backup config file |
101 | `HTMLDIR=/path` | place to install initial web pages |
102 | `DOCUMENT_ROOT=/path` | default document root |
103 | `PORTS=8080` | listening ports override when installing |
104 | `SSL_LIB=libssl.so.0` | use versioned SSL library |
105 | `CRYPTO_LIB=libcrypto.so.0` | system versioned CRYPTO library |
106 | `PREFIX=/usr/local` | sets the install directory |
107 | `COPT='-DNO_SSL'` | method to insert compile flags |
108
109 Note that the WITH_* options used for *make* are not identical to the
110 preprocessor defines in the source code - usually USE_* is used there.
111
112
113 ## Changing PREFIX
114
115 To change the target destination pass the `PREFIX` option to the command `make install` (not `make build`). Example usage:
116
117 ```
118 $ make build
119 $ make -n install PREFIX=/opt/civetweb
120 ```
121 Note: The `-n` corresponds to the `--dry-run` option (it does not make any changes): You can see where `make install` would install. Example output of the above command:
122
123 ```
124 $ make -n install PREFIX=/opt/civetweb
125 install -d -m 755 "/opt/civetweb/share/doc/civetweb"
126 install -m 644 resources/itworks.html /opt/civetweb/share/doc/civetweb/index.html
127 install -m 644 resources/civetweb_64x64.png /opt/civetweb/share/doc/civetweb/
128 install -d -m 755 "/opt/civetweb/etc"
129 install -m 644 resources/civetweb.conf "/opt/civetweb/etc/"
130 sed -i 's#^document_root.*$#document_root /opt/civetweb/share/doc/civetweb#' "/opt/civetweb/etc/civetweb.conf"
131 sed -i 's#^listening_ports.*$#listening_ports 8080#' "/opt/civetweb/etc/civetweb.conf"
132 install -d -m 755 "/opt/civetweb/share/doc/civetweb"
133 install -m 644 *.md "/opt/civetweb/share/doc/civetweb"
134 install -d -m 755 "/opt/civetweb/bin"
135 install -m 755 civetweb "/opt/civetweb/bin/"
136 ```
137
138 If the output looks good: Just remove the `-n` option to actually install the software on your system.
139
140
141 ## Setting compile flags
142
143 Compile flags can be set using the *COPT* make option like so.
144 ```
145 make build COPT="-DNDEBUG -DNO_CGI"
146 ```
147
148 | Compile Flags | Description |
149 | ---------------------------- | ------------------------------------------------------------------- |
150 | `NDEBUG` | strip off all debug code |
151 | `DEBUG` | build debug version (very noisy) |
152 | | |
153 | `NO_ATOMICS` | do not use atomic functions, use locks instead |
154 | `NO_CACHING` | disable caching functionality |
155 | `NO_CGI` | disable CGI support |
156 | `NO_FILES` | do not serve files from a directory |
157 | `NO_FILESYSTEMS` | completely disable filesystems usage (requires NO_FILES) |
158 | `NO_NONCE_CHECK` | disable nonce check for HTTP digest authentication |
159 | `NO_RESPONSE_BUFFERING` | send all mg_response_header_* immediately instead of buffering until the mg_response_header_send call |
160 | `NO_SSL` | disable SSL functionality |
161 | `NO_SSL_DL` | link against system libssl library |
162 | `NO_THREAD_NAME` | do not set a name for pthread |
163 | | |
164 | `USE_ALPN` | enable Application-Level-Protocol-Negotiation, required for HTTP2 |
165 | `USE_DUKTAPE` | enable server-side JavaScript (using Duktape library) |
166 | `USE_HTTP2` | enable HTTP2 support (experimental, not reccomended for production) |
167 | `USE_IPV6` | enable IPv6 support |
168 | `USE_LUA` | enable Lua support |
169 | `USE_SERVER_STATS` | enable server statistics support |
170 | `USE_STACK_SIZE` | define stack size instead of using system default |
171 | `USE_WEBSOCKET` | enable websocket support |
172 | `USE_X_DOM_SOCKET` | enable unix domain socket support |
173 | `USE_ZLIB` | enable on-the-fly compression of files (using zlib) |
174 | | |
175 | `MG_EXPERIMENTAL_INTERFACES` | include experimental interfaces |
176 | `MG_LEGACY_INTERFACE` | include obsolete interfaces (candidates for deletion) |
177 | | |
178 | `SQLITE_DISABLE_LFS` | disables large files (Lua only) |
179 | `SSL_ALREADY_INITIALIZED` | do not initialize libcrypto |
180 | `OPENSSL_API_1_0` | Use OpenSSL V1.0.x interface |
181 | `OPENSSL_API_1_1` | Use OpenSSL V1.1.x interface |
182 | | |
183 | `BUILD_DATE` | define as a string to be used as build id instead of __DATE__ |
184 | | |
185
186
187 Note: If `make` is used (with this [Makefile](https://github.com/civetweb/civetweb/blob/master/Makefile)), you should not pass the `USE_<feature>` flags using `COPT`, but use the `WITH_<feature>` syntax above, since additional features may also use additional source code files.
188
189
190 ## Cross Compiling
191
192 Take total control with *CC*, *COPT* and *TARGET_OS* as make options.
193 TARGET_OS is used to determine some compile details as will as code function.
194 TARGET_OS values should be be one found in *resources/Makefile.in-os*.
195
196 ```
197 make CC=arm-none-linux-gnueabi-gcc COPT="-march=armv7-a -mfpu=vfp -mfloat-abi=softfp" TARGET_OS=FROG
198 ```
199
200 ## Cocoa DMG Packaging (OSX Only)
201
202 Use the alternate *Makefile.osx* to do the build. The entire build has
203 to be done using *Makefile.osx* because additional compile and link options
204 are required. This Makefile has all the same options as the other one plus
205 one additional *package* rule.
206
207 ```
208 make -f Makefile.osx package
209 ```
210
211 Building with Buildroot
212 ---------
213
214 [Buildroot](http://buildroot.uclibc.org/) is a tool for creating cross compiled file systems. Including Civetweb in buildroot is fairly easy. There is even support for various build options.
215
216 1. First, check if it already there.
217 - In buildroot, make menuconfig
218 - Package Selection for the target --->
219 - Networking applications --->
220 - civetweb
221 2. If not there, just add it
222 - copy *Config.in* and *civetweb.mk* from Civetweb's *contrib/buildroot/* to Buildroot's *package/civetweb/* directory.
223 - In Buildroot's *package/Config.in, insert the following line in were you will know how to find it in the menu.
224 > ``` source "package/civetweb/Config.in" ```
225
226
227 Building on Android
228 ---------
229
230 This is a small guide to help you run civetweb on Android, originally
231 tested on the HTC Wildfire.
232 Note: You do not need root access to run civetweb on Android.
233
234 - Download the source from the Downloads page.
235 - Download the Android NDK from [http://developer.android.com/tools/sdk/ndk/index.html](http://developer.android.com/tools/sdk/ndk/index.html)
236 - Run `/path-to-ndk/ndk-build -C /path-to-civetweb/resources`
237 That should generate civetweb/lib/armeabi/civetweb
238 - Using the adb tool (you need to have Android SDK installed for that),
239 push the generated civetweb binary to `/data/local` folder on device.
240 - From adb shell, navigate to `/data/local` and execute `./civetweb`.
241 - To test if the server is running fine, visit your web-browser and
242 navigate to `http://127.0.0.1:8080` You should see the `Index of /` page.
243
244
245 Notes:
246
247 - `jni` stands for Java Native Interface. Read up on Android NDK if you want
248 to know how to interact with the native C functions of civetweb in Android
249 Java applications.
250
251
252