Skip to content

Commit a845117

Browse files
committed
feat: generate boringssl.nim
1 parent d4f78ee commit a845117

8 files changed

Lines changed: 69751 additions & 1 deletion

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ import boringssl
3838

3939
The bindings expose BoringSSL's C API; refer to the headers under [`boringssl/include/openssl/`](boringssl/include/openssl/) for the available symbols.
4040

41+
[`boringssl.nim`](boringssl.nim) is a generated file. It is the concatenation of [`prelude.nim`](prelude.nim) — which carries the build glue (`{.compile:.}` directives for the C/assembly sources, compiler flags, platform guards) — and `tmp_boringssl_ffi.nim`, the raw FFI bindings produced by [futhark](https://github.com/PMunch/futhark) from the BoringSSL headers. See [Regenerating bindings](#regenerating-bindings) below.
42+
43+
BoringSSL is a C++ library, so [`config.nims`](config.nims) overrides the linker to `g++` (Linux), `clang++` (macOS) for downstream builds. Windows uses the default `clang` toolchain.
44+
4145
## Build options
4246

4347
| Define | Default | Effect |
@@ -51,6 +55,16 @@ The bindings expose BoringSSL's C API; refer to the headers under [`boringssl/in
5155
- **Linux i386**: requires `-msse2` (set automatically).
5256
- **Threads**: bindings are built with `--threads:on` for testing; downstream consumers may build either way.
5357

58+
## Regenerating bindings
59+
60+
The committed [`boringssl.nim`](boringssl.nim) only needs to be regenerated when the BoringSSL submodule is bumped or when the set of imported headers in [`generate_boringssl_ffi.nim`](generate_boringssl_ffi.nim) changes. The [`build.sh`](build.sh) script drives the whole flow:
61+
62+
```sh
63+
./build.sh
64+
```
65+
66+
It installs `futhark@0.15.0`, runs `generate_boringssl_ffi.nim` to emit `tmp_boringssl_ffi.nim`, and prepends `prelude.nim` to produce the final `boringssl.nim`.
67+
5468
## Testing
5569

5670
```sh

0 commit comments

Comments
 (0)