Skip to content

Commit 25c95df

Browse files
authored
Merge pull request #4021 from element-hq/rav/build_sdk_for_local_machine
Build SDK for the local hardware
2 parents a470e86 + 56a5f55 commit 25c95df

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

docs/_developer_onboarding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ Prerequisites:
130130
```
131131
cargo install cargo-ndk
132132
```
133-
* Install the Android Rust toolchain:
133+
* Install the Android Rust toolchain for your machine's hardware:
134134
```
135-
rustup target add aarch64-linux-android
135+
rustup target add aarch64-linux-android x86_64-linux-android
136136
```
137137
* Depending on the location of the Android SDK, you may need to set
138138
`ANDROID_HOME`:

tools/sdk/build_rust_sdk.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ buildApp=${buildApp:-no}
5959

6060
cd "${elementPwd}"
6161

62+
default_arch="$(uname -m)-linux-android"
63+
# On ARM MacOS, `uname -m` returns arm64, but the toolchain is called aarch64
64+
default_arch="${default_arch/arm64/aarch64}"
65+
66+
read -p "Enter the architecture you want to build for (default '$default_arch'): " target_arch
67+
target_arch="${target_arch:-${default_arch}}"
68+
6269
# If folder ../matrix-rust-components-kotlin does not exist, clone the repo
6370
if [ ! -d "../matrix-rust-components-kotlin" ]; then
6471
printf "\nFolder ../matrix-rust-components-kotlin does not exist. Cloning the repository into ../matrix-rust-components-kotlin.\n\n"
@@ -71,8 +78,8 @@ git reset --hard
7178
git checkout main
7279
git pull
7380

74-
printf "\nBuilding the SDK for aarch64-linux-android...\n\n"
75-
./scripts/build.sh -p "${rustSdkPath}" -m sdk -t aarch64-linux-android -o "${elementPwd}/libraries/rustsdk"
81+
printf "\nBuilding the SDK for ${target_arch}...\n\n"
82+
./scripts/build.sh -p "${rustSdkPath}" -m sdk -t "${target_arch}" -o "${elementPwd}/libraries/rustsdk"
7683

7784
cd "${elementPwd}"
7885
mv ./libraries/rustsdk/sdk-android-debug.aar ./libraries/rustsdk/matrix-rust-sdk.aar

0 commit comments

Comments
 (0)