forked from cory/tildefriends
76 lines
2.0 KiB
Markdown
76 lines
2.0 KiB
Markdown
|
# How to build Tilde Friends
|
|||
|
|
|||
|
> Disclaimer: this documentation has been written by a Linux user and has not been reviewed by other people on other platforms. The procedure may vary slightly depending on your operating system.
|
|||
|
|
|||
|
Builds **on** Linux (`x86_64` and `aarch64`), MacOS, OpenBSD, and Haiku.
|
|||
|
|
|||
|
Builds **for** all of those host platforms plus `mingw64`, iOS, and android.
|
|||
|
|
|||
|
Dependencies:
|
|||
|
|
|||
|
- `openssl` (`libssl-dev`, in debian-speak)
|
|||
|
|
|||
|
Dependencies for Android:
|
|||
|
|
|||
|
- TODO
|
|||
|
|
|||
|
Dependencies for iOS:
|
|||
|
|
|||
|
- TODO
|
|||
|
|
|||
|
Dependencies for Windows:
|
|||
|
|
|||
|
- TODO
|
|||
|
|
|||
|
> All other dependencies are kept up to date as git submodules.
|
|||
|
|
|||
|
1. Clone the repository with the submodules: `git clone --recursive https://dev.tildefriends.net/cory/tildefriends.git`
|
|||
|
|
|||
|
2. Run `make -j $(nproc) debug` or `make -j $(nproc) release`
|
|||
|
|
|||
|
> If you're unsure whether you should choose `debug` or `release`, stick to `release`.
|
|||
|
|
|||
|
> `-j $(nproc)` will start a compiler for every CPU thread, which will dramatically reduce the time needed to compile Tilde Friends.
|
|||
|
|
|||
|
An executable will be generated in a subdirectory of `out/`
|
|||
|
|
|||
|
It's possible to build for Android, iOS, and Windows on Linux, if you have the right dependencies in the right places. Run `make -j $(nproc) windebug winrelease iosdebug-ipa iosrelease-ipa release-apk`
|
|||
|
|
|||
|
To build in docker, `docker build .`
|
|||
|
|
|||
|
On NixOS: TODO
|
|||
|
|
|||
|
Now that you have a binary, head over to <running.md>.
|
|||
|
|
|||
|
## Troubleshooting
|
|||
|
|
|||
|
### The compiler throws an error and I can't build the binary.
|
|||
|
|
|||
|
Open `GNUMakefile` and edit the CFLAGS environment variable around line 50.
|
|||
|
|
|||
|
For example given this error:
|
|||
|
|
|||
|
```
|
|||
|
src/http.c: In function ‘tf_http_get_cookie’:
|
|||
|
src/http.c:1089:128: error: check of ‘name’ for NULL after already dereferencing it [-Werror=analyzer-deref-before-check]
|
|||
|
```
|
|||
|
|
|||
|
Add:
|
|||
|
|
|||
|
```diff
|
|||
|
CFLAGS += \
|
|||
|
-std=gnu11 \
|
|||
|
-Wall \
|
|||
|
-Wextra \
|
|||
|
-Wno-unused-parameter \
|
|||
|
+ -Wno-analyzer-deref-before-check \
|
|||
|
-MMD \
|
|||
|
-MP \
|
|||
|
-ffunction-sections \
|
|||
|
-fdata-sections \
|
|||
|
-fno-exceptions \
|
|||
|
-g
|
|||
|
```
|
|||
|
|
|||
|
Now the compiler will ignore this error and *should* continue building anyways.
|