1
mirror of https://github.com/monero-project/monero-gui synced 2024-11-29 09:05:11 +01:00

Merge pull request #3187

cd054f6c docker: fix Android build, update to Qt 5.15, README.md build steps (xiphon)
d6cb9b6c docker: move Android Dockerfile to root (xiphon)
This commit is contained in:
Alexander Blair 2020-10-28 00:42:35 -07:00
commit c9fd9634ee
No known key found for this signature in database
GPG Key ID: C64552D877C32479
7 changed files with 267 additions and 285 deletions

218
Dockerfile.android Normal file
View File

@ -0,0 +1,218 @@
FROM debian:unstable
ARG THREADS=1
ARG ANDROID_NDK_REVISION=21d
ARG ANDROID_NDK_HASH=bcf4023eb8cb6976a4c7cff0a8a8f145f162bf4d
ARG ANDROID_SDK_REVISION=4333796
ARG ANDROID_SDK_HASH=92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
ARG QT_VERSION=5.15
WORKDIR /opt/android
ENV WORKDIR=/opt/android
ENV ANDROID_NATIVE_API_LEVEL=28
ENV ANDROID_API=android-${ANDROID_NATIVE_API_LEVEL}
ENV ANDROID_CLANG=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang
ENV ANDROID_CLANGPP=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang++
ENV ANDROID_NDK_ROOT=${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION}
ENV ANDROID_SDK_ROOT=${WORKDIR}/tools
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
ENV PATH=${JAVA_HOME}/bin:${PATH}
ENV PREFIX=${WORKDIR}/prefix
ENV QT_PREFIX=${WORKDIR}/Qt-${QT_VERSION}
ENV TOOLCHAIN_DIR=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64
RUN apt-get update \
&& apt-get install -y ant automake build-essential ca-certificates-java cmake file gettext git libc6 libncurses5 \
libstdc++6 libtinfo5 libtool libz1 openjdk-8-jdk-headless openjdk-8-jre-headless pkg-config python3 unzip wget
RUN wget -q https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
&& unzip -q sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \
&& rm -f sdk-tools-linux-${ANDROID_SDK_REVISION}.zip
RUN wget -q https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& unzip -q android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \
&& rm -f android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip
RUN cd ${ANDROID_SDK_ROOT} && echo y | ./bin/sdkmanager "platform-tools" "platforms;${ANDROID_API}" "tools" > /dev/null
RUN cp -r ${WORKDIR}/platforms ${WORKDIR}/platform-tools ${ANDROID_SDK_ROOT}
ENV HOST_PATH=${PATH}
ENV PATH=${TOOLCHAIN_DIR}/aarch64-linux-android/bin:${TOOLCHAIN_DIR}/bin:${PATH}
ARG ZLIB_VERSION=1.2.11
ARG ZLIB_HASH=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
RUN wget -q https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \
&& tar -xzf zlib-${ZLIB_VERSION}.tar.gz \
&& rm zlib-${ZLIB_VERSION}.tar.gz \
&& cd zlib-${ZLIB_VERSION} \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --static \
&& make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 \
&& cd qt5 \
&& perl init-repository --module-subset=default,-qtwebengine \
&& PATH=${HOST_PATH} ./configure -v -developer-build -release \
-xplatform android-clang \
-android-ndk-platform ${ANDROID_API} \
-android-ndk ${ANDROID_NDK_ROOT} \
-android-sdk ${ANDROID_SDK_ROOT} \
-android-ndk-host linux-x86_64 \
-no-dbus \
-opengl es2 \
-no-use-gold-linker \
-no-sql-mysql \
-opensource -confirm-license \
-android-arch arm64-v8a \
-prefix ${QT_PREFIX} \
-nomake tools -nomake tests -nomake examples \
-skip qtwebengine \
-skip qtserialport \
-skip qtconnectivity \
-skip qttranslations \
-skip qtpurchasing \
-skip qtgamepad -skip qtscript -skip qtdoc \
-no-warnings-are-errors \
&& sed -i '213,215d' qtbase/src/3rdparty/pcre2/src/sljit/sljitConfigInternal.h \
&& PATH=${HOST_PATH} make -j${THREADS} \
&& PATH=${HOST_PATH} make -j${THREADS} install \
&& cd qttools/src/linguist/lrelease && \
../../../../qtbase/bin/qmake && \
PATH=${HOST_PATH} make -j$THREADS install && \
cd ../../../.. && \
rm -rf $(pwd)
ARG ICONV_VERSION=1.16
ARG ICONV_HASH=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
RUN wget -q 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=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --build=x86_64-linux-gnu --host=aarch64 --prefix=${PREFIX} --disable-rpath \
&& make -j${THREADS} \
&& make -j${THREADS} install
ARG BOOST_VERSION=1_74_0
ARG BOOST_VERSION_DOT=1.74.0
ARG BOOST_HASH=83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1
RUN wget -q 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 -xf boost_${BOOST_VERSION}.tar.bz2 \
&& rm -f boost_${BOOST_VERSION}.tar.bz2 \
&& cd boost_${BOOST_VERSION} \
&& PATH=${HOST_PATH} ./bootstrap.sh --prefix=${PREFIX} \
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_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 --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi \
threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} \
cflags='--target=aarch64-linux-android' \
cxxflags='--target=aarch64-linux-android' \
linkflags='--target=aarch64-linux-android --sysroot=${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm64 ${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so -nostdlib++' \
install -j${THREADS} \
&& rm -rf $(pwd)
ARG OPENSSL_VERSION=1.1.1g
ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
RUN wget -q https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
&& tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \
&& rm openssl-${OPENSSL_VERSION}.tar.gz \
&& cd openssl-${OPENSSL_VERSION} \
&& ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} ./Configure CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} \
android-arm64 no-asm no-shared --static \
--with-zlib-include=${PREFIX}/include --with-zlib-lib=${PREFIX}/lib \
--prefix=${PREFIX} --openssldir=${PREFIX} \
&& sed -i 's/CNF_EX_LIBS=-ldl -pthread//g;s/BIN_CFLAGS=-pie $(CNF_CFLAGS) $(CFLAGS)//g' Makefile \
&& ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
ARG ZMQ_VERSION=v4.3.3
ARG ZMQ_HASH=04f5bbedee58c538934374dc45182d8fc5926fa3
RUN git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} --depth 1 \
&& cd libzmq \
&& git checkout ${ZMQ_HASH} \
&& ./autogen.sh \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=aarch64-linux-android \
--enable-static --disable-shared \
&& make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
ARG SODIUM_VERSION=1.0.18
ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
RUN set -ex \
&& git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth 1 \
&& cd libsodium \
&& test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \
&& ./autogen.sh \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
RUN git clone https://github.com/ZBar/ZBar.git --depth 1 \
&& cd ZBar \
&& git reset --hard 854a5d97059e395807091ac4d80c53f7968abb8f \
&& sed -i 's/SHARED/STATIC/' android/jni/Android.mk \
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CPP_FEATURES := exceptions rtti features\n\0/' android/jni/Android.mk \
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS := -Wno-multichar\n\0/' android/jni/Android.mk \
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -D_ANDROID\n\0/' android/jni/Android.mk \
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -DLIBDIR="\\".\\""\n\0/' android/jni/Android.mk \
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -DBUILDING_LIBICONV\n\0/' android/jni/Android.mk \
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -DBUILDING_LIBCHARSET\n\0/' android/jni/Android.mk \
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -DIN_LIBRARY\n\0/' android/jni/Android.mk \
&& sed -i -E 's/(.*BUILD_STATIC_LIBRARY.*)/LOCAL_CFLAGS += -fno-stack-protector\n\0/' android/jni/Android.mk \
&& echo "APP_ABI := arm64-v8a \nAPP_STL := c++_shared \nTARGET_PLATFORM := ${ANDROID_API} \nTARGET_ARCH_ABI := arm64-v8a \nAPP_CFLAGS += -target aarch64-none-linux-android -fexceptions -fstack-protector-strong -fno-limit-debug-info -mfloat-abi=softfp -fno-builtin-memmove -fno-omit-frame-pointer -fno-stack-protector\n" \
>> android/jni/Application.mk \
&& cd android \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ${ANDROID_NDK_ROOT}/ndk-build ICONV_SRC=${WORKDIR}/libiconv-${ICONV_VERSION} -B V=1 NDK_APPLICATION_MK=jni/Application.mk \
&& cp obj/local/arm64-v8a/lib* ${PREFIX}/lib \
&& cp -r ../include/* ${PREFIX}/include
RUN git clone -b libgpg-error-1.38 --depth 1 git://git.gnupg.org/libgpg-error.git \
&& cd libgpg-error \
&& git reset --hard 71d278824c5fe61865f7927a2ed1aa3115f9e439 \
&& ./autogen.sh \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --host=aarch64-linux-android --prefix=${PREFIX} --disable-rpath --disable-shared --enable-static --disable-doc --disable-tests \
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
RUN git clone -b libgcrypt-1.8.5 --depth 1 git://git.gnupg.org/libgcrypt.git \
&& cd libgcrypt \
&& git reset --hard 56606331bc2a80536db9fc11ad53695126007298 \
&& ./autogen.sh \
&& CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --host=aarch64-linux-android --prefix=${PREFIX} --with-gpg-error-prefix=${PREFIX} --disable-shared --enable-static --disable-doc --disable-tests \
&& PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \
&& make -j${THREADS} install \
&& rm -rf $(pwd)
RUN cd tools \
&& wget -q http://dl-ssl.google.com/android/repository/tools_r25.2.5-linux.zip \
&& unzip -q tools_r25.2.5-linux.zip \
&& rm -f tools_r25.2.5-linux.zip \
&& echo y | ${ANDROID_SDK_ROOT}/tools/android update sdk --no-ui --all --filter build-tools-28.0.3
CMD set -ex \
&& cd /monero-gui \
&& mkdir -p build/Android/release \
&& cd build/Android/release \
&& cmake \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" \
-DCMAKE_PREFIX_PATH="${PREFIX};${QT_PREFIX}" \
-DCMAKE_FIND_ROOT_PATH="${PREFIX};${QT_PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
-DARCH="armv8-a" \
-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL} \
-DANDROID_ABI="arm64-v8a" \
-DANDROID_TOOLCHAIN=clang \
-DBoost_USE_STATIC_RUNTIME=ON \
-DLRELEASE_PATH="${QT_PREFIX}/bin" \
-DQT_ANDROID_APPLICATION_BINARY="monero-wallet-gui" \
-DWITH_SCANNER=ON \
../../.. \
&& PATH=${HOST_PATH} make generate_translations_header \
&& make -j${THREADS} -C src \
&& make -j${THREADS} apk

View File

@ -124,6 +124,55 @@ Packaging for your favorite distribution would be a welcome contribution!
\* `4` - number of CPU threads to use
5. Monero GUI Linux static binaries will be placed in `monero-gui/build/release/bin` directory
### Building Android APK with Docker (any OS) *Experimental*
- Minimum Android 9 Pie (API 28)
- ARMv8-A 64-bit CPU
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
2. Clone the repository
```
git clone --recursive https://github.com/monero-project/monero-gui.git
```
3. Prepare build environment
```
cd monero-gui
docker build --tag monero:build-env-android --build-arg THREADS=4 --file Dockerfile.android .
```
\* `4` - number of CPU threads to use
4. Build
```
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -e THREADS=4 monero:build-env-android
```
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
\* `4` - number of CPU threads to use
5. Monero GUI APK will be placed in `monero-gui/build/Android/release/android-build` directory
6. Deploy
* Using ADB (Android debugger bridge)
- [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb.html#Enabling)
* Connect your device with USB and install Monero GUI APK with adb:
```
adb install build/Android/release/android-build/monero-gui.apk
```
* Troubleshooting:
```
adb devices -l
adb logcat
```
* If using adb inside docker, make sure you did
```
docker run -v /dev/bus/usb:/dev/bus/usb --privileged
```
* Using a web server
```
mkdir /usr/tmp
cp build/Android/release/android-build/monero-gui.apk /usr/tmp
docker run -d -v /usr/tmp:/usr/share/nginx/html:ro -p 8080:80 nginx
```
Now it should be accessible through a web browser at
```
http://<your.local.ip>:8080/QtApp-debug.apk
```
### On Linux:
(Tested on Ubuntu 17.10 x64, Ubuntu 18.04 x64 and Gentoo x64)

View File

@ -1,53 +0,0 @@
Copyright (c) 2014-2018, The Monero Project
## Current status : ALPHA
- Minimum Android 5.0 (api level 21)
- Modal dialogs can appear in background giving the feeling that the application is frozen (Work around : turn screen off/on or switch to another app and back)
## Build using Docker
# Base environnement
cd monero/utils/build_scripts
docker build -f android32.Dockerfile -t monero-android .
cd ..
# Build GUI
cd android/docker
docker build -t monero-gui-android .
docker create -it --name monero-gui-android monero-gui-android bash
# Get the apk
docker cp monero-gui-android:/opt/android/monero-gui/build/release/bin/bin/QtApp-debug.apk .
## Deployment
- Using ADB (Android debugger bridge) :
First, see section [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb.html#Enabling)
The only place where we are allowed to play is `/data/local/tmp`. So :
adb push /opt/android/monero-gui/build/release/bin/bin/QtApp-debug.apk /data/local/tmp
adb shell pm install -r /data/local/tmp/QtApp-debug.apk
- Troubleshooting:
adb devices -l
adb logcat
if using adb inside docker, make sure you did "docker run -v /dev/bus/usb:/dev/bus/usb --privileged"
- Using a web server
mkdir /usr/tmp
cp QtApp-debug.apk /usr/tmp
docker run -d -v /usr/tmp:/usr/share/nginx/html:ro -p 8080:80 nginx
Now it should be accessible through a web browser at
http://<your.local.ip>:8080/QtApp-debug.apk

View File

@ -1,107 +0,0 @@
FROM monero-android
#INSTALL JAVA
RUN echo "deb http://ftp.fr.debian.org/debian/ jessie-backports main contrib non-free" >> /etc/apt/sources.list
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 libz1:i386 \
&& apt-get install -y -t jessie-backports ca-certificates-java openjdk-8-jdk-headless openjdk-8-jre-headless ant
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
ENV PATH $JAVA_HOME/bin:$PATH
#Get Qt
ENV QT_VERSION 5.8
RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} \
&& cd qt5 \
&& perl init-repository
## Note: Need to use libc++ but Qt does not provide mkspec for libc++.
## Their support of it is quite recent and they claim they don't use it by default
## [only because it produces bigger binary objects](https://bugreports.qt.io/browse/QTBUG-50724).
#Create new mkspec for clang + libc++
RUN cp -r qt5/qtbase/mkspecs/android-clang qt5/qtbase/mkspecs/android-clang-libc \
&& cd qt5/qtbase/mkspecs/android-clang-libc \
&& sed -i '16i ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$$ANDROID_TARGET_ARCH' qmake.conf \
&& sed -i '17i ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/include' qmake.conf \
&& echo "QMAKE_LIBS_PRIVATE = -lc++_shared -llog -lz -lm -ldl -lc -lgcc " >> qmake.conf \
&& echo "QMAKE_CFLAGS -= -mfpu=vfp " >> qmake.conf \
&& echo "QMAKE_CXXFLAGS -= -mfpu=vfp " >> qmake.conf \
&& echo "QMAKE_CFLAGS += -mfpu=vfp4 " >> qmake.conf \
&& echo "QMAKE_CXXFLAGS += -mfpu=vfp4 " >> qmake.conf
ENV ANDROID_API android-21
#ANDROID SDK TOOLS
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter platform-tools
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter ${ANDROID_API}
RUN echo y | $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --all --filter build-tools-25.0.1
ENV CLEAN_PATH $JAVA_HOME/bin:/usr/cmake-3.6.3-Linux-x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#build Qt
RUN cd qt5 && PATH=${CLEAN_PATH} ./configure -developer-build -release \
-xplatform android-clang-libc \
-android-ndk-platform ${ANDROID_API} \
-android-ndk $ANDROID_NDK_ROOT \
-android-sdk $ANDROID_SDK_ROOT \
-opensource -confirm-license \
-prefix ${WORKDIR}/Qt-${QT_VERSION} \
-nomake tests -nomake examples \
-skip qtserialport \
-skip qtconnectivity \
-skip qttranslations \
-skip qtgamepad -skip qtscript -skip qtdoc
# build Qt tools : gnustl_shared.so is hard-coded in androiddeployqt
# replace it with libc++_shared.so
COPY androiddeployqt.patch qt5/qttools/androiddeployqt.patch
RUN cd qt5/qttools \
&& git apply androiddeployqt.patch \
&& cd .. \
&& PATH=${CLEAN_PATH} make -j4 \
&& PATH=${CLEAN_PATH} make install
# Get iconv and ZBar
ENV ICONV_VERSION 1.14
RUN git clone https://github.com/ZBar/ZBar.git \
&& curl -s -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \
&& tar -xzf 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-eabi --prefix=${WORKDIR}/libiconv --disable-rpath
ENV PATH $ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:${WORKDIR}/Qt-${QT_VERSION}/bin:$PATH
#Build libiconv.a and libzbarjni.a
COPY android.mk.patch ZBar/android.mk.patch
RUN cd ZBar \
&& git apply android.mk.patch \
&& echo \
"APP_ABI := armeabi-v7a \n\
APP_STL := c++_shared \n\
TARGET_PLATFORM := ${ANDROID_API} \n\
TARGET_ARCH_ABI := armeabi-v7a \n\
APP_CFLAGS += -target armv7-none-linux-androideabi -fexceptions -fstack-protector-strong -fno-limit-debug-info -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -fno-omit-frame-pointer -fno-stack-protector\n"\
>> android/jni/Application.mk \
&& cd android \
&& android update project --path . -t "${ANDROID_API}" \
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ ant -Dndk.dir=${ANDROID_NDK_ROOT} -Diconv.src=${WORKDIR}/libiconv-${ICONV_VERSION} zbar-clean zbar-ndk-build
RUN cp openssl/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
RUN cp boost_${BOOST_VERSION}/android32/lib/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
RUN cp ZBar/android/obj/local/armeabi-v7a/lib* ${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm/usr/lib
RUN git clone https://github.com/monero-project/monero-gui.git \
&& cd monero-gui \
&& git submodule update \
&& CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ BOOST_ROOT=/opt/android/boost_1_62_0 \
BOOST_LIBRARYDIR=${WORKDIR}/boost_${BOOST_VERSION}/android32/lib/ \
OPENSSL_ROOT_DIR=${WORKDIR}/openssl/ \
CMAKE_INCLUDE_PATH=${WORKDIR}/cppzmq/ \
CMAKE_LIBRARY_PATH=${WORKDIR}/zeromq4-1/.libs \
CXXFLAGS="-I ${WORKDIR}/zeromq4-1/include/" \
./build.sh release-android \
&& cd build \
&& make deploy

View File

@ -1,61 +0,0 @@
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index e442b07..158afd5 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -12,14 +12,18 @@ LOCAL_PATH := $(ICONV_SRC)
LOCAL_MODULE := libiconv
+LOCAL_ARM_MODE := arm
+LOCAL_CPP_FEATURES := exceptions rtti features
LOCAL_CFLAGS := \
-Wno-multichar \
-D_ANDROID \
- -DLIBDIR="c" \
+ -DLIBDIR="\".\"" \
-DBUILDING_LIBICONV \
-DBUILDING_LIBCHARSET \
-DIN_LIBRARY
+LOCAL_CFLAGS += -fno-stack-protector
+
LOCAL_SRC_FILES := \
lib/iconv.c \
libcharset/lib/localcharset.c \
@@ -30,13 +34,14 @@ LOCAL_C_INCLUDES := \
$(ICONV_SRC)/libcharset \
$(ICONV_SRC)/libcharset/include
-include $(BUILD_SHARED_LIBRARY)
+include $(BUILD_STATIC_LIBRARY)
LOCAL_LDLIBS := -llog -lcharset
# libzbarjni
include $(CLEAR_VARS)
+
LOCAL_PATH := $(MY_LOCAL_PATH)
LOCAL_MODULE := zbarjni
LOCAL_SRC_FILES := ../../java/zbarjni.c \
@@ -71,6 +76,17 @@ LOCAL_C_INCLUDES := ../include \
../zbar \
$(ICONV_SRC)/include
-LOCAL_SHARED_LIBRARIES := libiconv
+LOCAL_STATIC_LIBRARIES := libiconv
+LOCAL_ARM_MODE := arm
+LOCAL_CPP_FEATURES := exceptions rtti features
+
+LOCAL_CFLAGS := \
+ -Wno-multichar \
+ -D_ANDROID \
+ -DLIBDIR="\".\"" \
+ -DBUILDING_LIBICONV \
+ -DBUILDING_LIBCHARSET \
+ -DIN_LIBRARY
+
-include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
+include $(BUILD_STATIC_LIBRARY)

View File

@ -1,62 +0,0 @@
diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
index 8a8e591..71d693e 100644
--- a/src/androiddeployqt/main.cpp
+++ b/src/androiddeployqt/main.cpp
@@ -1122,7 +1122,7 @@ bool updateLibsXml(const Options &options)
QString libsPath = QLatin1String("libs/") + options.architecture + QLatin1Char('/');
- QString qtLibs = QLatin1String("<item>gnustl_shared</item>\n");
+ QString qtLibs = QLatin1String("<item>c++_shared</item>\n");
QString bundledInLibs;
QString bundledInAssets;
foreach (Options::BundledFile bundledFile, options.bundledFiles) {
@@ -2519,6 +2519,39 @@ bool installApk(const Options &options)
return true;
}
+bool copyStl(Options *options)
+{
+ if (options->deploymentMechanism == Options::Debug && !options->installApk)
+ return true;
+
+ if (options->verbose)
+ fprintf(stdout, "Copying LIBC++ STL library\n");
+
+ QString filePath = options->ndkPath
+ + QLatin1String("/sources/cxx-stl/llvm-libc++")
+ + QLatin1String("/libs/")
+ + options->architecture
+ + QLatin1String("/libc++_shared.so");
+ if (!QFile::exists(filePath)) {
+ fprintf(stderr, "LIBC STL library does not exist at %s\n", qPrintable(filePath));
+ return false;
+ }
+
+ QString destinationDirectory =
+ options->deploymentMechanism == Options::Debug
+ ? options->temporaryDirectoryName + QLatin1String("/lib")
+ : options->outputDirectory + QLatin1String("/libs/") + options->architecture;
+
+ if (!copyFileIfNewer(filePath, destinationDirectory
+ + QLatin1String("/libc++_shared.so"), options->verbose)) {
+ return false;
+ }
+
+ if (options->deploymentMechanism == Options::Debug && !deployToLocalTmp(options, QLatin1String("/lib/libc++_shared.so")))
+ return false;
+
+ return true;
+}
bool copyGnuStl(Options *options)
{
if (options->deploymentMechanism == Options::Debug && !options->installApk)
@@ -2870,7 +2903,7 @@ int main(int argc, char *argv[])
if (Q_UNLIKELY(options.timing))
fprintf(stdout, "[TIMING] %d ms: Read dependencies\n", options.timer.elapsed());
- if (options.deploymentMechanism != Options::Ministro && !copyGnuStl(&options))
+ if (options.deploymentMechanism != Options::Ministro && !copyStl(&options))
return CannotCopyGnuStl;
if (Q_UNLIKELY(options.timing))

View File

@ -156,8 +156,6 @@ int main(int argc, char *argv[])
// platform dependant settings
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
bool isDesktop = true;
#elif defined(Q_OS_LINUX)
bool isLinux = true;
#elif defined(Q_OS_ANDROID)
bool isAndroid = true;
#elif defined(Q_OS_IOS)