This commit is contained in:
m2049r 2021-04-23 23:28:53 +02:00
commit 8d90287bca
No known key found for this signature in database
GPG Key ID: 4386E69AF260078D
10 changed files with 19 additions and 336 deletions

View File

@ -21,6 +21,7 @@ import android.os.Parcelable;
import com.m2049r.xmrwallet.model.PendingTransaction; import com.m2049r.xmrwallet.model.PendingTransaction;
import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.model.Wallet;
import com.m2049r.xmrwallet.util.Helper;
// https://stackoverflow.com/questions/2139134/how-to-send-an-object-from-one-android-activity-to-another-using-intents // https://stackoverflow.com/questions/2139134/how-to-send-an-object-from-one-android-activity-to-another-using-intents
public class TxData implements Parcelable { public class TxData implements Parcelable {
@ -54,7 +55,7 @@ public class TxData implements Parcelable {
} }
public double getAmountAsDouble() { public double getAmountAsDouble() {
return 1.0 * amount / 1000000000000L; return 1.0 * amount / Helper.ONE_XMR;
} }
public int getMixin() { public int getMixin() {

View File

@ -139,7 +139,7 @@ public class SendAmountWizardFragment extends SendWizardFragment {
Timber.d("onResumeFragment()"); Timber.d("onResumeFragment()");
Helper.showKeyboard(getActivity()); Helper.showKeyboard(getActivity());
final long funds = getTotalFunds(); final long funds = getTotalFunds();
maxFunds = 1.0 * funds / 1000000000000L; maxFunds = 1.0 * funds / Helper.ONE_XMR;
if (!sendListener.getActivityCallback().isStreetMode()) { if (!sendListener.getActivityCallback().isStreetMode()) {
tvFunds.setText(getString(R.string.send_available, tvFunds.setText(getString(R.string.send_available,
Wallet.getDisplayAmount(funds))); Wallet.getDisplayAmount(funds)));

View File

@ -34,6 +34,7 @@ import com.m2049r.xmrwallet.service.shift.ShiftException;
import com.m2049r.xmrwallet.service.shift.sideshift.api.QueryOrderParameters; import com.m2049r.xmrwallet.service.shift.sideshift.api.QueryOrderParameters;
import com.m2049r.xmrwallet.service.shift.sideshift.api.SideShiftApi; import com.m2049r.xmrwallet.service.shift.sideshift.api.SideShiftApi;
import com.m2049r.xmrwallet.service.shift.sideshift.network.SideShiftApiImpl; import com.m2049r.xmrwallet.service.shift.sideshift.network.SideShiftApiImpl;
import com.m2049r.xmrwallet.util.Helper;
import com.m2049r.xmrwallet.util.OkHttpHelper; import com.m2049r.xmrwallet.util.OkHttpHelper;
import com.m2049r.xmrwallet.util.ServiceHelper; import com.m2049r.xmrwallet.util.ServiceHelper;
import com.m2049r.xmrwallet.widget.ExchangeOtherEditText; import com.m2049r.xmrwallet.widget.ExchangeOtherEditText;
@ -179,7 +180,7 @@ public class SendBtcAmountWizardFragment extends SendWizardFragment {
tvXmrToParms.setText(xmrParmText); tvXmrToParms.setText(xmrParmText);
final long funds = getTotalFunds(); final long funds = getTotalFunds();
double availableXmr = 1.0 * funds / 1000000000000L; double availableXmr = 1.0 * funds / Helper.ONE_XMR;
String availBtcString; String availBtcString;
String availXmrString; String availXmrString;

View File

@ -81,6 +81,7 @@ public class Helper {
static public final String BASE_CRYPTO = Crypto.XMR.getSymbol(); static public final String BASE_CRYPTO = Crypto.XMR.getSymbol();
static public final int XMR_DECIMALS = 11; static public final int XMR_DECIMALS = 11;
static public final long ONE_XMR = Math.round(Math.pow(10, Helper.XMR_DECIMALS));
static public final boolean SHOW_EXCHANGERATES = false; static public final boolean SHOW_EXCHANGERATES = false;
static public final boolean ALLOW_SHIFT = false; static public final boolean ALLOW_SHIFT = false;

View File

@ -349,11 +349,13 @@ public class ExchangeEditText extends LinearLayout {
} }
} }
private static final String CLEAN_FORMAT = "%." + Helper.XMR_DECIMALS + "f";
private String getCleanAmountString(String enteredAmount) { private String getCleanAmountString(String enteredAmount) {
try { try {
double amount = Double.parseDouble(enteredAmount); double amount = Double.parseDouble(enteredAmount);
if (amount >= 0) { if (amount >= 0) {
return String.format(Locale.US, "%,.12f", amount); return String.format(Locale.US, CLEAN_FORMAT, amount);
} else { } else {
return null; return null;
} }

View File

@ -2,23 +2,15 @@ FLAVOUR=wownero
all: arm64-v8a x86_64 include VERSION all: arm64-v8a x86_64 include VERSION
arm64-v8a: $(FLAVOUR) arm64-v8a: $(FLAVOUR) android64.Dockerfile
-rm -rf arm64-v8a -rm -rf arm64-v8a
-docker container rm $(FLAVOUR)-android-arm64 -f -docker container rm $(FLAVOUR)-android-arm64 -f
docker build -f android64.Dockerfile -t $(FLAVOUR)-android-arm64 $(FLAVOUR) docker build -f android64.Dockerfile -t $(FLAVOUR)-android-arm64 $(FLAVOUR)
docker create -it --name $(FLAVOUR)-android-arm64 $(FLAVOUR)-android-arm64 bash docker create -it --name $(FLAVOUR)-android-arm64 $(FLAVOUR)-android-arm64 bash
docker cp $(FLAVOUR)-android-arm64:/opt/android/prefix/lib/. arm64-v8a/ docker cp $(FLAVOUR)-android-arm64:/opt/android/prefix/lib/. arm64-v8a/
docker cp $(FLAVOUR)-android-arm64:/src/build/release/lib/. arm64-v8a//$(FLAVOUR) docker cp $(FLAVOUR)-android-arm64:/src/build/release/lib/. arm64-v8a/$(FLAVOUR)
armeabi-v7a: $(FLAVOUR) x86_64: $(FLAVOUR) android64_x86.Dockerfile
-rm -rf armeabi-v7a
-docker container rm $(FLAVOUR)-android-arm32 -f
docker build -f android32.Dockerfile -t $(FLAVOUR)-android-arm32 $(FLAVOUR)
docker create -it --name $(FLAVOUR)-android-arm32 $(FLAVOUR)-android-arm32 bash
docker cp $(FLAVOUR)-android-arm32:/opt/android/prefix/lib/. armeabi-v7a
docker cp $(FLAVOUR)-android-arm32:/src/build/release/lib/. armeabi-v7a/$(FLAVOUR)
x86_64: $(FLAVOUR)
-rm -rf x86_64 -rm -rf x86_64
-docker container rm $(FLAVOUR)-android-x86_64 -f -docker container rm $(FLAVOUR)-android-x86_64 -f
docker build -f android64_x86.Dockerfile -t $(FLAVOUR)-android-x86_64 $(FLAVOUR) docker build -f android64_x86.Dockerfile -t $(FLAVOUR)-android-x86_64 $(FLAVOUR)
@ -26,38 +18,26 @@ x86_64: $(FLAVOUR)
docker cp $(FLAVOUR)-android-x86_64:/opt/android/prefix/lib/. x86_64 docker cp $(FLAVOUR)-android-x86_64:/opt/android/prefix/lib/. x86_64
docker cp $(FLAVOUR)-android-x86_64:/src/build/release/lib/. x86_64/$(FLAVOUR) docker cp $(FLAVOUR)-android-x86_64:/src/build/release/lib/. x86_64/$(FLAVOUR)
x86: $(FLAVOUR) include/wallet2_api.h: $(FLAVOUR) include $(FLAVOUR)/src/wallet/api/wallet2_api.h
-rm -rf x86 cp $(FLAVOUR)/src/wallet/api/wallet2_api.h include/wallet2_api.h
-docker container rm $(FLAVOUR)-android-x86 -f
docker build -f android32_x86.Dockerfile -t $(FLAVOUR)-android-x86 $(FLAVOUR)
docker create -it --name $(FLAVOUR)-android-x86 $(FLAVOUR)-android-x86 bash
docker cp $(FLAVOUR)-android-x86:/opt/android/prefix/lib/. x86
docker cp $(FLAVOUR)-android-x86:/src/build/release/lib/. x86/$(FLAVOUR)
include: $(FLAVOUR) include:
-mkdir include mkdir include
cp $(FLAVOUR)/src/wallet/api/wallet2_api.h include/
VERSION: VERSION:
echo MONERUJO_WOW `git -C . branch | grep "^\*" | sed 's/^..//'` with $(FLAVOUR) `git -C $(FLAVOUR) branch | grep "^\*" | sed 's/^..//'` > VERSION echo MONERUJO_$(FLAVOUR) `git -C . branch | grep "^\*" | sed 's/^..//'` with $(FLAVOUR) `git -C $(FLAVOUR) branch | grep "^\*" | sed 's/^..//'` > VERSION
clean: clean:
-rm -rf arm64-v8a -rm -rf arm64-v8a
-rm -rf armeabi-v7a
-rm -rf x86_64 -rm -rf x86_64
-rm -rf x86
-rm -rf include -rm -rf include
-rm -f VERSION -rm -f VERSION
distclean: clean distclean: clean
-docker container rm $(FLAVOUR)-android-arm64 -f -docker container rm $(FLAVOUR)-android-arm64 -f
-docker container rm $(FLAVOUR)-android-arm32 -f
-docker container rm $(FLAVOUR)-android-x86_64 -f -docker container rm $(FLAVOUR)-android-x86_64 -f
-docker container rm $(FLAVOUR)-android-x86 -f
-docker image rm $(FLAVOUR)-android-arm64 -f -docker image rm $(FLAVOUR)-android-arm64 -f
-docker image rm $(FLAVOUR)-android-arm32 -f
-docker image rm $(FLAVOUR)-android-x86_64 -f -docker image rm $(FLAVOUR)-android-x86_64 -f
-docker image rm $(FLAVOUR)-android-x86 -f
-rm $(FLAVOUR) -rm $(FLAVOUR)
$(FLAVOUR): $(FLAVOUR):

View File

@ -1 +1 @@
MONERUJO_WOW feature_updatebuild with wownero (HEAD detached at v0.9.3.3) MONERUJO_wownero master with wownero (HEAD detached at v0.9.3.3)

View File

@ -1,151 +0,0 @@
FROM debian:stable
RUN set -x && apt-get update && apt-get install -y unzip automake build-essential curl file pkg-config git python libtool libtinfo5
WORKDIR /opt/android
## INSTALL ANDROID SDK
ENV ANDROID_SDK_REVISION 4333796
ENV ANDROID_SDK_HASH 92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
RUN set -x \
&& curl -s -O https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
&& echo "${ANDROID_SDK_HASH} sdk-tools-linux-${ANDROID_SDK_REVISION}.zip" | sha256sum -c \
&& unzip sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
&& rm -f sdk-tools-linux-${ANDROID_SDK_REVISION}.zip
## INSTALL ANDROID NDK
ENV ANDROID_NDK_REVISION 17c
ENV ANDROID_NDK_HASH 3f541adbd0330a9205ba12697f6d04ec90752c53d6b622101a2a8a856e816589
RUN set -x \
&& curl -s -O https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& echo "${ANDROID_NDK_HASH} android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip" | sha256sum -c \
&& unzip android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& rm -f android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip
ENV WORKDIR /opt/android
ENV ANDROID_SDK_ROOT ${WORKDIR}/tools
ENV ANDROID_NDK_ROOT ${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION}
ENV PREFIX /opt/android/prefix
ENV TOOLCHAIN_DIR ${WORKDIR}/toolchain-arm
RUN set -x \
&& ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py \
--arch arm \
--api 21 \
--install-dir ${TOOLCHAIN_DIR} \
--stl=libc++
#INSTALL cmake
ARG CMAKE_VERSION=3.14.6
ARG CMAKE_HASH=82e08e50ba921035efa82b859c74c5fbe27d3e49a4003020e3c77618a4e912cd
RUN set -x \
&& cd /usr \
&& curl -L -s -O https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" | sha256sum -c \
&& tar -xzf /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& rm -f /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz
ENV PATH /usr/cmake-${CMAKE_VERSION}-Linux-x86_64/bin:$PATH
## Boost
ARG BOOST_VERSION=1_70_0
ARG BOOST_VERSION_DOT=1.70.0
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
RUN set -x \
&& curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 \
&& rm -f boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION} \
&& ./bootstrap.sh --prefix=${PREFIX}
ENV HOST_PATH $PATH
ENV PATH $TOOLCHAIN_DIR/arm-linux-androideabi/bin:$TOOLCHAIN_DIR/bin:$PATH
ARG NPROC=1
# Build iconv for lib boost locale
ENV ICONV_VERSION 1.16
ENV ICONV_HASH e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
RUN set -x \
&& curl -s -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
&& echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf libiconv-${ICONV_VERSION}.tar.gz \
&& rm -f libiconv-${ICONV_VERSION}.tar.gz \
&& cd libiconv-${ICONV_VERSION} \
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ ./configure --build=x86_64-linux-gnu --host=arm-linux-androideabi --prefix=${PREFIX} --disable-rpath \
&& make -j${NPROC} && make install
## Build BOOST
RUN set -x \
&& cd boost_${BOOST_VERSION} \
&& ./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 --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
#Note : we build openssl because the default lacks DSA1
# download, configure and make Zlib
ENV ZLIB_VERSION 1.2.11
ENV ZLIB_HASH c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
RUN set -x \
&& curl -s -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
&& rm zlib-${ZLIB_VERSION}.tar.gz \
&& mv zlib-${ZLIB_VERSION} zlib \
&& cd zlib && CC=clang CXX=clang++ ./configure --static \
&& make -j${NPROC}
# open ssl
ARG OPENSSL_VERSION=1.0.2p
ARG OPENSSL_HASH=50a98e07b1a89eb8f6a99477f262df71c6fa7bef77df4dc83025a2845c827d00
RUN set -x \
&& curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
&& rm openssl-${OPENSSL_VERSION}.tar.gz \
&& cd openssl-${OPENSSL_VERSION} \
&& sed -i -e "s/mandroid/target\ armv7\-none\-linux\-androideabi/" Configure \
&& CC=clang CXX=clang++ \
./Configure android-armv7 \
no-asm \
no-shared --static \
--with-zlib-include=${WORKDIR}/zlib/include --with-zlib-lib=${WORKDIR}/zlib/lib \
--prefix=${PREFIX} --openssldir=${PREFIX} \
&& make -j${NPROC} \
&& make install
# ZMQ
ARG ZMQ_VERSION=v4.3.2
ARG ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
RUN set -x \
&& git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} \
&& cd libzmq \
&& test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
&& ./autogen.sh \
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=arm-linux-androideabi --enable-static --disable-shared \
&& make -j${NPROC} \
&& make install
# Sodium
ARG SODIUM_VERSION=1.0.18
ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
RUN set -x \
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} \
&& cd libsodium \
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
&& ./autogen.sh \
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=arm-linux-androideabi --enable-static --disable-shared \
&& make -j${NPROC} \
&& make install
COPY . /src
ARG NPROC=4
RUN set -x \
&& cd /src \
&& CMAKE_INCLUDE_PATH="${PREFIX}/include" \
CMAKE_LIBRARY_PATH="${PREFIX}/lib" \
ANDROID_STANDALONE_TOOLCHAIN_PATH=${TOOLCHAIN_DIR} \
USE_SINGLE_BUILDDIR=1 \
PATH=${HOST_PATH} make release-static-android-armv7-wallet_api -j${NPROC}
RUN set -x \
&& cd /src/build/release \
&& find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \;

View File

@ -1,151 +0,0 @@
FROM debian:stable
RUN set -x && apt-get update && apt-get install -y unzip automake build-essential curl file pkg-config git python libtool libtinfo5
WORKDIR /opt/android
## INSTALL ANDROID SDK
ENV ANDROID_SDK_REVISION 4333796
ENV ANDROID_SDK_HASH 92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
RUN set -x \
&& curl -s -O https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
&& echo "${ANDROID_SDK_HASH} sdk-tools-linux-${ANDROID_SDK_REVISION}.zip" | sha256sum -c \
&& unzip sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
&& rm -f sdk-tools-linux-${ANDROID_SDK_REVISION}.zip
## INSTALL ANDROID NDK
ENV ANDROID_NDK_REVISION 17c
ENV ANDROID_NDK_HASH 3f541adbd0330a9205ba12697f6d04ec90752c53d6b622101a2a8a856e816589
RUN set -x \
&& curl -s -O https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& echo "${ANDROID_NDK_HASH} android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip" | sha256sum -c \
&& unzip android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& rm -f android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip
ENV WORKDIR /opt/android
ENV ANDROID_SDK_ROOT ${WORKDIR}/tools
ENV ANDROID_NDK_ROOT ${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION}
ENV PREFIX /opt/android/prefix
ENV TOOLCHAIN_DIR ${WORKDIR}/toolchain
RUN set -x \
&& ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py \
--arch x86 \
--api 21 \
--install-dir ${TOOLCHAIN_DIR} \
--stl=libc++
#INSTALL cmake
ARG CMAKE_VERSION=3.14.6
ARG CMAKE_HASH=82e08e50ba921035efa82b859c74c5fbe27d3e49a4003020e3c77618a4e912cd
RUN set -x \
&& cd /usr \
&& curl -L -s -O https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" | sha256sum -c \
&& tar -xzf /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& rm -f /usr/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz
ENV PATH /usr/cmake-${CMAKE_VERSION}-Linux-x86_64/bin:$PATH
## Boost
ARG BOOST_VERSION=1_70_0
ARG BOOST_VERSION_DOT=1.70.0
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
RUN set -x \
&& curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2 \
&& rm -f boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION} \
&& ./bootstrap.sh --prefix=${PREFIX}
ENV HOST_PATH $PATH
ENV PATH $TOOLCHAIN_DIR/i686-linux-android/bin:$TOOLCHAIN_DIR/bin:$PATH
ARG NPROC=1
# Build iconv for lib boost locale
ENV ICONV_VERSION 1.16
ENV ICONV_HASH e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
RUN set -x \
&& curl -s -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
&& echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf libiconv-${ICONV_VERSION}.tar.gz \
&& rm -f libiconv-${ICONV_VERSION}.tar.gz \
&& cd libiconv-${ICONV_VERSION} \
&& CC=i686-linux-android-clang CXX=i686-linux-android-clang++ ./configure --build=x86_64-linux-gnu --host=i686-linux-android --prefix=${PREFIX} --disable-rpath \
&& make -j${NPROC} && make install
## Build BOOST
RUN set -x \
&& cd boost_${BOOST_VERSION} \
&& ./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 --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} install -j${NPROC}
#Note : we build openssl because the default lacks DSA1
# download, configure and make Zlib
ENV ZLIB_VERSION 1.2.11
ENV ZLIB_HASH c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
RUN set -x \
&& curl -s -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
&& echo "${ZLIB_HASH} zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
&& rm zlib-${ZLIB_VERSION}.tar.gz \
&& mv zlib-${ZLIB_VERSION} zlib \
&& cd zlib && CC=clang CXX=clang++ ./configure --static \
&& make -j${NPROC}
# open ssl
ARG OPENSSL_VERSION=1.0.2p
ARG OPENSSL_HASH=50a98e07b1a89eb8f6a99477f262df71c6fa7bef77df4dc83025a2845c827d00
RUN set -x \
&& curl -s -O https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c \
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
&& rm openssl-${OPENSSL_VERSION}.tar.gz \
&& cd openssl-${OPENSSL_VERSION} \
&& sed -i -e "s/mandroid/target\ i686\-linux\-android/" Configure \
&& CC=clang CXX=clang++ \
./Configure android \
no-asm \
no-shared --static \
--with-zlib-include=${WORKDIR}/zlib/include --with-zlib-lib=${WORKDIR}/zlib/lib \
--prefix=${PREFIX} --openssldir=${PREFIX} \
&& make -j${NPROC} \
&& make install
# ZMQ
ARG ZMQ_VERSION=v4.3.2
ARG ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
RUN set -x \
&& git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} \
&& cd libzmq \
&& test `git rev-parse HEAD` = ${ZMQ_HASH} || exit 1 \
&& ./autogen.sh \
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=x86-linux-android --enable-static --disable-shared \
&& make -j${NPROC} \
&& make install
# Sodium
ARG SODIUM_VERSION=1.0.18
ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
RUN set -x \
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} \
&& cd libsodium \
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
&& ./autogen.sh \
&& CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=x86-linux-android --enable-static --disable-shared \
&& make -j${NPROC} \
&& make install
COPY . /src
ARG NPROC=4
RUN set -x \
&& cd /src \
&& CMAKE_INCLUDE_PATH="${PREFIX}/include" \
CMAKE_LIBRARY_PATH="${PREFIX}/lib" \
ANDROID_STANDALONE_TOOLCHAIN_PATH=${TOOLCHAIN_DIR} \
USE_SINGLE_BUILDDIR=1 \
PATH=${HOST_PATH} make release-static-android-x86-wallet_api -j${NPROC}
RUN set -x \
&& cd /src/build/release \
&& find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \;

View File

@ -26,7 +26,7 @@ ENV ANDROID_SDK_ROOT ${WORKDIR}/tools
ENV ANDROID_NDK_ROOT ${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION} ENV ANDROID_NDK_ROOT ${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION}
ENV PREFIX /opt/android/prefix ENV PREFIX /opt/android/prefix
ENV TOOLCHAIN_DIR ${WORKDIR}/toolchain-arm ENV TOOLCHAIN_DIR ${WORKDIR}/toolchain
RUN set -x \ RUN set -x \
&& ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py \ && ${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py \
--arch arm64 \ --arch arm64 \