Commit 23fe995a authored by Ilya Bizyaev's avatar Ilya Bizyaev 📱

Improve Kaidan portability

parent c5e3f27c
Pipeline #3166 passed with stage
in 3 minutes and 30 seconds
......@@ -2,6 +2,8 @@
kaidan
kaidan_automoc.cpp
misc/ubuntu-touch/manifest.json
misc/windows/*-kaidan.png
misc/macos/kaidan.iconset
3rdparty/openssl
3rdparty/gloox
......
Subproject commit 0d2e7c34ad8baf830a458b9f435984cb4ad189af
Subproject commit a2b0da8b540186eb4d25d1ae70618f231248d4e5
......@@ -9,6 +9,7 @@ set(APPLICATION_ID "im.kaidan.kaidan")
# CMake options
option(I18N "Enable i18n support" FALSE)
option(STATIC_BUILD "Build Kaidan statically")
option(UBUNTU_TOUCH "Building a Ubuntu Touch click (internal use only!)" FALSE)
option(CLICK_ARCH "Architecture that will be used in the click's manifest")
option(CLICK_DATE "Date used in the version number in the click's manifest")
......@@ -27,7 +28,7 @@ set(AUTOMOC_MOC_OPTIONS -Muri=im.kaidan.kaidan)
#
# CMake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
# CMake modules include
include(GNUInstallDirs)
......@@ -35,16 +36,18 @@ include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings)
include(ECMInstallIcons)
include(ECMAddAppIcon)
include(FeatureSummary)
kde_enable_exceptions()
# Find packages
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Svg Sql QuickControls2)
find_package(KF5Kirigami2 REQUIRED)
find_package(Gloox REQUIRED)
find_package(PkgConfig REQUIRED)
# optional QWidget style integration (not on mobile)
pkg_search_module(GLOOX REQUIRED gloox)
include_directories(${GLOOX_INCLUDE_DIRS})
# Optional QWidget style integration (not on mobile)
if(NOT UBUNTU_TOUCH AND NOT ANDROID)
find_package(Qt5Widgets)
set_package_properties(Qt5Widgets PROPERTIES
......@@ -53,6 +56,7 @@ if(NOT UBUNTU_TOUCH AND NOT ANDROID)
)
endif()
# Platform-specific
if(Qt5Widgets_FOUND)
add_definitions(-DHAVE_QWIDGETS -DQAPPLICATION_CLASS=QApplication)
set(__Qt5Widgets_LIBRARIES Qt5::Widgets)
......@@ -62,8 +66,13 @@ endif()
if (ANDROID)
find_package(Qt5 REQUIRED COMPONENTS AndroidExtras)
find_library(CRYPTO_LIBRARIES crypto)
find_library(SSL_LIBRARIES ssl)
endif()
if (ANDROID OR WIN32)
pkg_search_module(OPENSSL REQUIRED openssl)
include_directories(${OPENSSL_INCLUDE_DIRS})
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
endif()
......@@ -84,25 +93,37 @@ endif()
# Sources / Resources
#
# Include bundled icons on Ubuntu Touch and Android
if(UBUNTU_TOUCH OR ANDROID)
# Include bundled icons on Ubuntu Touch, Android, Windows, macOS and iOS
if(UBUNTU_TOUCH OR ANDROID OR WIN32 OR APPLE)
set(KAIDAN_ICONS_QRC kirigami-icons.qrc)
endif()
# Bundle images on Android
if(ANDROID)
# Bundle images on Android, Windows, macOS and iOS
if(ANDROID OR WIN32 OR APPLE)
set(KAIDAN_IMAGES_QRC "data/images/images.qrc")
endif()
# Set app icon
if(APPLE)
set(KAIDAN_ICNS "${CMAKE_SOURCE_DIR}/misc/macos/kaidan.icns")
elseif(WIN32)
include(ECMAddAppIcon)
file(GLOB WIN_ICONS_SRCS "${CMAKE_SOURCE_DIR}/misc/windows/*kaidan.png")
message(STATUS ${WIN_ICONS_SRCS})
ecm_add_app_icon(KAIDAN_ICNS ICONS ${WIN_ICONS_SRCS})
message(STATUS ${KAIDAN_ICNS})
endif()
add_executable(${PROJECT_NAME}
MACOSX_BUNDLE
WIN32
${KAIDAN_ICNS}
${KAIDAN_SOURCES}
${KAIDAN_ICONS_QRC} # only set if enabled
${KAIDAN_IMAGES_QRC} #
${I18N_QRC_CPP} #
"kaidan_qml.qrc"
)
set_target_properties(${PROJECT_NAME} PROPERTIES C_VISIBILITY_PRESET default)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_VISIBILITY_PRESET default)
#
......@@ -115,14 +136,78 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Qml
Qt5::Quick
Qt5::Svg
Qt5::Network
${__Qt5Widgets_LIBRARIES}
${GLOOX_LIBRARIES}
${GLOOX_LIBRARIES} ${GLOOX_LDFLAGS}
)
if (ANDROID OR WIN32)
target_link_libraries(${PROJECT_NAME} Qt5::QuickControls2 KF5::Kirigami2 ${OPENSSL_LIBRARIES})
endif()
if (ANDROID)
target_link_libraries(${PROJECT_NAME} Qt5::AndroidExtras Qt5::QuickControls2 KF5::Kirigami2 ${CRYPTO_LIBRARIES} ${SSL_LIBRARIES})
target_link_libraries(${PROJECT_NAME} Qt5::AndroidExtras)
endif()
if (WIN32 AND STATIC_BUILD)
pkg_check_modules(QT5ALL Qt5Gui Qt5Quick Qt5QuickControls2 Qt5Network Qt5Qml Qt5Svg Qt5Sql)
foreach(plugin ${Qt5Gui_PLUGINS} ${Qt5Network_PLUGINS} ${Qt5Qml_PLUGINS} ${Qt5Svg_PLUGINS} ${Qt5Sql_PLUGINS})
get_target_property(_loc ${plugin} LOCATION)
message("Plugin ${plugin} is at location ${_loc}")
set(plugin_libs ${plugin_libs} ${_loc})
endforeach()
pkg_search_module(SQLITE REQUIRED sqlite3)
set(QT_QML_PATH ${_qt5Quick_install_prefix})
find_library(KIRIGAMI_PLUGIN kirigamiplugin PATHS ${CMAKE_PREFIX_PATH}/${KDE_INSTALL_QMLDIR}/org/kde/kirigami.2)
find_library(QUICK_PLUGIN qtquick2plugin PATHS ${QT_QML_PATH}/qml/QtQuick.2)
find_library(LABS_PLATFORM_PLUGIN qtlabsplatformplugin PATHS ${QT_QML_PATH}/qml/Qt/labs/platform)
find_library(GRAPHEFFECTS_PLUGIN qtgraphicaleffectsplugin PATHS ${QT_QML_PATH}/qml/QtGraphicalEffects)
find_library(GRAPHEFFECTS_PRIVATE_PLUGIN qtgraphicaleffectsprivate PATHS ${QT_QML_PATH}/qml/QtGraphicalEffects/private)
find_library(QQC2_PLUGIN qtquickcontrols2plugin PATHS ${QT_QML_PATH}/qml/QtQuick/Controls.2)
find_library(QQC2_MATERIAL_PLUGIN qtquickcontrols2materialstyleplugin PATHS ${QT_QML_PATH}/qml/QtQuick/Controls.2/Material)
find_library(QQC2_UNIVERSAL_PLUGIN qtquickcontrols2universalstyleplugin PATHS ${QT_QML_PATH}/qml/QtQuick/Controls.2/Universal)
find_library(QLAYOUTS_PLUGIN qquicklayoutsplugin PATHS ${QT_QML_PATH}/qml/QtQuick/Layouts)
find_library(QWINDOW_PLUGIN windowplugin PATHS ${QT_QML_PATH}/qml/QtQuick/Window.2)
find_library(QSHAPES_PLUGIN qmlshapesplugin PATHS ${QT_QML_PATH}/qml/QtQuick/Shapes)
find_library(QTEMPLATES_PLUGIN qtquicktemplates2plugin PATHS ${QT_QML_PATH}/qml/QtQuick/Templates.2)
find_library(QMODELS_PLUGIN modelsplugin PATHS ${QT_QML_PATH}/qml/QtQml/Models.2)
find_library(WIN_SECUR32 secur32)
find_library(QT_FONT_SUPPORT Qt5FontDatabaseSupport)
find_library(QT_THEME_SUPPORT Qt5ThemeSupport)
find_library(QT_EVENT_SUPPORT Qt5EventDispatcherSupport)
find_library(QT_ACCESSIBILITY_SUPPORT Qt5AccessibilitySupport)
find_library(QT_UIAUTO_SUPPORT Qt5WindowsUIAutomationSupport)
target_link_libraries(${PROJECT_NAME}
${plugin_libs}
${KIRIGAMI_PLUGIN}
${QUICK_PLUGIN}
${LABS_PLATFORM_PLUGIN}
${GRAPHEFFECTS_PLUGIN}
${GRAPHEFFECTS_PRIVATE_PLUGIN}
${QQC2_PLUGIN}
${QQC2_MATERIAL_PLUGIN}
${QQC2_UNIVERSAL_PLUGIN}
${QLAYOUTS_PLUGIN}
${QWINDOW_PLUGIN}
${QSHAPES_PLUGIN}
${QTEMPLATES_PLUGIN}
${QMODELS_PLUGIN}
${SQLITE_LIBRARIES}
${QT_EVENT_SUPPORT}
${QT_FONT_SUPPORT}
${QT_THEME_SUPPORT}
${QT_ACCESSIBILITY_SUPPORT}
${QT_UIAUTO_SUPPORT}
jpeg
${__Qt5Widgets_LIBRARIES} ${WIN_SECUR32}
${QT5ALL_LDFLAGS})
endif()
# Set a custom plist file for the app bundle
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/misc/macos/Info.plist)
#
# Global C++ variables
#
......@@ -137,12 +222,18 @@ elseif(NOT ANDROID)
)
endif()
if(STATIC_BUILD)
set(KAIDAN_COMPILE_DEFINITIONS
STATIC_BUILD=True
${KAIDAN_COMPILE_DEFINITIONS}
)
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE
DEBUG_SOURCE_PATH="${CMAKE_SOURCE_DIR}"
${KAIDAN_COMPILE_DEFINITIONS}
)
#
# Install Kaidan
#
......
......@@ -106,7 +106,7 @@ TRANSLATIONS += \
i18n/ru.ts \
i18n/pt.ts
DEFINES += QMAKE_BUILD
DEFINES += STATIC_BUILD
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH = $$PWD/src/qml $$PWD/3rdparty/kirigami/src
......
{
"template": "custom",
"dir": "./bin/ubuntu-touch/",
"build": "../../utils/build-click.sh",
"build": "../../utils/build-linux-click.sh",
"kill": "kaidan",
"specificDependencies": true,
"dependencies": [
......
# - Try to find GLOOX
# Find GLOOX headers, libraries and the answer to all questions.
#
# GLOOX_FOUND True if gloox got found
# GLOOX_INCLUDE_DIR Location of gloox headers
# GLOOX_LIBRARIES List of libaries to use gloox
#
# Copyright (c) 2009 Nigmatullin Ruslan <euroelessar@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
FIND_PATH( GLOOX_INCLUDE_DIR "gloox/gloox.h" )
FIND_LIBRARY( GLOOX_LIBRARIES gloox )
if( GLOOX_LIBRARIES AND GLOOX_INCLUDE_DIR )
message( STATUS "Found gloox: ${GLOOX_LIBRARIES}" )
include_directories(${GLOOX_INCLUDE_DIR})
set( GLOOX_FOUND 1 )
else( GLOOX_LIBRARIES AND GLOOX_INCLUDE_DIR )
message( STATUS "Could NOT find gloox" )
endif( GLOOX_LIBRARIES AND GLOOX_INCLUDE_DIR )
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>kaidan</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>kaidan</string>
<key>CFBundleIdentifier</key>
<string></string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
......@@ -31,6 +31,7 @@
#include "AvatarFileStorage.h"
#include <QDir>
#include <QUrl>
#include <QStandardPaths>
#include <QCryptographicHash>
#include <QDebug>
......@@ -143,7 +144,7 @@ QString AvatarFileStorage::getAvatarPathOfJid(const QString& jid) const
QString AvatarFileStorage::getAvatarUrl(const QString &jid) const
{
return QString("file://") + getAvatarPathOfJid(jid);
return QUrl::fromLocalFile(getAvatarPathOfJid(jid)).toString();
}
bool AvatarFileStorage::hasAvatarHash(const QString& hash) const
......
......@@ -33,6 +33,7 @@
// Qt
#include <QDebug>
#include <QDir>
#include <QUrl>
#include <QSettings>
#include <QString>
#include <QStandardPaths>
......@@ -254,6 +255,10 @@ void Kaidan::removeContact(QString jid)
QString Kaidan::getResourcePath(QString name) const
{
// We generally prefer to first search for files in application resources
if (QFile::exists(":/" + name))
return QString("qrc:/" + name);
// list of file paths where to search for the resource file
QStringList pathList;
// add relative path from binary (only works if installed)
......@@ -277,14 +282,10 @@ QString Kaidan::getResourcePath(QString name) const
// look up the file
if (directory.exists(name)) {
// found the file, return the path
return QString("file://") + directory.absoluteFilePath(name);
return QUrl::fromLocalFile(directory.absoluteFilePath(name)).toString();
}
}
// on Android, we want to fetch images from the application resources
if (QFile::exists(":/" + name))
return QString("qrc:/" + name);
// no file found
qWarning() << "[main] Could NOT find media file:" << name;
return QString("");
......
......@@ -52,6 +52,10 @@
#include "Enums.h"
#include "StatusBar.h"
#ifdef STATIC_BUILD
#include "static_plugins.h"
#endif
#ifndef QAPPLICATION_CLASS
#define QAPPLICATION_CLASS QApplication
#endif
......@@ -62,7 +66,8 @@
#include "singleapp/singleapplication.h"
#endif
#ifdef QMAKE_BUILD
#ifdef STATIC_BUILD
#define KIRIGAMI_BUILD_TYPE_STATIC
#include "./3rdparty/kirigami/src/kirigamiplugin.h"
#endif
......@@ -107,8 +112,14 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err
return CommandLineOk;
}
int main(int argc, char *argv[])
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#ifdef _WIN32
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
#endif
// initialize random generator
qsrand(time(NULL));
......@@ -224,17 +235,21 @@ int main(int argc, char *argv[])
}
QQmlApplicationEngine engine;
#ifndef SAILFISH_OS
// QtQuickControls2 Style
if (qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty()) {
qDebug() << "QT_QUICK_CONTROLS_STYLE not set, setting to Material";
qputenv("QT_QUICK_CONTROLS_STYLE", "Material");
#ifdef Q_OS_WIN
QString defaultStyle = "Universal";
#else
QString defaultStyle = "Material";
#endif
qDebug() << "QT_QUICK_CONTROLS_STYLE not set, setting to " + defaultStyle;
qputenv("QT_QUICK_CONTROLS_STYLE", defaultStyle.toLatin1());
}
#endif
// QML type bindings
#ifdef QMAKE_BUILD
#ifdef STATIC_BUILD
KirigamiPlugin::getInstance().registerTypes();
#endif
qmlRegisterType<StatusBar>("StatusBar", 0, 1, "StatusBar");
......
......@@ -74,7 +74,7 @@ Item {
Connections {
target: fileChooserLoader.item
onAccepted: {
fileUrl = fileChooserLoader.item.fileUrl
fileUrl = fileChooserLoader.item.file
root.accepted()
console.log("Child file dialog accepted. URL: " + fileUrl)
}
......
......@@ -29,7 +29,7 @@
*/
import QtQuick 2.6
import QtQuick.Dialogs 1.2
import Qt.labs.platform 1.0
FileDialog {
id: fileDialog
......
/*
* Kaidan - A user-friendly XMPP client for every device!
*
* Copyright (C) 2016-2018 Kaidan developers and contributors
* (see the LICENSE file for a full list of copyright authors)
*
* Kaidan is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* In addition, as a special exception, the author of Kaidan gives
* permission to link the code of its release with the OpenSSL
* project's "OpenSSL" library (or with modified versions of it that
* use the same license as the "OpenSSL" library), and distribute the
* linked executables. You must obey the GNU General Public License in
* all respects for all of the code used other than "OpenSSL". If you
* modify this file, you may extend this exception to your version of
* the file, but you are not obligated to do so. If you do not wish to
* do so, delete this exception statement from your version.
*
* Kaidan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kaidan. If not, see <http://www.gnu.org/licenses/>.
*/
// This file imports static plugin classes for static plugins
#include <QtPlugin>
#ifdef __APPLE__
Q_IMPORT_PLUGIN(QIOSIntegrationPlugin)
Q_IMPORT_PLUGIN(QMacHeifPlugin)
Q_IMPORT_PLUGIN(QMacJp2Plugin)
Q_IMPORT_PLUGIN(QICNSPlugin)
Q_IMPORT_PLUGIN(QTgaPlugin)
Q_IMPORT_PLUGIN(QTiffPlugin)
Q_IMPORT_PLUGIN(QWbmpPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin)
#endif // __APPLE__
Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin);
// Media support
Q_IMPORT_PLUGIN(QSvgPlugin)
Q_IMPORT_PLUGIN(QSvgIconPlugin)
Q_IMPORT_PLUGIN(QGifPlugin)
Q_IMPORT_PLUGIN(QICOPlugin)
Q_IMPORT_PLUGIN(QJpegPlugin)
// Qt Quick and network
Q_IMPORT_PLUGIN(QLocalClientConnectionFactory)
Q_IMPORT_PLUGIN(QTcpServerConnectionFactory)
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
Q_IMPORT_PLUGIN(QSQLiteDriverPlugin)
Q_IMPORT_PLUGIN(KirigamiPlugin)
Q_IMPORT_PLUGIN(QtQuick2Plugin)
Q_IMPORT_PLUGIN(QtLabsPlatformPlugin)
Q_IMPORT_PLUGIN(QtGraphicalEffectsPlugin)
Q_IMPORT_PLUGIN(QtGraphicalEffectsPrivatePlugin)
Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
Q_IMPORT_PLUGIN(QtQuickControls2MaterialStylePlugin)
Q_IMPORT_PLUGIN(QtQuickControls2UniversalStylePlugin)
Q_IMPORT_PLUGIN(QtQuickLayoutsPlugin)
Q_IMPORT_PLUGIN(QtQuick2WindowPlugin)
Q_IMPORT_PLUGIN(QmlShapesPlugin)
Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin)
Q_IMPORT_PLUGIN(QtQmlModelsPlugin)
......@@ -18,13 +18,21 @@ if [ -z "$QT_ANDROID" ]; then
exit 1
fi
# Build type is one of:
# Debug, Release, RelWithDebInfo and MinSizeRel
BUILD_TYPE="${BUILD_TYPE:-Debug}"
# Android SDK Tools version available on the system
ANDROID_SDK_BUILD_TOOLS_REVISION=${ANDROID_SDK_BUILD_TOOLS_REVISION:-25.0.3}
# Build API version
ANDROID_API_VERSION=21
KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/..
GLOOX_PATH=/tmp/gloox
OPENSSL_PATH=/tmp/openssl
OPENSSL_SETENV=$OPENSSL_PATH/Setenv-android.sh
CUSTOM_ANDROID_TOOLCHAIN=/tmp/android-arm-toolchain
ANDROID_API_VERSION=21
ANDROID_SDK_BUILD_TOOLS_REVISION=25.0.3
echo "-- Starting $BUILD_TYPE build of Kaidan --"
echo "*****************************************"
echo "Fetching dependencies if required"
......@@ -102,7 +110,7 @@ echo "*****************************************"
cd $GLOOX_PATH
./autogen.sh
./configure --host=arm --with-openssl=$CUSTOM_ANDROID_TOOLCHAIN --prefix=$CUSTOM_ANDROID_TOOLCHAIN
./configure --host=arm --with-openssl=$CUSTOM_ANDROID_TOOLCHAIN --prefix=$CUSTOM_ANDROID_TOOLCHAIN --with-tests=no --with-examples=no
make -j$(nproc)
make install
}
......@@ -129,7 +137,8 @@ echo "*****************************************"
-DANDROID_NDK=$ANDROID_NDK_ROOT \
-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT \
-DANDROID_SDK_BUILD_TOOLS_REVISION=$ANDROID_SDK_BUILD_TOOLS_REVISION \
-DCMAKE_INSTALL_PREFIX=$CUSTOM_ANDROID_TOOLCHAIN
-DCMAKE_INSTALL_PREFIX=$CUSTOM_ANDROID_TOOLCHAIN \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
make -j$(nproc)
make install
rm -rf $KAIDAN_SOURCES/3rdparty/kirigami/build
......@@ -173,7 +182,7 @@ echo "*****************************************"
-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT \
-DANDROID_SDK_BUILD_TOOLS_REVISION=$ANDROID_SDK_BUILD_TOOLS_REVISION \
-DCMAKE_INSTALL_PREFIX=$CUSTOM_ANDROID_TOOLCHAIN \
-DANDROID_APK_DIR=../misc/android \
-DANDROID_APK_DIR=../misc/android -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DKF5Kirigami2_DIR=$CUSTOM_ANDROID_TOOLCHAIN/lib/cmake/KF5Kirigami2 -DI18N=1
make create-apk-kaidan -j$(nproc)
}
......
#!/bin/bash
echo "*****************************************"
echo "Building Kaidan AppImage. This may take a long time"
echo "*****************************************"
# Download linuxdeployqt
if ! [ -f linuxdeployqt-continuous-x86_64.AppImage ]; then
wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod +x linuxdeployqt-continuous-x86_64.AppImage
fi
# configure buildsystem and environment for AppDir installation
if ! [ -d ../build ]; then mkdir ../build; fi
cd ../build
export QT_SELECT=qt5
# Build kaidan
cmake .. -GNinja -DI18N=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build .
DESTDIR=../AppDir cmake --build . --target install
cd ..
# Copy dependencies into AppDir
./utils/linuxdeployqt-continuous-x86_64.AppImage $PWD/AppDir/usr/share/applications/kaidan.desktop -qmldir=/usr/lib/x86_64-linux-gnu/qt5/qml/ -bundle-non-qt-libs
# Create AppImage
./utils/linuxdeployqt-continuous-x86_64.AppImage $PWD/AppDir/usr/share/applications/kaidan.desktop -appimage
#!/bin/bash
# NOTE: To use this script, you need to set $QT_LINUX to your Qt for Linux installation
if [ -z "$QT_LINUX" ]; then
echo "QT_LINUX has to be set"
exit 1
fi
# Build type is one of:
# Debug, Release, RelWithDebInfo and MinSizeRel
BUILD_TYPE="${BUILD_TYPE:-Debug}"
KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/..
KIRIGAMI_BUILD=/tmp/kirigami-linux-build
echo "-- Starting $BUILD_TYPE build of Kaidan --"
echo "*****************************************"
echo "Fetching dependencies if required"
echo "*****************************************"
if [ ! -f "$KAIDAN_SOURCES/3rdparty/kirigami/.git" ] || [ ! -f "$KAIDAN_SOURCES/3rdparty/breeze-icons/.git" ]; then
echo "Cloning Kirigami and Breeze icons"
git submodule update --init
fi
if [ ! -f "$KAIDAN_SOURCES/3rdparty/linuxdeployqt-continuous-x86_64.AppImage" ]; then
echo "Downloading linuxdeployqt"
wget -P $KAIDAN_SOURCES/3rdparty/ https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
chmod +x $KAIDAN_SOURCES/3rdparty/linuxdeployqt-continuous-x86_64.AppImage
fi
cdnew() {
if [ -d "$1" ]; then
rm -rf "$1"
fi
mkdir $1
cd $1
}
export QT_SELECT=qt5
if [ ! -f "$KIRIGAMI_BUILD/lib64/libKF5Kirigami2.so" ]; then
echo "*****************************************"
echo "Building Kirigami"
echo "*****************************************"
{
cdnew $KAIDAN_SOURCES/3rdparty/kirigami/build
cmake .. \
-DECM_DIR=/usr/share/ECM/cmake \
-DCMAKE_PREFIX_PATH=$QT_LINUX \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$KIRIGAMI_BUILD
make -j$(nproc)
make install
rm -rf $KAIDAN_SOURCES/3rdparty/kirigami/build
}
fi
if [ ! -f "$KAIDAN_SOURCES/build/bin/kaidan" ]; then
echo "*****************************************"
echo "Building Kaidan"
echo "*****************************************"
{
cdnew $KAIDAN_SOURCES/build
cmake .. \
-DECM_DIR=/usr/share/ECM/cmake \
-DCMAKE_PREFIX_PATH=$QT_LINUX \
-DKF5Kirigami2_DIR=$KIRIGAMI_BUILD/lib64/cmake/KF5Kirigami2 -DI18N=1 \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr
make -j$(nproc)
}
fi
if [ ! -f "$KAIDAN_SOURCES/AppDir/usr/bin/kaidan" ]; then
echo "*****************************************"
echo "Installing Kaidan"
echo "*****************************************"
{
cd $KAIDAN_SOURCES/build
DESTDIR=$KAIDAN_SOURCES/AppDir cmake --build . --target install
}
fi
echo "*****************************************"
echo "Packing into AppImage"
echo "*****************************************"
{
cd $KAIDAN_SOURCES
export LD_LIBRARY_PATH=$QT_LINUX/lib/:$KIRIGAMI_BUILD/lib64:$LD_LIBRARY_PATH
export PATH=$QT_LINUX/bin/:$PATH
$KAIDAN_SOURCES/3rdparty/linuxdeployqt-continuous-x86_64.AppImage $KAIDAN_SOURCES/AppDir/usr/share/applications/kaidan.desktop -qmake=$QT_LINUX/bin/qmake -qmldir=$KAIDAN_SOURCES/src/qml/ -qmlimport=$KIRIGAMI_BUILD/lib64/qml/ -appimage -no-copy-copyright-files
}
......@@ -22,26 +22,40 @@ install_deb() {
}
install_dependencies() {
LIBIDN_VERSION="1.33-2.2ubuntu1"
GNUTLS_VERSION="3.2.11-2ubuntu1.2"
GLOOX_VERSION="1.0.20-1+16.04+xenial+build1"
echo "I: Installing libidn"
for PKG in libidn11-dev libidn11; do
install_deb http://ports.ubuntu.com/ubuntu-ports/pool/main/libi/libidn ${PKG} ${LIBIDN_VERSION}
done
echo "I: Installing gnutls"
for PKG in libgnutls28-dev libgnutls28; do
install_deb http://ports.ubuntu.com/ubuntu-ports/pool/universe/g/gnutls28 ${PKG} ${GNUTLS_VERSION}
done
echo "I: Installing gloox"
for PKG in libgloox-dev libgloox17; do
install_deb http://neon.plasma-mobile.org:8080/pool/main/g/gloox ${PKG} ${GLOOX_VERSION}
done
echo "I: Installing libraries"
mv $CLICK_TARGET_DIR/usr/* $CLICK_TARGET_DIR/
cp -R $CLICK_TARGET_DIR/usr/* $CLICK_TARGET_DIR/
}
build_kaidan() {
mkdir -p $KAIDAN_SOURCES/build
cd $KAIDAN_SOURCES/build
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$CLICK_TARGET_DIR/lib/$DEB_HOST_MULTIARCH/pkgconfig
export LDFLAGS="${LDFLAGS} -L${CLICK_TARGET_DIR}/lib/$DEB_HOST_MULTIARCH"
cmake .. \
-GNinja \
-DCMAKE_MAKE_PROGRAM=/usr/bin/ninja \
-DCMAKE_PREFIX_PATH="${CLICK_TARGET_DIR}" \
-DCMAKE_INSTALL_PREFIX="${CLICK_TARGET_DIR}" \
-DGLOOX_INCLUDE_DIR="${CLICK_TARGET_DIR}/include" \
-DCMAKE_CXX_FLAGS=-isystem\ ${CLICK_TARGET_DIR}/include \
-DI18N=1 \
-DUBUNTU_TOUCH=1 \
-DCLICK_ARCH="${ARCH}" \
......@@ -57,7 +71,8 @@ cleanup_click_dir() {
$CLICK_TARGET_DIR/usr \
$CLICK_TARGET_DIR/include \
$CLICK_TARGET_DIR/share/doc \
$CLICK_TARGET_DIR/lib/$DEB_HOST_MULTIARCH/pkgconfig
$CLICK_TARGET_DIR/lib/$DEB_HOST_MULTIARCH/pkgconfig \
$CLICK_TARGET_DIR/lib/$DEB_HOST_MULTIARCH/libidn.so
}