| OLD | NEW |
| 1 Sample Go application that can be loaded into a mojo shell running on Android. | 1 Sample Go application that can be loaded into a mojo shell running on Android. |
| 2 The application exports a MojoMain entry point for the shell and then makes | 2 The application exports a MojoMain entry point for the shell and then makes |
| 3 a GetTimeTicksNow system call. | 3 a GetTimeTicksNow system call. |
| 4 | 4 |
| 5 Build instructions | 5 Setup instructions |
| 6 gn args <output_directory> | 6 |
| 7 1) Generate the NDK toolchain for the android platform you plan to use. |
| 8 |
| 9 $ cd mojo/src/third_party/android_tools/ndk |
| 10 $ NDK_ROOT=$HOME/android/ndk-toolchain |
| 11 $ ./build/tools/make-standalone-toolchain.sh --platform=android-14 --install-dir
=$NDK_ROOT |
| 12 $ NDK_CC=$NDK_ROOT/bin/arm-linux-androideabi-gcc |
| 13 |
| 14 2) Download/Install the Go compiler. |
| 15 |
| 16 $ unset GOBIN GOPATH GOROOT |
| 17 $ hg clone https://code.google.com/p/go |
| 18 $ cd go/src |
| 19 $ CC_FOR_TARGET=$NDK_CC GOOS=android GOARCH=arm GOARM=7 ./make.bash |
| 20 $ ls ../bin/go |
| 21 |
| 22 3) Now, we switch to the Mojo workspace and build the sample application. |
| 23 |
| 24 $ cd mojo/src |
| 25 $ gn args <output_directory> |
| 7 | 26 |
| 8 Set the following arguments | 27 Set the following arguments |
| 9 mojo_use_go=true | 28 mojo_use_go=true |
| 10 go_build_tool=<go_binary_location> | 29 go_build_tool="<path_to_go_binary>" |
| 11 os="android" | 30 os="android" |
| 12 | 31 |
| 13 gn gen <output_directory> | 32 $ gn gen <output_directory> |
| 14 ninja -C <output_directory> go_sample_app | 33 $ ninja -C <output_directory> go_sample_app |
| 15 | |
| 16 You can now following instructions from the below link to run the app. | |
| 17 http://dev.chromium.org/developers/how-tos/run-mojo-shell | |
| 18 | |
| 19 Start the Go application. | |
| 20 ./build/android/adb_run_mojo_shell http://127.0.0.1:4444/go_sample_app | |
| OLD | NEW |