2017-08-14 02:05:28 -06:00
|
|
|
# BUILDING external libs
|
|
|
|
|
|
|
|
Based on https://forum.getmonero.org/5/support/87643/building-monero-v0-10-3-1-for-android and the internet.
|
|
|
|
|
2018-02-26 23:22:11 -07:00
|
|
|
Do not follow this blindly.
|
|
|
|
|
2018-03-29 14:35:31 -06:00
|
|
|
These instructions are tailored to building ```wallep_api```.
|
|
|
|
|
2018-02-26 23:22:11 -07:00
|
|
|
These instructions build all supported architectures: ```'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'```.
|
|
|
|
|
|
|
|
Yes, lots of copy&paste here. TODO: Script this.
|
2017-08-14 02:05:28 -06:00
|
|
|
|
|
|
|
## Prepare Ubuntu environment
|
|
|
|
|
2018-03-29 14:35:31 -06:00
|
|
|
```Shell
|
2017-09-27 11:57:27 -06:00
|
|
|
sudo apt-get install build-essential cmake tofrodos libtool-bin
|
2017-08-14 02:05:28 -06:00
|
|
|
sudo mkdir /opt/android
|
|
|
|
sudo chown $LOGNAME /opt/android
|
|
|
|
```
|
|
|
|
|
|
|
|
## Install Android NDK
|
2018-03-29 14:35:31 -06:00
|
|
|
```Shell
|
2017-08-14 02:05:28 -06:00
|
|
|
cd /opt/android
|
2018-03-29 14:35:31 -06:00
|
|
|
wget https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
|
|
|
|
unzip android-ndk-r16b-linux-x86_64.zip
|
|
|
|
ln -s android-ndk-r16b ndk
|
|
|
|
ndk/build/tools/make_standalone_toolchain.py --api 21 --stl=libc++ --arch arm --install-dir /opt/android/tool/arm
|
|
|
|
ndk/build/tools/make_standalone_toolchain.py --api 21 --stl=libc++ --arch arm64 --install-dir /opt/android/tool/arm64
|
|
|
|
ndk/build/tools/make_standalone_toolchain.py --api 21 --stl=libc++ --arch x86 --install-dir /opt/android/tool/x86
|
|
|
|
ndk/build/tools/make_standalone_toolchain.py --api 21 --stl=libc++ --arch x86_64 --install-dir /opt/android/tool/x86_64
|
|
|
|
```
|
|
|
|
|
|
|
|
## Prepare output
|
|
|
|
```Shell
|
|
|
|
mkdir -p /opt/android/build
|
2017-08-14 02:05:28 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
## Build OpenSSL
|
|
|
|
Best is to compile openssl from sources. Copying from your phone or elsewhere (don't!) ends up in misery.
|
|
|
|
|
2018-02-26 23:22:11 -07:00
|
|
|
If you don't want to build for all architectures, edit ```build-all-arch.sh``` before running it (Line 12).
|
2017-08-14 02:05:28 -06:00
|
|
|
|
2018-03-29 14:35:31 -06:00
|
|
|
```Shell
|
2018-02-26 23:22:11 -07:00
|
|
|
cd /opt/android
|
|
|
|
git clone https://github.com/m2049r/android-openssl.git
|
2017-08-14 02:05:28 -06:00
|
|
|
wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2l.tar.gz
|
2018-02-26 23:22:11 -07:00
|
|
|
cd android-openssl
|
|
|
|
tar xfz ../OpenSSL_1_0_2l.tar.gz
|
2018-09-21 01:52:07 -06:00
|
|
|
PATH="${PATH}:/opt/android/tool/arm/bin/:/opt/android/tool/arm64/bin/:/opt/android/tool/x86/bin/:/opt/android/tool/x86_64/bin" \
|
2018-03-29 14:35:31 -06:00
|
|
|
ANDROID_NDK_ROOT=/opt/android/ndk ./build-all-arch.sh
|
2017-08-14 02:05:28 -06:00
|
|
|
```
|
|
|
|
|
2018-03-29 14:35:31 -06:00
|
|
|
### Install & make symlinks
|
|
|
|
```Shell
|
|
|
|
mkdir -p /opt/android/build/openssl/{arm,arm64,x86,x86_64}
|
|
|
|
cp -a /opt/android/android-openssl/prebuilt/armeabi /opt/android/build/openssl/arm/lib
|
|
|
|
cp -a /opt/android/android-openssl/prebuilt/arm64-v8a /opt/android/build/openssl/arm64/lib
|
|
|
|
cp -a /opt/android/android-openssl/prebuilt/x86 /opt/android/build/openssl/x86/lib
|
|
|
|
cp -a /opt/android/android-openssl/prebuilt/x86_64 /opt/android/build/openssl/x86_64/lib
|
|
|
|
cp -aL /opt/android/android-openssl/openssl-OpenSSL_1_0_2l/include/openssl/ /opt/android/build/openssl/include
|
|
|
|
ln -s /opt/android/build/openssl/include /opt/android/build/openssl/arm/include
|
|
|
|
ln -s /opt/android/build/openssl/include /opt/android/build/openssl/arm64/include
|
|
|
|
ln -s /opt/android/build/openssl/include /opt/android/build/openssl/x86/include
|
|
|
|
ln -s /opt/android/build/openssl/include /opt/android/build/openssl/x86_64/include
|
2017-08-14 02:05:28 -06:00
|
|
|
```
|
2018-03-29 14:35:31 -06:00
|
|
|
```Shell
|
|
|
|
ln -sf /opt/android/build/openssl/include /opt/android/tool/arm/sysroot/usr/include/openssl
|
2018-04-05 11:09:30 -06:00
|
|
|
ln -sf /opt/android/build/openssl/arm/lib/*.so /opt/android/tool/arm/sysroot/usr/lib
|
2018-03-29 14:35:31 -06:00
|
|
|
|
|
|
|
ln -sf /opt/android/build/openssl/include /opt/android/tool/arm64/sysroot/usr/include/openssl
|
2018-04-05 11:09:30 -06:00
|
|
|
ln -sf /opt/android/build/openssl/arm64/lib/*.so /opt/android/tool/arm64/sysroot/usr/lib
|
2018-03-29 14:35:31 -06:00
|
|
|
|
|
|
|
ln -sf /opt/android/build/openssl/include /opt/android/tool/x86/sysroot/usr/include/openssl
|
2018-04-05 11:09:30 -06:00
|
|
|
ln -sf /opt/android/build/openssl/x86/lib/*.so /opt/android/tool/x86/sysroot/usr/lib
|
2018-03-29 14:35:31 -06:00
|
|
|
|
|
|
|
ln -sf /opt/android/build/openssl/include /opt/android/tool/x86_64/sysroot/usr/include/openssl
|
2018-04-05 11:09:30 -06:00
|
|
|
ln -sf /opt/android/build/openssl/x86_64/lib/*.so /opt/android/tool/x86_64/sysroot/usr/lib64
|
2017-08-14 02:05:28 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
## Build Boost
|
2018-03-29 14:35:31 -06:00
|
|
|
```Shell
|
2017-08-14 02:05:28 -06:00
|
|
|
cd /opt/android
|
2017-09-27 11:57:27 -06:00
|
|
|
wget https://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz/download -O boost_1_58_0.tar.gz
|
|
|
|
tar xfz boost_1_58_0.tar.gz
|
2018-02-26 23:22:11 -07:00
|
|
|
cd boost_1_58_0
|
|
|
|
./bootstrap.sh
|
2017-08-14 02:05:28 -06:00
|
|
|
```
|
2018-03-29 14:35:31 -06:00
|
|
|
Comment out ```using ::fgetpos;``` & ```using ::fsetpos;``` in ```cstdio```.
|
2018-09-21 01:52:07 -06:00
|
|
|
```
|
2018-09-25 13:27:05 -06:00
|
|
|
sed -ibackup "s|using ::fgetpos;|//using ::fgetpos;|" /opt/android/tool/arm/include/c++/4.9.x/cstdio
|
|
|
|
sed -ibackup "s|using ::fsetpos;|//using ::fsetpos;|" /opt/android/tool/arm/include/c++/4.9.x/cstdio
|
|
|
|
sed -ibackup "s|using ::fgetpos;|//using ::fgetpos;|" /opt/android/tool/arm64/include/c++/4.9.x/cstdio
|
|
|
|
sed -ibackup "s|using ::fsetpos;|//using ::fsetpos;|" /opt/android/tool/arm64/include/c++/4.9.x/cstdio
|
|
|
|
sed -ibackup "s|using ::fgetpos;|//using ::fgetpos;|" /opt/android/tool/x86/include/c++/4.9.x/cstdio
|
|
|
|
sed -ibackup "s|using ::fsetpos;|//using ::fsetpos;|" /opt/android/tool/x86/include/c++/4.9.x/cstdio
|
|
|
|
sed -ibackup "s|using ::fgetpos;|//using ::fgetpos;|" /opt/android/tool/x86_64/include/c++/4.9.x/cstdio
|
|
|
|
sed -ibackup "s|using ::fsetpos;|//using ::fsetpos;|" /opt/android/tool/x86_64/include/c++/4.9.x/cstdio
|
2018-09-21 01:52:07 -06:00
|
|
|
```
|
2017-08-14 02:05:28 -06:00
|
|
|
|
2018-03-29 14:35:31 -06:00
|
|
|
Then build & install to ```/opt/android/build/boost``` with
|
|
|
|
```Shell
|
|
|
|
PATH=/opt/android/tool/arm/arm-linux-androideabi/bin:/opt/android/tool/arm/bin:$PATH ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --build-dir=android-arm --prefix=/opt/android/build/boost/arm --includedir=/opt/android/build/boost/include toolset=clang threading=multi threadapi=pthread target-os=android install
|
|
|
|
ln -sf ../include /opt/android/build/boost/arm
|
|
|
|
PATH=/opt/android/tool/arm64/aarch64-linux-android/bin:/opt/android/tool/arm64/bin:$PATH ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --build-dir=android-arm64 --prefix=/opt/android/build/boost/arm64 --includedir=/opt/android/build/boost/include toolset=clang threading=multi threadapi=pthread target-os=android install
|
|
|
|
ln -sf ../include /opt/android/build/boost/arm64
|
|
|
|
PATH=/opt/android/tool/x86/i686-linux-android/bin:/opt/android/tool/x86/bin:$PATH ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --build-dir=android-x86 --prefix=/opt/android/build/boost/x86 --includedir=/opt/android/build/boost/include toolset=clang threading=multi threadapi=pthread target-os=android install
|
|
|
|
ln -sf ../include /opt/android/build/boost/x86
|
|
|
|
PATH=/opt/android/tool/x86_64/x86_64-linux-android/bin:/opt/android/tool/x86_64/bin:$PATH ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --build-dir=android-x86_64 --prefix=/opt/android/build/boost/x86_64 --includedir=/opt/android/build/boost/include toolset=clang threading=multi threadapi=pthread target-os=android install
|
|
|
|
ln -sf ../include /opt/android/build/boost/x86_64
|
2017-09-27 11:57:27 -06:00
|
|
|
```
|
|
|
|
|
2017-08-14 02:05:28 -06:00
|
|
|
## And finally: Build Monero
|
2018-03-29 14:35:31 -06:00
|
|
|
```Shell
|
2017-08-14 02:05:28 -06:00
|
|
|
cd /opt/android
|
2018-02-26 23:22:11 -07:00
|
|
|
git clone https://github.com/m2049r/monero.git
|
2018-09-21 01:52:07 -06:00
|
|
|
cd monero
|
|
|
|
git checkout release-v0.12.3
|
2018-02-26 23:22:11 -07:00
|
|
|
|
2018-03-29 14:35:31 -06:00
|
|
|
./build-all-arch.sh
|
2017-08-14 02:05:28 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
# Bringing it all together
|
|
|
|
- Copy all .a libraries into the appropriate `external-libs` folders.
|
2018-03-29 14:35:31 -06:00
|
|
|
- Copy `/opt/android/monero/src/wallet/api/wallet2_api.h` into `external-libs/monero/include`
|
2018-02-26 23:22:11 -07:00
|
|
|
|
|
|
|
If using default locations, this would mean:
|
2018-03-29 14:35:31 -06:00
|
|
|
```Shell
|
|
|
|
cd <path-to-xmrwallet>/external-libs
|
|
|
|
# remove old stuff
|
|
|
|
find . -name "*.a" -or -name "*.h" -type f -delete
|
|
|
|
./collect.sh
|
2018-02-26 23:22:11 -07:00
|
|
|
```
|