google / mundane

Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order).
MIT License
1.07k stars 49 forks source link

Eliminating build dependency on Go #13

Open inejge opened 5 years ago

inejge commented 5 years ago

Currently, building Mundane requires Go 1.11+. Utilities in Go are used for three tasks:

  1. Generating the interned error message bundle and its index (crypto/err_data.c in the build tree, from crypto/err/*.errordata in the source tree).

  2. Extracting the names of public symbols from the archive created in the first library build (crypto/libcrypto.a) and saving the result in symbols.txt above the two build directories.

  3. Generating the headers with substitutions from regular to versioned symbol names, using the result of the previous utility.

Those are rather simple programs and I have reimplemented them in Rust without much difficulty. Integrating them into build.rs could lead to elimination of Go as a build dependency of Mundane. While having any single dependency is not particularly onerous, I believe that minimizing their number eases the acceptance of a package, both for developers and end users. Even more so since Go 1.11 is not available on current LTS versions of popular distros.

Would there be any interest of pursuing this further?

joshlf commented 5 years ago

I would absolutely be interested in this! I'm particularly interested in (2) and (3), as I expect I should be able to pre-generate crypto/err_data.c at code commit time.

Also, if you're interested in taking this one step further (not necessarily now, but at some point in the future), I've been hoping to eliminate the need for the two-phase build entirely by updating the libcrypto.a file in place in order to rename symbols. That's probably a much more involved project, but just wanted to put it on your radar in case you're curious.

Ralith commented 5 years ago

It looks like (2) and (3) were fixed in 504093a469b61ac8c6776e41546bafc1d4e20aa6 and d0e536113933e08737714014cb9f67a72a43b41b respectively. Should this be closed, or do we want to write a rust script for (1) too?

joshlf commented 5 years ago

IIUC, we'll still need (1) in order to fully remove the dependency on Go, even if we remove CMake and drive the compilation manually from the build script. @davidben, correct me if I'm wrong on that?

BusyJay commented 4 years ago

You can use the branch "master-with-bazel" or "chromium-stable-with-bazel" maintained by boringssl team to get rid of go.