From 2a3b53a79e4c3376e99b1dc0345afa09e41746ed Mon Sep 17 00:00:00 2001
From: Andy <xandyx@riseup.net>
Date: Sat, 1 Apr 2023 19:12:56 +0200
Subject: [PATCH] Support both Qt5.12 and Qt5.15 builds

---
 CMakeLists.txt                        |  27 +++-
 android-new/AndroidManifest.xml       |  82 ++++++++++
 android-new/build.gradle              |  77 +++++++++
 android-new/gradle.properties         |  12 ++
 android-new/res                       |   1 +
 android-qt5.12/AndroidManifest.xml    |  85 ++++++++++
 android-qt5.12/build.gradle.in        |  57 +++++++
 android-qt5.12/gradle.properties      |   2 +
 android-qt5.12/res                    |   1 +
 fdroiddata/metadata/org.radar.app.yml | 215 +++++++++++++++++++++++++-
 10 files changed, 550 insertions(+), 9 deletions(-)
 create mode 100644 android-new/AndroidManifest.xml
 create mode 100644 android-new/build.gradle
 create mode 100644 android-new/gradle.properties
 create mode 120000 android-new/res
 create mode 100644 android-qt5.12/AndroidManifest.xml
 create mode 100644 android-qt5.12/build.gradle.in
 create mode 100644 android-qt5.12/gradle.properties
 create mode 120000 android-qt5.12/res

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 73ad5c5..8d1fea6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,9 +71,8 @@ set(CXX_SOURCES
     src/locationprovider.h)
 
 if(ANDROID)
-    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/android")
-    set(QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/android")
-    message(STATUS "ANDROID_PACKAGE_SOURCE_DIR=${QT_ANDROID_PACKAGE_SOURCE_DIR}")
+    find_package(QT NAMES Qt5 COMPONENTS Core AndroidExtras Quick QuickControls2 Positioning Sql REQUIRED)
+    find_package(Qt5 REQUIRED COMPONENTS Core AndroidExtras Quick QuickControls2 Positioning Sql)
 
     if(ANDROID_SSL_LIBS)
         set(ANDROID_EXTRA_LIBS ${ANDROID_EXTRA_LIBS} ${ANDROID_SSL_LIBS})
@@ -81,8 +80,16 @@ if(ANDROID)
         include(android_openssl/CMakeLists.txt)
     endif()
 
-    find_package(QT NAMES Qt5 COMPONENTS Core AndroidExtras Quick QuickControls2 Positioning Sql REQUIRED)
-    find_package(Qt5 REQUIRED COMPONENTS Core AndroidExtras Quick QuickControls2 Positioning Sql)
+    set(OLD_QT FALSE)
+    if(Qt5Core_VERSION VERSION_LESS 5.13.0)
+      set(OLD_QT TRUE)
+      include(qt-android-cmake/AddQtAndroidApk.cmake)
+      message(STATUS "Using Qt < 5.13, no 'make apk' needed.")
+    else()
+      set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/android-new")
+      set(QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/android-new")
+      message(STATUS "ANDROID_PACKAGE_SOURCE_DIR=${QT_ANDROID_PACKAGE_SOURCE_DIR}")
+    endif()
 
     message(STATUS "ANDROID_EXTRA_LIBS=${ANDROID_EXTRA_LIBS}")
     set(QT_ANDROID_EXTRA_LIBS "${ANDROID_EXTRA_LIBS}")
@@ -112,6 +119,16 @@ if(ANDROID)
         Qt5::QuickControls2
         Qt5::Positioning
         Qt5::Sql)
+    
+    if (OLD_QT)
+      add_qt_android_apk(radar-app_apk RadarApp
+          NAME "Radar App"
+          VERSION_CODE 1
+          PACKAGE_NAME "org.radar.app"
+          PACKAGE_SOURCES "${CMAKE_CURRENT_LIST_DIR}/android-qt5.12"
+          DEPENDS "${ANDROID_EXTRA_LIBS}"
+      )
+    endif()
 else()
     find_package(Qt5 COMPONENTS Core Quick Positioning QuickControls2 Sql REQUIRED)
     add_executable(RadarApp
diff --git a/android-new/AndroidManifest.xml b/android-new/AndroidManifest.xml
new file mode 100644
index 0000000..bc5135e
--- /dev/null
+++ b/android-new/AndroidManifest.xml
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<manifest package="org.radar.app" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.5" android:versionCode="5" android:installLocation="auto">
+    <!--<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28"/> -->
+
+    <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
+         Remove the comment if you do not require these default permissions. -->
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+    <uses-permission android:name="android.permission.INTERNET"/>
+
+    <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
+         Remove the comment if you do not require these default features. -->
+    <!-- %%INSERT_FEATURES -->
+
+    <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+
+    <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name" android:icon="@drawable/icon" android:extractNativeLibs="true">
+        <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="@string/app_name" android:screenOrientation="unspecified" android:launchMode="singleTop">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+            <!-- Application arguments -->
+            <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
+            <!-- Application arguments -->
+            <meta-data android:name="android.app.lib_name" android:value="RadarApp"/>
+            <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
+            <meta-data android:name="android.app.repository" android:value="default"/>
+            <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
+            <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
+            <!-- Deploy Qt libs as part of package -->
+            <meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
+            <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
+            <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
+            <!-- Run with local libs -->
+            <meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
+            <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
+            <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
+            <meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar:jar/QtAndroidExtras.jar:jar/QtAndroidBearer.jar:jar/QtPositioning.jar"/>
+            <meta-data android:name="android.app.static_init_classes" android:value="org.qtproject.qt5.android.positioning.QtPositioning"/>
+            <!-- Used to specify custom system library path to run with local system libs -->
+            <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
+            <!--  Messages maps -->
+            <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
+            <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
+            <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
+            <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
+            <!--  Messages maps -->
+            <!-- Splash screen -->
+            <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
+                 then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
+                 use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
+                 are done populating your window with content. -->
+            <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / -->
+            <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
+            <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash_container"/>
+            <meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/splash_container"/>
+            <!-- Splash screen -->
+            <!-- Background running -->
+            <!-- Warning: changing this value to true may cause unexpected crashes if the
+                          application still try to draw after
+                          "applicationStateChanged(Qt::ApplicationSuspended)"
+                          signal is sent! -->
+            <meta-data android:name="android.app.background_running" android:value="false"/>
+            <!-- Background running -->
+            <!-- auto screen scale factor -->
+            <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
+            <!-- auto screen scale factor -->
+            <!-- extract android style -->
+            <!-- available android:values :
+                * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
+                * full - useful QWidget & Quick Controls 1 apps
+                * minimal - useful for Quick Controls 2 apps, it is much faster than "full"
+                * none - useful for apps that don't use any of the above Qt modules
+                -->
+            <meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
+            <!-- extract android style -->
+        </activity>
+        <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
+    </application>
+
+</manifest>
diff --git a/android-new/build.gradle b/android-new/build.gradle
new file mode 100644
index 0000000..443a800
--- /dev/null
+++ b/android-new/build.gradle
@@ -0,0 +1,77 @@
+buildscript {
+    repositories {
+        google()
+        jcenter()
+    }
+
+    dependencies {
+        classpath 'com.android.tools.build:gradle:3.6.0'
+    }
+}
+
+repositories {
+    google()
+    jcenter()
+}
+
+apply plugin: 'com.android.application'
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
+}
+
+android {
+    /*******************************************************
+     * The following variables:
+     * - androidBuildToolsVersion,
+     * - androidCompileSdkVersion
+     * - qt5AndroidDir - holds the path to qt android files
+     *                   needed to build any Qt application
+     *                   on Android.
+     *
+     * are defined in gradle.properties file. This file is
+     * updated by QtCreator and androiddeployqt tools.
+     * Changing them manually might break the compilation!
+     *******************************************************/
+
+    compileSdkVersion androidCompileSdkVersion.toInteger()
+
+    buildToolsVersion '28.0.3'
+
+    sourceSets {
+        main {
+            manifest.srcFile 'AndroidManifest.xml'
+            java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
+            aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
+            res.srcDirs = [qt5AndroidDir + '/res', 'res']
+            resources.srcDirs = ['resources']
+            renderscript.srcDirs = ['src']
+            assets.srcDirs = ['assets']
+            jniLibs.srcDirs = ['libs']
+       }
+    }
+
+    tasks.withType(JavaCompile) {
+        options.incremental = true
+    }
+
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+
+    lintOptions {
+        abortOnError false
+    }
+
+    // Do not compress Qt binary resources file
+    aaptOptions {
+        noCompress 'rcc'
+    }
+
+    defaultConfig {
+        resConfig "en"
+        minSdkVersion = qtMinSdkVersion
+        targetSdkVersion = qtTargetSdkVersion
+    }
+}
diff --git a/android-new/gradle.properties b/android-new/gradle.properties
new file mode 100644
index 0000000..321a0ed
--- /dev/null
+++ b/android-new/gradle.properties
@@ -0,0 +1,12 @@
+# Project-wide Gradle settings.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m
+
+# Gradle caching allows reusing the build artifacts from a previous
+# build with the same inputs. However, over time, the cache size will
+# grow. Uncomment the following line to enable it.
+#org.gradle.caching=true
+android.bundle.enableUncompressedNativeLibs=false
diff --git a/android-new/res b/android-new/res
new file mode 120000
index 0000000..2970cd9
--- /dev/null
+++ b/android-new/res
@@ -0,0 +1 @@
+../android/res
\ No newline at end of file
diff --git a/android-qt5.12/AndroidManifest.xml b/android-qt5.12/AndroidManifest.xml
new file mode 100644
index 0000000..c5aa0f9
--- /dev/null
+++ b/android-qt5.12/AndroidManifest.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<manifest package="org.radar.app" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.5" android:versionCode="5" android:installLocation="auto">
+    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28"/>
+
+    <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
+         Remove the comment if you do not require these default permissions. -->
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+    <uses-permission android:name="android.permission.INTERNET"/>
+
+
+    <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
+         Remove the comment if you do not require these default features. -->
+    <!-- %%INSERT_FEATURES -->
+
+    <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+
+    <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name" android:icon="@drawable/icon">
+        <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="@string/app_name" android:screenOrientation="unspecified" android:launchMode="singleTop">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+            <!-- Application arguments -->
+            <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
+            <!-- Application arguments -->
+            <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
+            <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
+            <meta-data android:name="android.app.repository" android:value="default"/>
+            <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
+            <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
+            <!-- Deploy Qt libs as part of package -->
+            <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
+            <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
+            <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
+            <!-- Run with local libs -->
+            <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
+            <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
+            <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
+            <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
+            <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
+            <!-- Used to specify custom system library path to run with local system libs -->
+            <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
+            <!--  Messages maps -->
+            <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
+            <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
+            <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
+            <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
+            <!--  Messages maps -->
+            <!-- Splash screen -->
+            <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
+                 then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
+                 use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
+                 are done populating your window with content. -->
+            <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / -->
+            <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / -->
+            <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
+            <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
+            <!-- Splash screen -->
+            <!-- Background running -->
+            <!-- Warning: changing this value to true may cause unexpected crashes if the
+                          application still try to draw after
+                          "applicationStateChanged(Qt::ApplicationSuspended)"
+                          signal is sent! -->
+            <meta-data android:name="android.app.background_running" android:value="false"/>
+            <!-- Background running -->
+            <!-- auto screen scale factor -->
+            <meta-data android:name="android.app.auto_screen_scale_factor" android:value="true"/>
+            <!-- auto screen scale factor -->
+            <!-- extract android style -->
+            <!-- available android:values :
+                * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
+                * full - useful QWidget & Quick Controls 1 apps
+                * minimal - useful for Quick Controls 2 apps, it is much faster than "full"
+                * none - useful for apps that don't use any of the above Qt modules
+                -->
+            <meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
+            <!-- extract android style -->
+            <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash_container"/>
+            <meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/splash_container"/>
+        </activity>
+        <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
+    </application>
+
+</manifest>
diff --git a/android-qt5.12/build.gradle.in b/android-qt5.12/build.gradle.in
new file mode 100644
index 0000000..ed704c4
--- /dev/null
+++ b/android-qt5.12/build.gradle.in
@@ -0,0 +1,57 @@
+buildscript {
+    repositories {
+        google()
+        jcenter()
+    }
+
+    dependencies {
+        classpath 'com.android.tools.build:gradle:3.2.0'
+    }
+}
+
+repositories {
+    google()
+    jcenter()
+}
+
+apply plugin: 'com.android.application'
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
+}
+
+android {
+    /*******************************************************
+     * The following variables:
+     * - androidBuildToolsVersion,
+     * - androidCompileSdkVersion
+     * - qt5AndroidDir - holds the path to qt android files
+     *                   needed to build any Qt application
+     *                   on Android.
+     *
+     * are defined in gradle.properties file. This file is
+     * updated by QtCreator and androiddeployqt tools.
+     * Changing them manually might break the compilation!
+     *******************************************************/
+
+    compileSdkVersion androidCompileSdkVersion.toInteger()
+
+    buildToolsVersion '28.0.3'
+
+    sourceSets {
+        main {
+            manifest.srcFile 'AndroidManifest.xml'
+            java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
+            aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
+            res.srcDirs = [qt5AndroidDir + '/res', 'res']
+            resources.srcDirs = ['src']
+            renderscript.srcDirs = ['src']
+            assets.srcDirs = ['assets']
+            jniLibs.srcDirs = ['libs']
+       }
+    }
+
+    lintOptions {
+        abortOnError false
+    }
+}
diff --git a/android-qt5.12/gradle.properties b/android-qt5.12/gradle.properties
new file mode 100644
index 0000000..fc380bb
--- /dev/null
+++ b/android-qt5.12/gradle.properties
@@ -0,0 +1,2 @@
+android.enableAapt2=true
+
diff --git a/android-qt5.12/res b/android-qt5.12/res
new file mode 120000
index 0000000..af546aa
--- /dev/null
+++ b/android-qt5.12/res
@@ -0,0 +1 @@
+../android/res/
\ No newline at end of file
diff --git a/fdroiddata/metadata/org.radar.app.yml b/fdroiddata/metadata/org.radar.app.yml
index f0cb15d..1bac15b 100644
--- a/fdroiddata/metadata/org.radar.app.yml
+++ b/fdroiddata/metadata/org.radar.app.yml
@@ -7,15 +7,117 @@ IssueTracker: https://0xacab.org/xandyx/radar-app/-/issues
 AutoName: Event Radar
 
 RepoType: git
-Repo: https://0xacab.org/xandyx/radar-app
+Repo: https://0xacab.org/xandyx/radar-app.git
 
 Builds:
+  - versionName: '0.1'
+    versionCode: 1
+    commit: v0.1
+    submodules: true
+    sudo:
+      - apt-get --quiet update --yes --yes
+      - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
+      - apt-get --quiet install --yes build-essential
+      - apt-get --quiet install --yes make python3-pip
+      - apt-get --quiet install --yes python3-setuptools python3-qrcode
+      - pip3 install fonttools
+    output: build-android/radar-app-armeabi-v7a/build/outputs/apk/release/radar-app-armeabi-v7a-release-unsigned.apk
+    srclibs:
+      - OpenSSL@OpenSSL_1_1_1i
+      - Qt5@5.12.11
+    prebuild:
+      - $$SDK$$/tools/bin/sdkmanager 'platforms;android-28' > /dev/null
+      - $$SDK$$/tools/bin/sdkmanager 'cmake;3.18.1' > /dev/null
+      - cd ../srclib/Qt5
+      - ./init-repository -f --module-subset=essential,qtdeclarative,qtandroidextras,qtlocation,qtquickcontrols2,qtgraphicaleffects
+        --branch
+    scandelete:
+      - android_openssl/
+    build:
+      - export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
+      - export PATH=${JAVA_HOME}/bin:${PATH}
+      - export SSL_SUBMODULE_DIR=$(readlink -f ${PWD}/android_openssl)
+      - export OPENSSL_TARGET_DIR="${SSL_SUBMODULE_DIR}"/Qt-5.12.4_5.13.0/arm
+      - export QT_BUILD=$(readlink -f ${PWD}/../srclib)/build-qt
+      - export QT_VERSION="5.12.11"
+      - export QT_TARGET_ARCH=android_armv7
+      - export PREFIX=$(readlink -f ${PWD}/../srclib)/install-qt
+      - rm -rf $PREFIX $QT_BUILD
+      - mkdir $PREFIX $QT_BUILD
+      - export CMAKE_PREFIX_PATH=${PREFIX}/lib/cmake
+      - export QT_QMAKE_EXECUTABLE=${PREFIX}/bin/qmake
+      - export ANDROID_NDK_ROOT=$$NDK$$
+      - export ANDROID_SDK_ROOT=$$SDK$$
+      - export ANDROID_HOME=$$SDK$$
+      - export CMAKE=$$SDK$$/cmake/3.18.1/bin/cmake
+      - export ANDROID_NDK_VERSION="19.2.5345600"
+      - export ANDROID_ABI=armeabi-v7a
+      - export DOWNLOAD_URL="https://f-droid.org/packages/org.radar.app/"
+      - export ANDROID_NDK_PLATFORM=android-16
+      - export ANDROID_API_VERSION=android-28
+      - echo "1. Generating QR Code for URL='${DOWNLOAD_URL}' ..."
+      - python3-qr "${DOWNLOAD_URL}" > images/qrcode-apk.png
+      - echo "2. Building OpenSSL..."
+      - pushd $$OpenSSL$$
+      - PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
+        ./Configure shared android-arm -D__ANDROID_API__=16
+      - PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
+        make -s -j`nproc` SHLIB_VERSION_NUMBER= SHLIB_EXT=_1_1.so build_libs
+      - PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
+        llvm-strip --strip-all libcrypto_1_1.so
+      - PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
+        llvm-strip --strip-all libssl_1_1.so
+      - cp libcrypto_1_1.so libssl_1_1.so "${OPENSSL_TARGET_DIR}"/
+      - cd ${OPENSSL_TARGET_DIR}
+      - ln -s libcrypto_1_1.so libcrypto.so
+      - ln -s libssl_1_1.so libssl.so
+      - popd
+      - echo "3. Configuring Qt..."
+      - pushd ${QT_BUILD}
+      - $$Qt5$$/configure -xplatform android-clang --disable-rpath -opensource -confirm-license
+        -silent -prefix $PREFIX -release -nomake tests -nomake examples -no-sql-mysql
+        -no-widgets -no-dbus -no-use-gold-linker -sysconfdir /etc/xdg -opengl es2
+        -openssl -I $$OpenSSL$$/include -android-sdk $$SDK$$ -android-ndk $$NDK$$
+        -android-ndk-host linux-x86_64 -android-arch armeabi-v7a -android-ndk-platform
+        android-16 -skip qtwebengine -skip qtgamepad -skip qtwebchannel -skip qtwebview
+        -skip qtwebsockets -skip qtwebglplugin -skip qtmultimedia -skip qtserialport
+        -skip qttranslations -skip qtnetworkauth -skip qt3d -skip qtsensors -skip
+        qtwayland -skip qtxmlpatterns -skip qtscxml -skip qtscript -skip qtconnectivity
+        -skip qttools -no-feature-quickcontrols2-fusion -no-feature-quickcontrols2-imagine
+        -no-feature-quickcontrols2-universal  -feature-quickcontrols2-material -no-feature-geoservices_mapbox
+        -no-feature-geoservices_mapboxgl -no-feature-geoservices_here -no-feature-geoservices_itemsoverlay
+        -no-feature-geoservices_esri -no-feature-geoservices_osm -no-feature-gif -no-feature-ico
+        -no-feature-jpeg -no-feature-testlib -no-feature-xml -no-libjpeg -no-feature-debug
+        -no-feature-qml-debug -no-feature-qml-profiler -no-feature-testlib -no-feature-itemmodeltester
+      - echo "4. Building Qt..."
+      - make -s -j $(nproc)
+      - make install
+      - popd
+      - pushd $$OpenSSL$$
+      - git clean -dffx
+      - popd
+      - pushd "${OPENSSL_TARGET_DIR}"
+      - rm libssl.so libcrypto.so
+      - popd
+      - echo "5. Configuring Radar-App..."
+      - install -d build-android
+      - pushd build-android
+      - ${CMAKE} -DCMAKE_TOOLCHAIN_FILE=$$NDK$$/build/cmake/android.toolchain.cmake
+        -DCMAKE_BUILD_TYPE=Release -DQT_ANDROID_BUILD_TYPE=--release -DQT_VERSION=${QT_VERSION}
+        -DANDROID_TARGET_ARCH="armeabi-v7a" -DANDROID_ABI=${ANDROID_ABI} -DCMAKE_PREFIX_PATH:PATH="${PREFIX}/lib/cmake"
+        -DANDROID_SSL_LIBS="${OPENSSL_TARGET_DIR}/libcrypto_1_1.so;${OPENSSL_TARGET_DIR}/libssl_1_1.so"
+        -DCMAKE_FIND_ROOT_PATH="${PREFIX}/" -DDOWNLOAD_URL="${DOWNLOAD_URL}" ..
+      - echo "6. Building Radar-App..."
+      - ${CMAKE} --build . -- -j $(nproc)
+      - popd
+    ndk: r19c
+
   - versionName: '0.2'
     versionCode: 2
     commit: v0.2
     submodules: true
     sudo:
-      - apt-get --quiet update --yes || apt-get update --yes
+      - apt-get --quiet update --yes --yes
       - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
       - apt-get --quiet install --yes build-essential
       - apt-get --quiet install --yes make python3-pip
@@ -112,6 +214,111 @@ Builds:
       - popd
     ndk: r19c
 
+  - versionName: '0.5'
+    versionCode: 5
+    commit: v0.5
+    submodules: true
+    sudo:
+      - echo "deb http://deb.debian.org/debian stretch main" > /etc/apt/sources.list.d/stretch.list
+      - apt-get --quiet update --yes --yes
+      - apt-get remove openjdk-11-jdk-headless openjdk-11-jre-headless
+      - apt-get install -y -t stretch openjdk-8-jdk-headless
+      - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
+      - apt-get --quiet install --yes build-essential cmake
+      - apt-get --quiet install --yes make python3-pip python3 python-is-python3
+      - apt-get --quiet install --yes python3-setuptools python3-qrcode
+      - pip3 install fonttools
+      - sdkmanager 'platforms;android-28' > /dev/null
+    output: build-android/RadarApp-armeabi-v7a/build/outputs/apk/release/RadarApp-armeabi-v7a-release-unsigned.apk
+    srclibs:
+      - OpenSSL@OpenSSL_1_1_1t
+      - Qt5@v5.12.12
+    prebuild:
+      - cd ../srclib/Qt5
+      - perl ./init-repository -f --module-subset=essential,qtandroidextras,qtdeclarative,qtlocation,qtquickcontrols2,qtgraphicaleffects
+    scandelete:
+      - android_openssl/
+    build:
+      - export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
+      - export PATH=${JAVA_HOME}/bin:${PATH}
+      - export SSL_SUBMODULE_DIR=$(readlink -f ${PWD}/android_openssl)
+      - export OPENSSL_TARGET_DIR="${SSL_SUBMODULE_DIR}"/Qt-5.12.4_5.13.0/arm
+      - export QT_BUILD=$(readlink -f ${PWD}/../srclib)/build-qt
+      - export QT_TARGET_ARCH=android_armv7
+      - export PREFIX=$(readlink -f ${PWD}/../srclib)/install-qt
+      - rm -rf $PREFIX $QT_BUILD
+      - mkdir $PREFIX $QT_BUILD
+      - export CMAKE_PREFIX_PATH=${PREFIX}/lib/cmake
+      - export QT_QMAKE_EXECUTABLE=${PREFIX}/bin/qmake
+      - export ANDROID_NDK_ROOT=$$NDK$$
+      - export ANDROID_NDK_HOME=$$NDK$$
+      - export ANDROID_SDK_ROOT=$$SDK$$
+      - export ANDROID_HOME=$$SDK$$
+      - export ANDROID_NDK_VERSION="19.2.5345600"
+      - export ANDROID_ABI=armeabi-v7a
+      - export DOWNLOAD_URL="https://f-droid.org/packages/org.radar.app/"
+      - export ANDROID_NDK_PLATFORM=android-16
+      - export ANDROID_API_VERSION=android-28
+      - export ANDROID_PLATFORM_LEVEL="16"
+      - echo "1. Generating QR Code for URL='${DOWNLOAD_URL}' ..."
+      - python3-qr "${DOWNLOAD_URL}" > images/qrcode-apk.png
+      - echo "2. Building OpenSSL..."
+      - pushd $$OpenSSL$$
+      - PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
+        ./Configure shared android-arm -D__ANDROID_API__=16
+      - PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
+        make -s -j $(( $(nproc) + 1 )) SHLIB_VERSION_NUMBER= SHLIB_EXT=_1_1.so build_libs
+      - PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
+        llvm-strip --strip-all libcrypto_1_1.so
+      - PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
+        llvm-strip --strip-all libssl_1_1.so
+      - cp libcrypto_1_1.so libssl_1_1.so "${OPENSSL_TARGET_DIR}"/
+      - cd ${OPENSSL_TARGET_DIR}
+      - ln -s libcrypto_1_1.so libcrypto.so
+      - ln -s libssl_1_1.so libssl.so
+      - popd
+      - echo "3. Configuring Qt..."
+      - pushd ${QT_BUILD}
+      - $$Qt5$$/configure -xplatform android-clang --disable-rpath -opensource -confirm-license
+        -silent -prefix $PREFIX -release -nomake tests -nomake examples -no-sql-mysql
+        -no-widgets -no-dbus -no-use-gold-linker -sysconfdir /etc/xdg -opengl es2
+        -openssl -I $$OpenSSL$$/include -android-sdk $$SDK$$ -android-ndk $$NDK$$
+        -android-ndk-host linux-x86_64 -android-arch armeabi-v7a -android-ndk-platform
+        android-16 -skip qtwebengine -skip qtgamepad -skip qtwebchannel -skip qtwebview
+        -skip qtwebsockets -skip qtwebglplugin -skip qtmultimedia -skip qtserialport
+        -skip qttranslations -skip qtnetworkauth -skip qt3d -skip qtsensors -skip
+        qtwayland -skip qtxmlpatterns -skip qtscxml -skip qtscript -skip qtconnectivity
+        -skip qttools -no-feature-quickcontrols2-fusion -no-feature-quickcontrols2-imagine
+        -no-feature-quickcontrols2-universal  -feature-quickcontrols2-material -no-feature-geoservices_mapbox
+        -no-feature-geoservices_mapboxgl -no-feature-geoservices_here -no-feature-geoservices_itemsoverlay
+        -no-feature-geoservices_esri -no-feature-geoservices_osm -no-feature-gif -no-feature-ico
+        -no-feature-jpeg -no-feature-testlib -no-feature-xml -no-libjpeg -no-feature-debug
+        -no-feature-qml-debug -no-feature-qml-profiler -no-feature-testlib -no-feature-itemmodeltester
+        > /tmp/configure.log 2>&1 || tail -1000 /tmp/configure.log
+      - echo "4. Building Qt..."
+      - make -s > /tmp/qt_make.log 2>&1 || tail -1000 /tmp/qt_make.log
+      - make -s install > /tmp/qt_make_install.log 2>&1 || tail -1000 /tmp/qt_make_install.log
+      - popd
+      - pushd $$OpenSSL$$
+      - git clean -dffx
+      - popd
+      - pushd "${OPENSSL_TARGET_DIR}"
+      - rm libssl.so libcrypto.so
+      - popd
+      - echo "5. Configuring Radar-App..."
+      - install -d build-android
+      - pushd build-android
+      - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$NDK/build/cmake/android.toolchain.cmake
+        -DCMAKE_FIND_ROOT_PATH:PATH="${PREFIX}" -DCMAKE_PREFIX_PATH:PATH="${PREFIX}/lib/cmake"
+        -DDOWNLOAD_URL="${DOWNLOAD_URL}" -DANDROID_ABI:STRING=armeabi-v7a -DANDROID_NATIVE_API_LEVEL:STRING="$ANDROID_PLATFORM_LEVEL"
+        -DANDROID_PLATFORM="${ANDROID_PLATFORM_LEVEL}" -DANDROID_PLATFORM_LEVEL="${ANDROID_PLATFORM_LEVEL}"
+        -DANDROID_NDK:PATH=$NDK -DANDROID_STL:STRING=c++_shared -DANDROID_SSL_LIBS="${OPENSSL_TARGET_DIR}/libcrypto_1_1.so;${OPENSSL_TARGET_DIR}/libssl_1_1.so"
+        ..
+      - echo "6. Building Radar-App..."
+      - cmake --build .
+      - popd
+    ndk: r19c
+
 MaintainerNotes: |-
     Build process includes the following steps:
     1. Generation of a picture with QR-code of APK download URL.
@@ -127,5 +334,5 @@ MaintainerNotes: |-
 
 AutoUpdateMode: None
 UpdateCheckMode: Tags
-CurrentVersion: '0.2'
-CurrentVersionCode: 2
+CurrentVersion: '0.5'
+CurrentVersionCode: 5
-- 
GitLab