diff --git a/build.sh b/build.sh index db41eea0..3e1eb5e9 100755 --- a/build.sh +++ b/build.sh @@ -14,12 +14,22 @@ elif [ "$BUILD_TYPE" == "release-static" ]; then echo "Building release-static" CONFIG="CONFIG+=release static"; BIN_PATH=release/bin +elif [ "$BUILD_TYPE" == "release-android" ]; then + echo "Building release for ANDROID" + CONFIG="CONFIG+=release static"; + ANDROID=true + BIN_PATH=release/bin +elif [ "$BUILD_TYPE" == "debug-android" ]; then + echo "Building debug for ANDROID : ultra INSECURE !!" + CONFIG="CONFIG+=debug qml_debug"; + ANDROID=true + BIN_PATH=debug/bin elif [ "$BUILD_TYPE" == "debug" ]; then echo "Building debug" CONFIG="CONFIG+=debug" BIN_PATH=debug/bin else - echo "Valid build types are release, release-static and debug" + echo "Valid build types are release, release-static, release-android, debug-android and debug" exit 1; fi @@ -43,7 +53,7 @@ if [ ! -d build ]; then mkdir build; fi # Platform indepenent settings platform=$(get_platform) -if [ "$platform" == "linux32" ] || [ "$platform" == "linux64" ]; then +if [ "$ANDROID" != true ] && ([ "$platform" == "linux32" ] || [ "$platform" == "linux64" ]); then distro=$(lsb_release -is) if [ "$distro" == "Ubuntu" ]; then CONFIG="$CONFIG libunwind_off" @@ -69,7 +79,7 @@ qmake ../monero-wallet-gui.pro "$CONFIG" make # Copy monerod to bin folder -if [ "$platform" != "mingw32" ]; then +if [ "$platform" != "mingw32" ] && [ "$ANDROID" != true ]; then cp ../$MONERO_DIR/bin/$MONEROD_EXEC $BIN_PATH fi diff --git a/get_libwallet_api.sh b/get_libwallet_api.sh index 481f4511..f74978ac 100755 --- a/get_libwallet_api.sh +++ b/get_libwallet_api.sh @@ -14,6 +14,7 @@ if [ -z $BUILD_TYPE ]; then fi STATIC=false +ANDROID=false if [ "$BUILD_TYPE" == "release" ]; then echo "Building libwallet release" CMAKE_BUILD_TYPE=Release @@ -21,11 +22,21 @@ elif [ "$BUILD_TYPE" == "release-static" ]; then echo "Building libwallet release-static" CMAKE_BUILD_TYPE=Release STATIC=true +elif [ "$BUILD_TYPE" == "release-android" ]; then + echo "Building libwallet release-static for ANDROID" + CMAKE_BUILD_TYPE=Release + STATIC=true + ANDROID=true +elif [ "$BUILD_TYPE" == "debug-android" ]; then + echo "Building libwallet debug-static for ANDROID" + CMAKE_BUILD_TYPE=Debug + STATIC=true + ANDROID=true elif [ "$BUILD_TYPE" == "debug" ]; then echo "Building libwallet debug" CMAKE_BUILD_TYPE=Debug else - echo "Valid build types are release, release-static and debug" + echo "Valid build types are release, release-static, release-android, debug-android and debug" exit 1; fi @@ -79,7 +90,10 @@ if [ "$platform" == "darwin" ]; then ## LINUX 64 elif [ "$platform" == "linux64" ]; then echo "Configuring build for Linux x64" - if [ "$STATIC" == true ]; then + if [ "$ANDROID" == true ]; then + echo "Configuring build for Android on Linux host" + cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="armv7-a" -D ANDROID=true -D BUILD_GUI_DEPS=ON -D USE_LTO=OFF -D INSTALL_VENDORED_LIBUNBOUND=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../.. + elif [ "$STATIC" == true ]; then cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D BUILD_GUI_DEPS=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../.. else cmake -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -D BUILD_GUI_DEPS=ON -D CMAKE_INSTALL_PREFIX="$MONERO_DIR" ../.. @@ -134,7 +148,7 @@ popd # Build monerod # win32 need to build daemon manually with msys2 toolchain -if [ "$platform" != "mingw32" ]; then +if [ "$platform" != "mingw32" ] && [ "$ANDROID" != true ]; then pushd $MONERO_DIR/build/release/src/daemon eval make -j$CPU_CORE_COUNT eval make install -j$CPU_CORE_COUNT @@ -146,7 +160,7 @@ fi # since filename conflict (random.c.obj) # for Linux, we use libunbound shipped with the system, so we don't need to build it -if [ "$platform" != "linux32" ] && [ "$platform" != "linux64" ]; then +if [ "$platform" != "linux32" ] && ([ "$ANDROID" == true ] || [ "$platform" != "linux64" ]); then echo "Building libunbound..." pushd $MONERO_DIR/build/release/external/unbound # no need to make, it was already built as dependency for libwallet @@ -155,4 +169,4 @@ if [ "$platform" != "linux32" ] && [ "$platform" != "linux64" ]; then popd fi -popd \ No newline at end of file +popd diff --git a/monero-wallet-gui.pro b/monero-wallet-gui.pro index 1f3b4024..2f0275b1 100644 --- a/monero-wallet-gui.pro +++ b/monero-wallet-gui.pro @@ -12,7 +12,8 @@ QMAKE_DISTCLEAN += -r $$WALLET_ROOT INCLUDEPATH += $$WALLET_ROOT/include \ $$PWD/src/libwalletqt \ $$PWD/src/QR-Code-generator \ - $$PWD/src + $$PWD/src \ + $$WALLET_ROOT/src HEADERS += \ filter.h \ @@ -274,10 +275,13 @@ win32 { } } -linux { +linux:!android { deploy.commands += $$escape_expand(\n\t) $$PWD/linuxdeploy_helper.sh $$DESTDIR $$TARGET } +android{ + deploy.commands += make install INSTALL_ROOT=$$DESTDIR && androiddeployqt --input android-libmonero-wallet-gui.so-deployment-settings.json --output $$DESTDIR --deployment bundled --android-platform android-21 --jdk /usr/lib/jvm/java-8-openjdk-amd64 -qmldir=$$PWD +} OTHER_FILES += \