Skip to content

Commit

Permalink
udpated README and build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
debris committed Mar 7, 2017
1 parent b8f52fd commit b2337b1
Show file tree
Hide file tree
Showing 9 changed files with 390 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# NDK
NDK/
rust/.cargo

# rust output file
*.a
*.so
Expand Down
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
# 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`
Expand Down
11 changes: 11 additions & 0 deletions cargo-config.toml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[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"
40 changes: 40 additions & 0 deletions create-ndk-standalone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /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 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 0 additions & 1 deletion rust/signer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
target
Cargo.lock
Loading

0 comments on commit b2337b1

Please sign in to comment.