Commit b2337b1c authored by Marek Kotewicz's avatar Marek Kotewicz
Browse files

udpated README and build scripts

parent b8f52fd7
# NDK
NDK/
rust/.cargo
# rust output file
*.a
*.so
......
# native-signer
```
npm i
npm start
```
### Requirements
- `node.js` (tested on `v7.4.0`)
- `npm` (tested on `4.0.5`)
- `multirust` (tested on `0.8.0 (8654d1c07 2016-03-08 23:02:12 +0000)`)
- `rustc` (tested on `1.15.1 (021bd294c 2017-02-08)`)
- `cargo` (tested on `0.16.0-nightly (6e0c18c 2017-01-27)`)
- `android_ndk` (tested on `r13b`)
- `Xcode` (only, for iOS, tested on `Version 8.1 (8B62)`)
- `$NDK_HOME` envarionment variable set to ndk home directory (eg. `/usr/local/opt/android-ndk`)
### setup
- macOS
```
./setup_macos.sh
```
- linux
```
./setup_linux.sh
```
### usage
#### Create new account
seed: `this is sparta`
address: `006E27B6A72E1f34C626762F3C4761547Aff1421`
......
[target.aarch64-linux-android]
ar = "$PWD/NDK/arm64/bin/aarch64-linux-android-ar"
linker = "$PWD/NDK/arm64/bin/aarch64-linux-android-gcc"
[target.armv7-linux-androideabi]
ar = "$PWD/NDK/arm/bin/arm-linux-androideabi-ar"
linker = "$PWD/NDK/arm/bin/arm-linux-androideabi-gcc"
[target.i686-linux-android]
ar = "$PWD/NDK/x86/bin/i686-linux-android-ar"
linker = "$PWD/NDK/x86/bin/i686-linux-android-gcc"
#! /bin/sh
# based on https://github.com/kennytm/rust-ios-android
set -euo pipefail
if [ -d NDK ]; then
printf '\e[33;1mStandalone NDK already exists... Delete the NDK folder to make a new one.\e[0m\n\n'
printf '$ rm -rf NDK\n'
exit 0
fi
MAKER="$NDK_HOME/build/tools/make_standalone_toolchain.py"
if [ -x "$MAKER" ]; then
MAKER="$(brew --prefix android-ndk)/build/tools/make_standalone_toolchain.py"
fi
if [ -x "$MAKER" ]; then
echo 'Creating standalone NDK...'
else
printf '\e[91;1mPlease install `android-ndk`!\e[0m\n\n'
printf '$ brew install android-ndk\n'
exit 1
fi
mkdir NDK
cd NDK
for ARCH in arm64 arm x86; do
echo "($ARCH)..."
"$MAKER" --arch $ARCH --install-dir $ARCH
done
echo 'Updating ./rust/.cargo/config.toml...'
cd ..
mkdir -p rust/.cargo
sed 's|$PWD|'"${PWD}"'|g' cargo-config.toml.template > ./rust/.cargo/config
......@@ -3,8 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
"installX": "cd rust/signer && ./setup.sh",
"build-rust": "cd rust/signer && make",
"build-rust": "cd rust/signer && make ios",
"start": "npm run build-rust && node node_modules/react-native/local-cli/cli.js run-ios",
"test": "jest"
},
......
[root]
name = "signer"
version = "0.1.0"
dependencies = [
"ethkey 0.2.0 (git+https://github.com/ethcore/parity)",
"jni 0.3.1 (git+https://github.com/prevoty/jni-rs)",
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.1.0 (git+https://github.com/ethcore/parity)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "arrayvec"
version = "0.3.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ascii"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bigint"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "byteorder"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cesu8"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "combine"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ascii 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "elastic-array"
version = "0.6.0"
source = "git+https://github.com/ethcore/elastic-array#346f1ba5982576dab9d0b8fa178b50e1db0a21cd"
dependencies = [
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "error-chain"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "eth-secp256k1"
version = "0.5.6"
source = "git+https://github.com/ethcore/rust-secp256k1#b6b67055edc929057e97d64f036c78ad91f58a7f"
dependencies = [
"arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ethcore-bigint"
version = "0.1.2"
source = "git+https://github.com/ethcore/parity#7a773b42bf03fa9a0fc7795adb0ef0a245158836"
dependencies = [
"bigint 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "ethkey"
version = "0.2.0"
source = "git+https://github.com/ethcore/parity#7a773b42bf03fa9a0fc7795adb0ef0a245158836"
dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"eth-secp256k1 0.5.6 (git+https://github.com/ethcore/rust-secp256k1)",
"ethcore-bigint 0.1.2 (git+https://github.com/ethcore/parity)",
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gcc"
version = "0.3.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "heapsize"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "jni"
version = "0.3.1"
source = "git+https://github.com/prevoty/jni-rs#a41aad537d4973beed5d9abead8727305c604681"
dependencies = [
"cesu8 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"combine 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"jni-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "jni-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lazy_static"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "log"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "nodrop"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "odds"
version = "0.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rlp"
version = "0.1.0"
source = "git+https://github.com/ethcore/parity#7a773b42bf03fa9a0fc7795adb0ef0a245158836"
dependencies = [
"elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)",
"ethcore-bigint 0.1.2 (git+https://github.com/ethcore/parity)",
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rust-crypto"
version = "0.2.36"
source = "git+https://github.com/debris/rust-crypto#e66897f8cef1085357a89c0f4ec087656dc03034"
dependencies = [
"gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rust-crypto"
version = "0.2.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
replace = "rust-crypto 0.2.36 (git+https://github.com/debris/rust-crypto)"
[[package]]
name = "rustc-serialize"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc_version"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "semver"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "time"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tiny-keccak"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d89f1b0e242270b5b797778af0c8d182a1a2ccac5d8d6fadf414223cc0fab096"
"checksum ascii 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae7d751998c189c1d4468cf0a39bb2eae052a9c58d50ebb3b9591ee3813ad50"
"checksum bigint 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4987c855cbe118271721d21f16cacdfedfe7dbeb7ea5970e4ae33db06602e3f2"
"checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8"
"checksum cesu8 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
"checksum combine 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "89749770bffc77cb34db11b60d5d4b197388b46bc7774ac8acbde33c26ad6c08"
"checksum elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)" = "<none>"
"checksum error-chain 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e92ecf0a508c8e074c0e6fa8fe0fa38414848ad4dfc4db6f74c5e9753330b248"
"checksum eth-secp256k1 0.5.6 (git+https://github.com/ethcore/rust-secp256k1)" = "<none>"
"checksum ethcore-bigint 0.1.2 (git+https://github.com/ethcore/parity)" = "<none>"
"checksum ethkey 0.2.0 (git+https://github.com/ethcore/parity)" = "<none>"
"checksum gcc 0.3.43 (registry+https://github.com/rust-lang/crates.io-index)" = "c07c758b972368e703a562686adb39125707cc1ef3399da8c019fc6c2498a75d"
"checksum heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5a376f7402b85be6e0ba504243ecbc0709c48019ecc6286d0540c2e359050c88"
"checksum jni 0.3.1 (git+https://github.com/prevoty/jni-rs)" = "<none>"
"checksum jni-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "83ba0fad4625733b25833da250d0c84058314e1a276f4939f3e87c195997c206"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b"
"checksum libc 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "684f330624d8c3784fb9558ca46c4ce488073a8d22450415c5eb4f4cfb0d11b5"
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
"checksum nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "52cd74cd09beba596430cc6e3091b74007169a56246e1262f0ba451ea95117b2"
"checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba"
"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d"
"checksum redox_syscall 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8dd35cc9a8bdec562c757e3d43c1526b5c6d2653e23e2315065bc25556550753"
"checksum rlp 0.1.0 (git+https://github.com/ethcore/parity)" = "<none>"
"checksum rust-crypto 0.2.36 (git+https://github.com/debris/rust-crypto)" = "<none>"
"checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a"
"checksum rustc-serialize 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "237546c689f20bb44980270c73c3b9edd0891c1be49cc1274406134a66d3957b"
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade"
"checksum tiny-keccak 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ac274ea206f5352fe553c7b5d8f5658eea51238e747e12968c48705b791b644"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
#! /bin/bash
# android
multirust add-target stable aarch64-linux-android
multirust add-target stable armv7-linux-androideabi
multirust add-target stable i686-linux-android
./create-ndk-standalone.sh
npm i
#!/bin/sh
#! /bin/bash
# ios
multirust add-target stable i386-apple-ios
......@@ -11,3 +11,7 @@ multirust add-target stable aarch64-apple-ios
multirust add-target stable aarch64-linux-android
multirust add-target stable armv7-linux-androideabi
multirust add-target stable i686-linux-android
./create-ndk-standalone.sh
npm i
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment