Commit 4328565d authored by Jonah Brüchert's avatar Jonah Brüchert 🌳 Committed by LNJ

Add Ubuntu Touch packaging & CI builds (#150)

This adds Ubuntu Touch click packaging and automated build scripts for Travis-CI builds. Building
is and will be only possible with CMake.

Currently the icons aren't working correctly (as in all CMake builds with a KF5 build from 5.40 to
5.43). There also might be still some problems with scaling, but the rest should work fine.

Publishing to the Open Store is planned, as soon as we get some more feedback.

Ubuntu Touch builds currently use a workaround for the application name: it'll use the application
id/uri for it, needed because of app armor. But I'd like to change to this principle on all platforms, so
in the future the configs and other persistant files will be saved in `~/.config/im.kaidan.kaidan` or
`~/.local/share/im.kaidan.kaidan/`, although I'm a bit unsure for normal desktop linux, there.

However, happy testing! :)
parent ed9e4239
################### Kaidan ####################
kaidan
kaidan_automoc.cpp
misc/ubuntu-touch/manifest.json
3rdparty/openssl
3rdparty/gloox
......
language: cpp
compiler: gcc
services:
- docker
cache:
ccache: true
directories:
......@@ -15,6 +17,17 @@ script:
matrix:
include:
- env: BUILD_SYSTEM=qmake
- env: BUILD_SYSTEM=cmake
git:
submodules: false
- env: PLATFORM=ubuntu-touch
git:
submodules: false
# only cache apt archives
cache:
directories:
- /var/cache/apt/archives
notifications:
email: false
......@@ -4,9 +4,13 @@ set(QT_MIN_VERSION "5.8.0")
project(kaidan)
set(APPLICATION_ID "im.kaidan.kaidan")
# CMake options
option(I18N "Enable i18n support" FALSE)
option(SAILFISH_OS "Build with Sailfish OS GUI, needs 3rdparty/kaidansf submodule" FALSE)
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")
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
......@@ -93,6 +97,10 @@ if(SAILFISH_OS)
SAILFISH_OS=True
PLATFORM_DISPLAY_NAME="Sailfish OS"
)
elseif(UBUNTU_TOUCH)
set(KAIDAN_COMPILE_DEFINITIONS
UBUNTU_TOUCH=True
)
else()
set(KAIDAN_COMPILE_DEFINITIONS
NOTIFICATIONS_LIBNOTIFY=True
......@@ -109,29 +117,46 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE
# Install Kaidan
#
if(UNIX AND NOT APPLE)
if(UBUNTU_TOUCH AND CLICK_ARCH)
# will replace ${CLICK_ARCH} with its value
configure_file(${CMAKE_SOURCE_DIR}/misc/ubuntu-touch/manifest.json.in
${CMAKE_SOURCE_DIR}/misc/ubuntu-touch/manifest.json)
# install kaidan binary
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_PREFIX}
)
# install kaidan media
install(DIRECTORY "data/images"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/${APPLICATION_ID}"
)
# install icon
install(FILES "misc/kaidan.svg" "misc/ubuntu-touch/apparmor.json"
"misc/ubuntu-touch/kaidan.desktop" "misc/ubuntu-touch/manifest.json"
DESTINATION "${CMAKE_INSTALL_PREFIX}"
)
elseif(UNIX AND NOT APPLE)
# install kaidan binary
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
)
# install kaidan media
install(DIRECTORY "data/images"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}"
)
# install icon (scalable + 128x)
install(FILES "misc/kaidan.svg"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps"
)
install(FILES "misc/kaidan-128x128.png"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/128x128/apps"
RENAME "kaidan.png"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/128x128/apps"
RENAME "kaidan.png"
)
# install desktop file
install(FILES "misc/kaidan.desktop"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/applications"
DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/applications"
)
endif()
......
......@@ -25,7 +25,12 @@ earlier developer of Kaidan.
Kaidan is *not* finished yet, so don't expect it working as well as a finished client will do.
## Installation
## Compilation & Installation
* [Debian Stretch based systems](#debian-stretch-based-systems)
* [Linux Desktop](#compile-kaidan-for-desktop-linux)
* [Ubuntu Touch (click package)](#compile-kaidan-for-ubuntu-touch)
### Debian Stretch based systems
......@@ -44,7 +49,7 @@ Then you can install Kaidan
sudo apt install kaidan
```
### Compile it yourself
### Compile Kaidan for Desktop Linux
#### Install all dependencies:
* [Qt](http://doc.qt.io/qt-5/build-sources.html) (Core Qml Quick Sql QuickControls2) (>= 5.8.0)
......@@ -94,6 +99,36 @@ make -j$(nproc)
sudo make install
```
### Compile Kaidan for Ubuntu Touch
This will fully automatically compile and build a click packge for Ubuntu Touch 16.04. Clickable and our
build script do the hard work for you, so building is rather simple.
Build-dependencies:
* [Clickable](https://github.com/bhdouglass/clickable)
* [Docker](https://www.docker.com/)
* Git
#### Set up clickable docker container
After you've installed the dependencies, you need to set up the Ubuntu Touch SDK docker container.
```bash
clickable setup-docker
```
#### Clone Kaidan and start build
Now, you can clone our Kaidan repository using git and start building kaidan using clickable.
```bash
git clone https://github.com/kaidanim/kaidan
cd kaidan
clickable clean build click-build
```
The built click package will be located at `bin/ubuntu-touch/`.
----
![GPLv3](https://www.gnu.org/graphics/gplv3-127x51.png)
......
{
"template": "custom",
"dir": "./bin/ubuntu-touch/",
"build": "../../utils/build-click.sh",
"kill": "kaidan",
"sdk": "ubuntu-sdk-16.04",
"specificDependencies": true,
"dependencies": [
"ninja-build",
"curl"
]
}
......@@ -2,7 +2,7 @@
# 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_INCLUDE_DIR Location of gloox headers
# GLOOX_LIBRARIES List of libaries to use gloox
#
# Copyright (c) 2009 Nigmatullin Ruslan <euroelessar@gmail.com>
......@@ -17,6 +17,7 @@ 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" )
......
{
"policy_groups": [
"networking",
"connectivity"
],
"policy_version": 1.3
}
[Desktop Entry]
Type=Application
Version=1.0
Name=Kaidan
Exec=kaidan
Icon=kaidan.svg
Terminal=false
X-Ubuntu-Touch=true
{
"name": "im.kaidan.kaidan",
"description": "A simple and user-friendly Jabber/XMPP client for every device",
"architecture": "@CLICK_ARCH@",
"title": "Kaidan",
"framework": "ubuntu-sdk-16.04",
"hooks": {
"kaidan": {
"desktop": "kaidan.desktop",
"apparmor": "apparmor.json"
}
},
"version": "0.4.0~dev",
"maintainer": "Kaidan developers <gamerbude@lnj.li>"
}
......@@ -35,7 +35,11 @@
* Application information
*/
#define APPLICATION_ID "io.github.kaidanim"
#ifdef UBUNTU_TOUCH
#define APPLICATION_NAME "im.kaidan.kaidan"
#else
#define APPLICATION_NAME "kaidan"
#endif
#define APPLICATION_DISPLAY_NAME "Kaidan"
#define APPLICATION_DESCRIPTION "A simple, user-friendly Jabber/XMPP client"
#define VERSION_STRING "0.4.0-dev"
......
......@@ -170,6 +170,10 @@ int main(int argc, char *argv[])
}
#endif
#ifdef UBUNTU_TOUCH
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "true");
#endif
// QML type bindings
#ifdef QMAKE_BUILD
KirigamiPlugin::getInstance().registerTypes();
......
#!/bin/bash -e
KAIDAN_SOURCES=$(dirname "$(readlink -f "${0}")")/..
CLICK_TARGET_DIR="$KAIDAN_SOURCES/bin/ubuntu-touch/tmp" # tmp is hard-coded into clickable
mkdir -p $CLICK_TARGET_DIR
ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
install_deb() {
BASE_URL="${1}"; PKG="${2}"; VERSION="${3}"
DEB_NAME="${PKG}_${VERSION}_${ARCH}.deb"
# download deb using curl with a nice progress bar
curl -L --progress-bar ${BASE_URL}/${DEB_NAME} -o "/tmp/${DEB_NAME}"
# install to click
dpkg-deb -x "/tmp/${DEB_NAME}" ${CLICK_TARGET_DIR}
# clean up
rm "/tmp/${DEB_NAME}"
}
install_dependencies() {
KIRIGAMI_VERSION="5.43.0-1"
QQC2_VERSION="5.9.3-0ubports2"
GLOOX_VERSION="1.0.20-1+16.04+xenial+build1"
echo "I: Installing Kirigami 2"
for PKG in qml-module-org-kde-kirigami2 kirigami2-dev libkf5kirigami2-5; do
install_deb https://deb.debian.org/debian/pool/main/k/kirigami2 ${PKG} ${KIRIGAMI_VERSION}
done
echo "I: Installing QtQuick Controls 2"
for PKG in qml-module-qtquick-controls2 libqt5quickcontrols2-5 qtquickcontrols2-5-dev qml-module-qtquick-templates2 qml-module-qt-labs-platform libqt5quicktemplates2-5 libqt5quicktemplates2-5; do
install_deb https://repo.ubports.com/pool/xenial/main/q/qtquickcontrols2-opensource-src ${PKG} ${QQC2_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 QML modules"
mv $CLICK_TARGET_DIR/usr/lib/$DEB_HOST_MULTIARCH/qt5/qml/* $CLICK_TARGET_DIR/usr/lib/$DEB_HOST_MULTIARCH
echo "I: Installing libraries"
mv $CLICK_TARGET_DIR/usr/* $CLICK_TARGET_DIR/
}
build_kaidan() {
mkdir -p $KAIDAN_SOURCES/build
cd $KAIDAN_SOURCES/build
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" \
-DI18N=1 \
-DUBUNTU_TOUCH=1 \
-DCLICK_ARCH="${ARCH}"
ninja install
}
cleanup_click_dir() {
# Strip out documentation and includes
rm -r \
$CLICK_TARGET_DIR/usr \
$CLICK_TARGET_DIR/include \
$CLICK_TARGET_DIR/share/doc \
$CLICK_TARGET_DIR/share/locale \
$CLICK_TARGET_DIR/lib/$DEB_HOST_MULTIARCH/cmake \
$CLICK_TARGET_DIR/lib/$DEB_HOST_MULTIARCH/pkgconfig \
$CLICK_TARGET_DIR/lib/$DEB_HOST_MULTIARCH/qt5/mkspecs
}
echo "*****************************************"
echo "Downloading Debian packages"
echo "*****************************************"
install_dependencies
echo "*****************************************"
echo "Building Kaidan"
echo "*****************************************"
build_kaidan
cleanup_click_dir
echo "*****************************************"
echo "Build script finished, now leaving work to 'click build'"
echo "******************************************"
......@@ -3,16 +3,18 @@
echo "*****************************************"
echo "Building Kaidan"
echo "Using build system: ${BUILD_SYSTEM}"
echo "Number of CPUs used: $(nproc)"
echo "^^^^^^^^^^^^^^^"
echo_env
echo "*****************************************"
#env_setup
echo
mkdir -p ${TRAVIS_BUILD_DIR}/build
cd ${TRAVIS_BUILD_DIR}/build
if [[ ${BUILD_SYSTEM} == "cmake" ]]; then
if [[ ${PLATFORM} == "ubuntu-touch" ]]; then
cd ..
clickable clean build click-build
elif [[ ${BUILD_SYSTEM} == "cmake" ]]; then
cmake .. \
-GNinja \
-DCMAKE_BUILD_TYPE=Debug \
......@@ -30,6 +32,6 @@ elif [[ ${BUILD_SYSTEM} == "qmake" ]]; then
make -j$(nproc)
else
echo "Unknown build system \"${BUILD_SYSTEM}\""
echo "Unknown platform or build system!"
exit 1
fi
......@@ -5,7 +5,21 @@ if command -v nproc >/dev/null; then
export CPUS_USED=$(nproc)
fi
add_apt_repos() {
if [[ ${PLATFORM} == "ubuntu-touch" ]]; then
export BUILD_SYSTEM="cmake"
elif [[ ${PLATFORM} == "" ]]; then
# currently there's only linux-desktop & ut
# otherwise other parameters (as TRAVIS_OS_NAME) could be checked
export PLATFORM="linux-desktop"
fi
echo_env() {
echo "PLATFORM=${PLATFORM}"
echo "BUILD_SYSTEM=${BUILD_SYSTEM}"
echo "CPUS_USED=${CPUS_USED}"
}
add_linux-desktop_apt_repos() {
sudo apt-get install dirmngr
# trusty backports
......@@ -15,6 +29,10 @@ add_apt_repos() {
sudo add-apt-repository ppa:beineri/opt-qt593-trusty -y
}
add_ubuntu-touch_apt_repos() {
sudo add-apt-repository ppa:bhdouglass/clickable -y
}
install_kf5() {
wget -c "https://github.com/JBBgameich/precompiled-kf5-linux/releases/download/KF5.40/kf5.40-gcc6-linux64-release.tar.xz"
tar xf kf5.40-gcc6-linux64-release.tar.xz
......@@ -33,8 +51,8 @@ install_gloox() {
rm libgloox*.deb
}
install_linux_deps() {
add_apt_repos
install_linux-desktop_deps() {
add_linux-desktop_apt_repos
sudo apt-get update
sudo apt-get install -y -t trusty-backports \
......@@ -57,6 +75,14 @@ install_linux_deps() {
install_gloox
}
install_ubuntu-touch_deps() {
add_ubuntu-touch_apt_repos
sudo apt-get update
sudo apt-get install clickable
clickable setup-docker
}
env_setup() {
if [ -f /opt/qt5*/bin/qt5*-env.sh ]; then
echo "Setting up custom Qt 5.9 installation..."
......
......@@ -3,11 +3,14 @@
echo "*****************************************"
echo "Fetching dependencies"
echo "Using build system: ${BUILD_SYSTEM}"
echo "^^^^^^^^^^^^^^^^^^^^^"
echo_env
echo "*****************************************"
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
install_linux_deps
if [ ${PLATFORM} == "linux-desktop" ]; then
install_linux-desktop_deps
elif [ ${PLATFORM} == "ubuntu-touch" ]; then
install_ubuntu-touch_deps
else
echo "Can't build on \"${TRAVIS_OS_NAME}\""
exit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment