Skip to content

Commit f9375be

Browse files
author
Juliette Pretot
committed
Patch the ring build script to enable builds from source code
Turns out that ring includes pre-generated objects in cargo releases. It uses logic in its build scripts to determine whether the build is from a version published on cargo, or from source code. This logic is somewhat naively implemented by checking for the absence of a `.git` directory. This check falesly leads ring to believe it is building from a version published on crates.io, and fails when it tries to include the pregenerated files not present in the source code. To build from source code we must patch this flag.
1 parent b472e82 commit f9375be

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

third_party/ring/build.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,15 @@ fn ring_build_rs_main() {
322322
// Published builds are always built in release mode.
323323
let is_debug = is_git && env::var("DEBUG").unwrap() != "false";
324324

325+
// ring includes pre-generated objects in cargo releases. It uses logic in
326+
// its build scripts to determine whether the build is from a version
327+
// published on cargo, or from source code. This logic is somewhat naively
328+
// implemented by checking for the absence of a `.git` directory. This
329+
// check falesly leads ring to believe it is building from a version
330+
// published on crates.io, and fails when it tries to include the
331+
// pregenerated files not present in the source code. To build from source
332+
// code we must patch this flag.
333+
325334
// If `.git` exists then assume this is the "local hacking" case where
326335
// we want to make it easy to build *ring* using `cargo build`/`cargo test`
327336
// without a prerequisite `package` step, at the cost of needing additional
@@ -330,7 +339,17 @@ fn ring_build_rs_main() {
330339
// If `.git` doesn't exist then assume that this is a packaged build where
331340
// we want to optimize for minimizing the build tools required: No Perl,
332341
// no nasm, etc.
333-
let use_pregenerated = !is_git;
342+
//
343+
// Oak Note:
344+
// ring includes pre-generated objects in cargo releases. It uses logic in
345+
// its build scripts to determine whether the build is from a version
346+
// published on cargo, or from source code. This logic is somewhat naively
347+
// implemented by checking for the absence of a `.git` directory. This
348+
// check falesly leads ring to believe it is building from a version
349+
// published on crates.io, and fails when it tries to include the
350+
// pregenerated files not present in the source code. To build from source
351+
// code we must patch this flag.
352+
let use_pregenerated = false;
334353

335354
// During local development, force warnings in non-Rust code to be treated
336355
// as errors. Since warnings are highly compiler-dependent and compilers

0 commit comments

Comments
 (0)