@@ -39,22 +39,25 @@ fn main() {
39
39
// TODO these three should be changed to use libgmp, at least until secp PR 290 is merged
40
40
. define ( "USE_NUM_NONE" , Some ( "1" ) )
41
41
. define ( "USE_FIELD_INV_BUILTIN" , Some ( "1" ) )
42
- . define ( "USE_SCALAR_INV_BUILTIN" , Some ( "1" ) )
43
- . compiler ( "/usr/local/opt/llvm/bin/clang" )
44
- . flag ( "--sysroot=/opt/riscv/riscv32-unknown-elf" ) // https://github.com/riscv-collab/riscv-gnu-toolchain has been built and stored in /opt/riscv
45
- . flag ( "--gcc-toolchain=/opt/riscv" ) // https://github.com/riscv-collab/riscv-gnu-toolchain has been built and stored in /opt/riscv
46
- . no_default_flags ( true )
47
- . flag ( "-O3" )
48
- . flag ( "--target=riscv32-unknown-none-elf" )
49
- . flag ( "-mabi=ilp32" )
50
- . flag ( "-mcmodel=medany" )
51
- . flag ( "-Os" )
52
- . flag ( "-fdata-sections" )
53
- . flag ( "-ffunction-sections" )
54
- . flag ( "-dead_strip" )
55
- . flag ( "-flto" )
56
- . flag ( "-march=rv32im" )
57
- . target ( "riscv32-unknown-none-elf" ) ;
42
+ . define ( "USE_SCALAR_INV_BUILTIN" , Some ( "1" ) ) ;
43
+
44
+ if env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) == "riscv32" {
45
+ base_config. compiler ( "/usr/local/opt/llvm/bin/clang" )
46
+ . flag ( "--sysroot=/opt/riscv/riscv32-unknown-elf" ) // https://github.com/riscv-collab/riscv-gnu-toolchain has been built and stored in /opt/riscv
47
+ . flag ( "--gcc-toolchain=/opt/riscv" ) // https://github.com/riscv-collab/riscv-gnu-toolchain has been built and stored in /opt/riscv
48
+ . no_default_flags ( true )
49
+ . flag ( "-O3" )
50
+ . flag ( "--target=riscv32-unknown-none-elf" )
51
+ . flag ( "-mabi=ilp32" )
52
+ . flag ( "-mcmodel=medany" )
53
+ . flag ( "-Os" )
54
+ . flag ( "-fdata-sections" )
55
+ . flag ( "-ffunction-sections" )
56
+ . flag ( "-dead_strip" )
57
+ . flag ( "-flto" )
58
+ . flag ( "-march=rv32im" )
59
+ . target ( "riscv32-unknown-none-elf" ) ;
60
+ }
58
61
59
62
if cfg ! ( feature = "lowmemory" ) {
60
63
base_config. define ( "ECMULT_WINDOW_SIZE" , Some ( "4" ) ) ; // A low-enough value to consume negligible memory
0 commit comments