Skip to content

Commit

Permalink
build: set -O1 on debug builds
Browse files Browse the repository at this point in the history
This gets rid of the spammy FORTIFY_SOURCE warnings.

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Apr 3, 2024
1 parent 2675e72 commit a39dc3b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ fn secp256k1_build() {
.file("nostrdb/deps/secp256k1/src/precomputed_ecmult.c")
.file("nostrdb/deps/secp256k1/src/secp256k1.c");

if env::var("PROFILE").unwrap() == "debug" {
base_config.flag("-O1");
}

if base_config.try_compile("libsecp256k1.a").is_err() {
// Some embedded platforms may not have, eg, string.h available, so if the build fails
// simply try again with the wasm sysroot (but without the wasm type sizes) in the hopes
Expand Down Expand Up @@ -80,6 +84,7 @@ fn main() {

if env::var("PROFILE").unwrap() == "debug" {
build.flag("-DDEBUG");
build.flag("-O1");
}

build.compile("libnostrdb.a");
Expand Down

0 comments on commit a39dc3b

Please sign in to comment.