tildefriends/docs/building.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
2.2 KiB
Markdown
Raw Normal View History

2024-05-11 13:47:14 -04:00
# 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`.
2024-05-11 13:47:14 -04:00
> `-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 -->
<!-- Add shell.nix and nix derivs first -->
2024-05-11 13:47:14 -04:00
Now that you have a binary, head over to <running.md>.
## Troubleshooting
### The compiler throws an error and I can't build the binary
2024-05-11 13:47:14 -04:00
2024-05-12 04:59:26 -04:00
You can choose to tell the compiler to ignore warnings.
2024-05-11 13:47:14 -04:00
Open `GNUMakefile` and edit the CFLAGS environment variable around line 50.
For example given this error:
```text
2024-05-11 15:54:55 -04:00
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]
2024-05-11 13:47:14 -04:00
```
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.
2024-05-12 04:59:26 -04:00
This is a dirty hack to get Tilde Friends to compile and you should not propose to keep this flag on. Instead, open a bug report.