From f91ced311b886f559344a26e9cb2e1cf724288f5 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Wed, 6 Jul 2022 12:27:19 -0700 Subject: [PATCH] release profile --- Makefile | 12 ++++++++++++ crypter-ffi/Cargo.toml | 11 +++++++++-- crypter-ffi/readme.md | 13 +++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c70ad52 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ + +prepare-android: + rustup toolchain install stable + rustup target add x86_64-linux-android + rustup target add x86_64-unknown-linux-gnu + rustup target add aarch64-linux-android + rustup target add armv7-linux-androideabi + rustup target add i686-linux-android + make install-uniffi-bindgen + +install-uniffi-bindgen: + cargo install uniffi_bindgen --version 0.19.2 \ No newline at end of file diff --git a/crypter-ffi/Cargo.toml b/crypter-ffi/Cargo.toml index 27d15a2..6f5f416 100644 --- a/crypter-ffi/Cargo.toml +++ b/crypter-ffi/Cargo.toml @@ -5,19 +5,26 @@ authors = ["Evan Feenstra "] edition = "2018" [lib] -crate-type = ["cdylib"] name = "crypter" +crate-type = ["staticlib", "cdylib"] [dependencies] sphinx-key-crypter = { path = "../crypter" } uniffi = "0.19.2" hex = "0.4.3" thiserror = "1.0.31" -uniffi_macros = "0.11.0" +uniffi_macros = "0.19.2" [build-dependencies] uniffi_build = "0.19.2" +[profile.release] +opt-level = 'z' # Optimize for size. +lto = true # Enable Link Time Optimization +codegen-units = 1 # Reduce number of codegen units to increase optimizations. +# panic = 'abort' # Abort on panic +debug = true # Enable debug symbols. For example, we can use `dwarfdump` to check crash traces. + [patch.crates-io] getrandom = { version = "0.2", git = "https://github.com/esp-rs-compat/getrandom.git" } secp256k1 = { git = "https://github.com/Evanfeenstra/rust-secp256k1", branch = "v0.22.0-new-rand" } diff --git a/crypter-ffi/readme.md b/crypter-ffi/readme.md index 5ae03dc..f2984eb 100644 --- a/crypter-ffi/readme.md +++ b/crypter-ffi/readme.md @@ -1,8 +1,21 @@ uniffi-bindgen --version + should match the uniffi version in Cargo.toml +### kotlin + +rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android x86_64-unknown-linux-gnu + uniffi-bindgen generate src/crypter.udl --language kotlin +cargo build --target aarch64-linux-android --release +cargo build --target armv7-linux-androideabi --release +cargo build --target i686-linux-android --release + +cross build --target aarch64-linux-android --release + +### swift + uniffi-bindgen generate src/crypter.udl --language swift ### manually build the C ffi