Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
v5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikunj committed Mar 30, 2020
2 parents 046aca0 + 0d787a2 commit a5d25de
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 77 deletions.
11 changes: 10 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ add_library( monerujo

set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/../external-libs)

############
# libsqlite
############

add_library(sqlite STATIC IMPORTED)
set_target_properties(sqlite PROPERTIES IMPORTED_LOCATION
${EXTERNAL_LIBS_DIR}/sqlite/lib/${ANDROID_ABI}/libsqlite3.a)


############
# libsodium
############
Expand Down Expand Up @@ -202,7 +211,7 @@ target_link_libraries( monerujo
boost_system
boost_thread
boost_wserialization

sqlite
ssl
crypto

Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ android {

// Enumerate translated locales
def availableLocales = ["en"]
ndkVersion = '21.0.6113669'
new File("app/src/main/res/").eachFileMatch(~/^values-.*/) { file ->
def languageTag = file.name.substring(7).replace("-r", "-")
availableLocales.add(languageTag)
Expand Down
19 changes: 2 additions & 17 deletions app/src/main/cpp/monerujo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,11 +922,9 @@ Java_com_m2049r_xmrwallet_model_Wallet_createTransactionJ(JNIEnv *env, jobject i
const char *_dst_addr = env->GetStringUTFChars(dst_addr, NULL);
const char *_payment_id = env->GetStringUTFChars(payment_id, NULL);
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);

uint32_t _priority = (uint32_t)priority;
Bitmonero::PendingTransaction *tx = wallet->createTransaction(_dst_addr, _payment_id,
amount, (uint32_t) mixin_count,
_priority,
priority,
(uint32_t) accountIndex);

env->ReleaseStringUTFChars(dst_addr, _dst_addr);
Expand All @@ -943,14 +941,13 @@ Java_com_m2049r_xmrwallet_model_Wallet_createSweepTransaction(JNIEnv *env, jobje

const char *_dst_addr = env->GetStringUTFChars(dst_addr, NULL);
const char *_payment_id = env->GetStringUTFChars(payment_id, NULL);
uint32_t _priority = (uint32_t)priority;
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);

Monero::optional<uint64_t> empty;

Bitmonero::PendingTransaction *tx = wallet->createTransaction(_dst_addr, _payment_id,
empty, (uint32_t) mixin_count,
_priority,
priority,
(uint32_t) accountIndex);

env->ReleaseStringUTFChars(dst_addr, _dst_addr);
Expand Down Expand Up @@ -1013,18 +1010,6 @@ Java_com_m2049r_xmrwallet_model_Wallet_setListenerJ(JNIEnv *env, jobject instanc
}
}

JNIEXPORT jint JNICALL
Java_com_m2049r_xmrwallet_model_Wallet_getDefaultMixin(JNIEnv *env, jobject instance) {
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
return wallet->defaultMixin();
}

JNIEXPORT void JNICALL
Java_com_m2049r_xmrwallet_model_Wallet_setDefaultMixin(JNIEnv *env, jobject instance, jint mixin) {
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
return wallet->setDefaultMixin(mixin);
}

JNIEXPORT jboolean JNICALL
Java_com_m2049r_xmrwallet_model_Wallet_setUserNote(JNIEnv *env, jobject instance,
jstring txid, jstring note) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:3.6.1'
}
}

Expand Down
9 changes: 2 additions & 7 deletions doc/BUILDING-external-libs.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
# Building external libs in Docker

Builds Loki libs for all Android architectures from the [android](https://github.com/loki-project/loki/tree/android) branch.
Builds Loki libs automatically for all Android architectures from the [android](https://github.com/loki-project/loki/tree/android) branch.

Build image from `external-libs/docker` directory:

```Shell
docker build -t loki-android-image .
```

Create container to copy libs:
```Shell
docker create --name loki-android loki-android-image
```

Launch collecting script from `external-libs` directory:
```Shell
./collect.sh loki-android
./collect.sh
```
27 changes: 11 additions & 16 deletions external-libs/collect.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#!/bin/bash

set -e
packages=(boost openssl monero libsodium sqlite)
archs=(arm arm64 x86 x86_64)
#archs=(x86)

build_dir=/opt/android/build
if [ -z $1 ] ; then
echo "Collecting libs from ${build_dir} directory!"
else
build_dir=`pwd`/tmp_build
rm -Rf $build_dir
docker cp $1:/opt/android/build $build_dir
fi
docker container rm loki-android > /dev/null 2>&1

orig_path=$PATH
packages=(boost openssl monero libsodium)
set -e
docker create --name loki-android loki-android-image

archs=(arm arm64 x86 x86_64)
#archs=(x86)
build_dir=`pwd`/tmp_build
rm -Rf $build_dir
docker cp loki-android:/opt/android/build $build_dir

for arch in ${archs[@]}; do
case ${arch} in
Expand Down Expand Up @@ -51,9 +47,8 @@ for arch in ${archs[@]}; do
done
done

if [[ ! -z $1 ]] ; then
rm -rf $build_dir
fi
rm -rf $build_dir
docker container rm loki-android

exit 0

79 changes: 56 additions & 23 deletions external-libs/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
FROM debian:jessie

RUN apt-get update && apt-get install -y unzip automake build-essential curl file pkg-config git python libtool
RUN set -ex && \
apt-get update && \
apt-get install -y eatmydata && \
eatmydata apt-get --no-install-recommends --yes install \
ca-certificates \
apt-transport-https \
curl \
unzip \
automake \
python \
build-essential \
file \
pkg-config \
libssl-dev \
libtool-bin \
git

WORKDIR /opt/android

#Cmake
ARG CMAKE_VERSION=3.12.1
ARG CMAKE_VERSION_DOT=v3.12
ARG CMAKE_HASH=c53d5c2ce81d7a957ee83e3e635c8cda5dfe20c9d501a4828ee28e1615e57ab2
ARG CMAKE_VERSION=3.16.5
ARG CMAKE_VERSION_DOT=v3.16
ARG CMAKE_HASH=5f760b50b8ecc9c0c37135fae5fbf00a2fef617059aa9d61c1bb91653e5a8bfc
RUN set -ex \
&& curl -s -O https://cmake.org/files/${CMAKE_VERSION_DOT}/cmake-${CMAKE_VERSION}.tar.gz \
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}.tar.gz" | sha256sum -c \
Expand Down Expand Up @@ -69,18 +85,18 @@ RUN cd /opt/android \

## Building Boost
RUN cd boost_${BOOST_VERSION} \
&& 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 \
&& 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 \
&& 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 \
&& 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 \
&& 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-atomic --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 \
&& 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-atomic --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 \
&& 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-atomic --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 \
&& 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-atomic --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/arm \
&& ln -sf ../include /opt/android/build/boost/arm64 \
&& ln -sf ../include /opt/android/build/boost/x86 \
&& ln -sf ../include /opt/android/build/boost/x86_64

# Sodium
ARG SODIUM_VERSION=1.0.17
ARG SODIUM_HASH=b732443c442239c2e0184820e9b23cca0de0828c
ARG SODIUM_VERSION=1.0.18-RELEASE
ARG SODIUM_HASH=940ef42797baa0278df6b7fd9e67c7590f87744b
RUN set -ex \
&& cd /opt/android \
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth=1 \
Expand All @@ -95,15 +111,32 @@ RUN cd /opt/android/libsodium \
&& PATH=/opt/android/tool/x86/i686-linux-android/bin:/opt/android/tool/x86/bin:$PATH ; CC=clang CXX=clang++ CFLAGS="-fPIC" CXXFLAGS="-fPIC" ./configure --prefix=/opt/android/build/libsodium/x86 --host=i686-linux-android --enable-static --disable-shared && make && make install && make clean \
&& PATH=/opt/android/tool/x86_64/x86_64-linux-android/bin:/opt/android/tool/x86_64/bin:$PATH ; CC=clang CXX=clang++ CFLAGS="-fPIC" CXXFLAGS="-fPIC" ./configure --prefix=/opt/android/build/libsodium/x86_64 --host=x86_64-linux-android --enable-static --disable-shared && make && make install && make clean

# Sqlite3
ARG SQLITE_VERSION=3310100
ARG SQLITE_HASH=62284efebc05a76f909c580ffa5c008a7d22a1287285d68b7825a2b6b51949ae
RUN set -ex \
&& cd /opt/android \
&& curl -s -O https://sqlite.org/2020/sqlite-autoconf-${SQLITE_VERSION}.tar.gz \
&& echo "${SQLITE_HASH} sqlite-autoconf-${SQLITE_VERSION}.tar.gz" | sha256sum -c \
&& tar xf sqlite-autoconf-${SQLITE_VERSION}.tar.gz \
&& mv sqlite-autoconf-${SQLITE_VERSION} sqlite

## Building Sodium
RUN cd /opt/android/sqlite \
&& PATH=/opt/android/tool/arm/arm-linux-androideabi/bin:/opt/android/tool/arm/bin:$PATH ; CC=clang CXX=clang++ ./configure --prefix=/opt/android/build/sqlite/arm --host=arm-linux-androideabi --disable-shared --with-pic && make && make install && make clean \
&& PATH=/opt/android/tool/arm64/aarch64-linux-android/bin:/opt/android/tool/arm64/bin:$PATH ; CC=clang CXX=clang++ ./configure --prefix=/opt/android/build/sqlite/arm64 --host=aarch64-linux-android --disable-shared --with-pic && make && make install && make clean \
&& PATH=/opt/android/tool/x86/i686-linux-android/bin:/opt/android/tool/x86/bin:$PATH ; CC=clang CXX=clang++ ./configure --prefix=/opt/android/build/sqlite/x86 --host=i686-linux-android --disable-shared --with-pic && make && make install && make clean \
&& PATH=/opt/android/tool/x86_64/x86_64-linux-android/bin:/opt/android/tool/x86_64/bin:$PATH ; CC=clang CXX=clang++ ./configure --prefix=/opt/android/build/sqlite/x86_64 --host=x86_64-linux-android --disable-shared --with-pic && make && make install && make clean

# ZMQ
ARG ZMQ_VERSION=v4.3.1
ARG ZMQ_HASH=2cb1240db64ce1ea299e00474c646a2453a8435b
ARG ZMQ_VERSION=v4.3.2
ARG ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
RUN set -ex \
&& cd /opt/android \
&& git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} --depth=1 \
&& cd libzmq \
&& test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
&& ./autogen.sh \
&& ./autogen.sh

## Building ZMQ
RUN cd /opt/android/libzmq \
Expand All @@ -114,17 +147,17 @@ RUN cd /opt/android/libzmq \

# Building Loki from the latest commit on Android branch, this should be kept up to date with master
# with the necessary fixes by crtlib and m2049r to build for mobile.
RUN cd /opt/android \
&& git clone -b android https://github.com/loki-project/loki.git --recursive --depth=1 \
&& cd loki \
&& mkdir -p build/release \
&& ./build-all-arch.sh
RUN cd /opt/android \
&& git clone -b android https://github.com/loki-project/loki.git --recursive --depth=1 \
&& cd loki \
&& mkdir -p build/release \
&& ./build-all-arch.sh

# Uncomment this section to use loki from the docker directory if you want to
# easily build a custom version not depending on the specified branch above and
# comment out the section above that pulls from github.
# ADD loki /opt/android/loki
# RUN cd /opt/android/loki \
# && rm -rf build \
# && mkdir -p build/release \
# && ./build-all-arch.sh
#ADD loki /opt/android/loki
#RUN cd /opt/android/loki \
# && rm -rf build \
# && mkdir -p build/release \
# && ./build-all-arch.sh
10 changes: 0 additions & 10 deletions external-libs/monero/include/wallet2_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -877,16 +877,6 @@ struct Wallet
virtual Subaddress * subaddress() = 0;
virtual SubaddressAccount * subaddressAccount() = 0;
virtual void setListener(WalletListener *) = 0;
/*!
* \brief defaultMixin - returns number of mixins used in transactions
* \return
*/
virtual uint32_t defaultMixin() const = 0;
/*!
* \brief setDefaultMixin - setum number of mixins to be used for new transactions
* \param arg
*/
virtual void setDefaultMixin(uint32_t arg) = 0;

/*!
* \brief setUserNote - attach an arbitrary string note to a txid
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Jan 14 11:34:34 AEDT 2020
#Mon Mar 23 14:15:55 AEDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

0 comments on commit a5d25de

Please sign in to comment.