mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-20 19:41:58 +00:00
Update custom build instructions
This commit is contained in:
1 parent
9a28fa71f0
commit
fe124354cd
1 file changed
+14
-27
+14
-27
@@ -328,7 +328,6 @@ uses some proprietary RTOS and network stack). In order to build on such
|
|||||||
systems, follow the outline below:
|
systems, follow the outline below:
|
||||||
|
|
||||||
1. Add `-DMG_ARCH=MG_ARCH_CUSTOM` to your build flags.
|
1. Add `-DMG_ARCH=MG_ARCH_CUSTOM` to your build flags.
|
||||||
|
|
||||||
2. Create a file called `mongoose_custom.h`, with defines and includes that
|
2. Create a file called `mongoose_custom.h`, with defines and includes that
|
||||||
are relevant to your platform. Mongoose uses `bool` type, `MG_DIRSEP` define,
|
are relevant to your platform. Mongoose uses `bool` type, `MG_DIRSEP` define,
|
||||||
and optionally other structures like `DIR *` depending on the functionality
|
and optionally other structures like `DIR *` depending on the functionality
|
||||||
@@ -340,33 +339,21 @@ you have enabled - see previous section. Below is an example:
|
|||||||
|
|
||||||
#define MG_DIRSEP '/'
|
#define MG_DIRSEP '/'
|
||||||
#define MG_INT64_FMT "%lld"
|
#define MG_INT64_FMT "%lld"
|
||||||
#define MG_ENABLE_SOCKET 0 // Disable BSD socket API, implement your own
|
|
||||||
```
|
```
|
||||||
|
3. This step is optional, and only required if you intend to use a custom
|
||||||
3. This step is optional. If you have disabled BSD socket API, your build is
|
TCP/IP stack. To do that, you should:
|
||||||
going to fail due to several undefined symbols. Create `mongoose_custom.c`
|
* Disable BSD socket API: in the `mongoose_custom.h`, add
|
||||||
and implement the following functions (take a look at
|
```c
|
||||||
[test/mongoose_custom.c](https://github.com/cesanta/mongoose/blob/master/test/mongoose_custom.c)
|
#define MG_ENABLE_SOCKET 0
|
||||||
for the reference implementation that does nothing):
|
```
|
||||||
|
* Add an implementation of several internal API functions, like
|
||||||
```c
|
`mg_send()`, `mg_mgr_poll()`, etc. For the reference, take
|
||||||
void mg_connect_resolved(struct mg_connection *c) {
|
a look at the stub
|
||||||
// implement this!
|
"do nothing" implementation at
|
||||||
}
|
[test/mongoose_custom.c](https://github.com/cesanta/mongoose/blob/master/test/mongoose_custom.c)
|
||||||
|
and the experimental builtin bare metal TCP/IP stack implementation
|
||||||
bool mg_open_listener(struct mg_connection *c, const char *url) {
|
at
|
||||||
// implement this!
|
[src/mip.c](https://github.com/cesanta/mongoose/blob/master/src/mip.c)
|
||||||
}
|
|
||||||
|
|
||||||
void mg_mgr_poll(struct mg_mgr *mgr, int ms) {
|
|
||||||
// implement this!
|
|
||||||
}
|
|
||||||
|
|
||||||
int mg_send(struct mg_connection *c, const void *buf, size_t len) {
|
|
||||||
// implement this!
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Minimal HTTP server
|
## Minimal HTTP server
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user