@@ -16,21 +16,22 @@ use std::env;
1616fn main ( ) {
1717 // Actual build
1818 let mut base_config = cc:: Build :: new ( ) ;
19- base_config. include ( "depend/secp256k1/" )
20- . include ( "depend/secp256k1/include" )
21- . include ( "depend/secp256k1/src" )
22- . flag_if_supported ( "-Wno-unused-function" ) // some ecmult stuff is defined but not used upstream
23- . flag_if_supported ( "-Wno-unused-parameter" ) // patching out printf causes this warning
24- . define ( "SECP256K1_API" , Some ( "" ) )
25- . define ( "ENABLE_MODULE_ECDH" , Some ( "1" ) )
26- . define ( "ENABLE_MODULE_SCHNORRSIG" , Some ( "1" ) )
27- . define ( "ENABLE_MODULE_EXTRAKEYS" , Some ( "1" ) )
28- . define ( "ENABLE_MODULE_ELLSWIFT" , Some ( "1" ) )
29- . define ( "ENABLE_MODULE_MUSIG" , Some ( "1" ) )
30- // upstream sometimes introduces calls to printf, which we cannot compile
31- // with WASM due to its lack of libc. printf is never necessary and we can
32- // just #define it away.
33- . define ( "printf(...)" , Some ( "" ) ) ;
19+ base_config
20+ . include ( "depend/secp256k1/" )
21+ . include ( "depend/secp256k1/include" )
22+ . include ( "depend/secp256k1/src" )
23+ . flag_if_supported ( "-Wno-unused-function" ) // some ecmult stuff is defined but not used upstream
24+ . flag_if_supported ( "-Wno-unused-parameter" ) // patching out printf causes this warning
25+ . define ( "SECP256K1_API" , Some ( "" ) )
26+ . define ( "ENABLE_MODULE_ECDH" , Some ( "1" ) )
27+ . define ( "ENABLE_MODULE_SCHNORRSIG" , Some ( "1" ) )
28+ . define ( "ENABLE_MODULE_EXTRAKEYS" , Some ( "1" ) )
29+ . define ( "ENABLE_MODULE_ELLSWIFT" , Some ( "1" ) )
30+ . define ( "ENABLE_MODULE_MUSIG" , Some ( "1" ) )
31+ // upstream sometimes introduces calls to printf, which we cannot compile
32+ // with WASM due to its lack of libc. printf is never necessary and we can
33+ // just #define it away.
34+ . define ( "printf(...)" , Some ( "" ) ) ;
3435
3536 if cfg ! ( feature = "lowmemory" ) {
3637 base_config. define ( "ECMULT_WINDOW_SIZE" , Some ( "4" ) ) ; // A low-enough value to consume negligible memory
@@ -45,15 +46,15 @@ fn main() {
4546
4647 // WASM headers and size/align defines.
4748 if env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) == "wasm32" {
48- base_config. include ( "wasm/wasm-sysroot" )
49- . file ( "wasm/wasm.c" ) ;
49+ base_config. include ( "wasm/wasm-sysroot" ) . file ( "wasm/wasm.c" ) ;
5050 }
5151
5252 // secp256k1
53- base_config. file ( "depend/secp256k1/contrib/lax_der_parsing.c" )
54- . file ( "depend/secp256k1/src/precomputed_ecmult_gen.c" )
55- . file ( "depend/secp256k1/src/precomputed_ecmult.c" )
56- . file ( "depend/secp256k1/src/secp256k1.c" ) ;
53+ base_config
54+ . file ( "depend/secp256k1/contrib/lax_der_parsing.c" )
55+ . file ( "depend/secp256k1/src/precomputed_ecmult_gen.c" )
56+ . file ( "depend/secp256k1/src/precomputed_ecmult.c" )
57+ . file ( "depend/secp256k1/src/secp256k1.c" ) ;
5758
5859 if base_config. try_compile ( "libsecp256k1.a" ) . is_err ( ) {
5960 // Some embedded platforms may not have, eg, string.h available, so if the build fails
@@ -63,4 +64,3 @@ fn main() {
6364 base_config. compile ( "libsecp256k1.a" ) ;
6465 }
6566}
66-
0 commit comments