Projects/Edu/KStars/Building KStars KF5: Difference between revisions

From KDE TechBase
< Projects‎ | Edu‎ | KStars
(Add updated KStars ubuntu apt-get)
 
(14 intermediate revisions by 7 users not shown)
Line 3: Line 3:
== Why build from source? ==
== Why build from source? ==
Typically, you would want to build KStars from source if you plan to develop KStars, or stay on the bleeding edge and contribute valuable feedback.
Typically, you would want to build KStars from source if you plan to develop KStars, or stay on the bleeding edge and contribute valuable feedback.
== Integrated Development Environment (IDE) ==
If you plan to develop KStars, it is highly recommended to utilize an IDE. You can use any IDE of your choice, but [http://www.qt.io/ide/ QtCreator] or [https://www.kdevelop.org/ KDevelop] are recommended as they are more suited for Qt/KDE development.


== Prerequisite Packages ==
== Prerequisite Packages ==
Line 10: Line 13:
* GNU Make, GCC -- Essential tools for building
* GNU Make, GCC -- Essential tools for building
* cmake -- buildsystem used by KDE
* cmake -- buildsystem used by KDE
* QtBase, QtDeclarative, QtSvg
* Qt Library > 5.2.0
* Several KDE Frameworks:  KConfig, KDocTools, KGuiAddons, KWidgetsAddons, KNewStuff, KDBusAddons, KI18n, KInit, KJobWidgets, KIO, KWindowSystem, KXmlGui, KPlotting, KTextEditor, KIconThemes
* Several KDE Frameworks:  KConfig, KDocTools, KGuiAddons, KWidgetsAddons, KNewStuff, KI18n, KInit, KIO, KXmlGui, KPlotting, KIconThemes
* eigen -- linear algebra library
* eigen -- linear algebra library
* zlib -- compression library
* zlib -- compression library
Line 18: Line 21:
* libcfitsio -- FITS library
* libcfitsio -- FITS library
* libindi -- Instrument Neutral Distributed Interface, for controlling equipment.
* libindi -- Instrument Neutral Distributed Interface, for controlling equipment.
* xplanet


=== Installing these packages ===
=== Installing these packages ===
To install all of these, use the following commands:
To install all of these, use the following commands:
==== Debian / Kubuntu ====
==== Debian / Kubuntu ====
<syntaxhighlight lang="bash">
sudo apt-get -y install build-essential cmake git libeigen3-dev libcfitsio-dev zlib1g-dev libindi-dev extra-cmake-modules libkf5plotting-dev libqt5svg5-dev libkf5xmlgui-dev kio-dev kinit-dev libkf5newstuff-dev kdoctools-dev libkf5notifications-dev qtdeclarative5-dev libkf5crash-dev gettext libnova-dev libgsl-dev libraw-dev libkf5notifyconfig-dev wcslib-dev libqt5websockets5-dev xplanet xplanet-images qt5keychain-dev libsecret-1-dev breeze-icon-theme
</syntaxhighlight>


  sudo apt-get install build-essential cmake qtdeclarative5-dev libkf5config-dev kdoctools-dev libkf5guiaddons-dev libkf5widgetsaddons-dev libkf5newstuff-dev libkf5dbusaddons-dev libkf5i18n-dev libkf5init-dev libkf5jobwidgets-dev kio-dev libkf5windowsystem-dev libkf5xmlgui-dev libkf5plotting-dev libkf5texteditor-dev libkf5iconthemes-dev libeigen3-dev libcfitsio3-dev zlib1g-dev libindi-dev
==== Arch Linux ====
Warning: this list looks incomplete.


==== Arch Linux ====
    sudo pacman -S eigen libindi wcslib xplanet cmake kf5 extra-cmake-modules


     sudo apt-get install eigen libindi wcslib cmake kf5
==== Fedora ====
     yum install cfitsio-devel eigen3-devel cmake extra-cmake-modules.noarch kf5-kconfig-devel kf5-kdbusaddons-devel kf5-kdoctools-devel kf5-kguiaddons-devel kf5-ki18n-devel kf5-kiconthemes-devel kf5-kinit-devel kf5-kio-devel kf5-kjobwidgets-devel kf5-knewstuff-devel kf5-kplotting-devel kf5-ktexteditor-devel kf5-kwidgetsaddons-devel kf5-kwindowsystem-devel kf5-kxmlgui-devel libindi-devel libindi-static qt5-qtdeclarative-devel qt5-qtmultimedia-devel qt5-qtsvg-devel wcslib-devel xplanet zlib-devel


== Documentation on building various versions ==
== Documentation on building various versions ==
=== Git ===
=== Git ===
KStars development happens on KDE's git repository. ([http://git-scm.com Git] is an open-source version control software.). The code on git is the bleeding-edge developers' version of KStars. It does break occasionally.
KStars development happens on KDE's git repository. ([http://git-scm.com Git] is an open-source version control software.). The code on git is the bleeding-edge developers' version of KStars. It it mostly stable, but occasionally breaks.


1) create and change into a KDE development directory:
# Create and change into a KDE development directory:
   mkdir ~/kde; cd ~/kde
   mkdir ~/kde && cd ~/kde
2) to fetch the KStars source code:
# Fetch the KStars source code:
   git clone git://anongit.kde.org/kstars
   git clone git://anongit.kde.org/kstars
3) create and change into a build directory for compilation:
# Create and change into a build directory for compilation:
   mkdir build; cd build
   mkdir build && cd build
4) run the configure process with cmake:
# Run the configure process with cmake:
   cmake ../kstars -DCMAKE_INSTALL_PREFIX=~/kde/usr
   cmake ../kstars -DCMAKE_INSTALL_PREFIX=/usr
5) compile KStars:
# Compile KStars:
   make
   make
6) finally install KStars:
6) Install KStars:
   make install
  sudo make install
 
That’s all! This installs KStars globally, so if you have an existing KStars, it will overwrite it.
 
You can keep your copy up-to-date by typing `git pull --rebase` in ~/kde/kstars. Feel free to send patches to our mailing list [email protected]. And join #kde-kstars on irc.kde.org :–)
 
== Android build ==
 
Only cross-compilation on (Ubuntu) Linux is supported.
 
=== Prerequisites ===
 
* Install Android NDK and Android SDK
* Install Qt 5.7+ for Android under your home directory to be writable. Unfortunately, there is a Qt bug (https://bugreports.qt.io/browse/QTBUG-54666) what can be fixed by only patching one cmake config file. The build files will comment the problematic line.
* Get KStars source code from Github or KDE Git
* Some tools are needed for the compilation:
 
  sudo apt-get install dos2unix ccache
 
=== Build process ===
 
Set the following environmental variables before building:
 
  export QT_ANDROID=Qt SDK for Android target    # E.g. .../Qt/5.8/android_armv7
  export ANDROID_NDK=Android NDK path
  export ANDROID_SDK_ROOT=Android SDK path
  export ANDROID_API_LEVEL=Android API level    # Currently the minimum is 17
 
If you want to generate signed release package set the following variables:
 
  export ANDROID_KEYSTORE=your_keystore_file
  export ANDROID_KEYSTORE_ALIAS=your_keystore_alias
 
First build the KF5 dependencies separately:
 
1. Go to the root of the source directory.
 
2. Create build directory for out-of-source build:
 
  mkdir build
  cd build
 
3. Run build_kf5.sh and verify that the script builds everything without any problem.
 
  ../android/build_kf5.sh
 
When KF5 are ready, build KStars Lite for Android:
 
* Install Eigen3, git and other dependencies
* Configure out-of-source build (MinSizeRel build type is recommended for Android):
 
  cmake -B. -H.. -DBUILD_KSTARS_LITE=ON -DCMAKE_TOOLCHAIN_FILE=android/toolchain-android.cmake -DEIGEN3_INCLUDE_DIR=/usr/include/eigen3/ -DCMAKE_INSTALL_PREFIX=$(pwd)/android/export -DCMAKE_BUILD_TYPE=MinSizeRel
 
* Compile:
 
  make -j4
 
* Install:
 
  make -j4 install
 
* Generate the Android debug and release packages:
 
  make create-apk-kstars
 
* To sign a release package:
 
   make sign-apk-kstars
 
* The debug package location:
 
  android/kstars_build_apk/bin/QtApp-debug.apk
 
* Install the debug package:
 
  adb install android/kstars_build_apk/bin/QtApp-debug.apk
 
* The release package location:
 
  android/kstars_build_apk/bin/kstars-release-signed.apk


That’s all! This installs KStars locally into the separate directory ~/kde/usr, so that your global KDE installation will not be touched at all.
* Install the release package:
<!-- THIS HAS TO BE UPDATED


Now on to starting the newly compiled KStars. Create a file ~/kde/run.sh with the following content:
  adb install android/kstars_build_apk/bin/kstars-signed.apk


  #!/bin/bash
== Running tests ==
  export KSTARS_DIR=~/kde/usr
  export PATH=$KSTARS_DIR/bin:$PATH
  export LD_LIBRARY_PATH=$KSTARS_DIR/lib:$LD_LIBRARY_PATH
  export KDEDIR=$KSTARS_DIR
  export KDEDIRS=$KDEDIR
  export XDG_DATA_DIRS=$XDG_DATA_DIRS:$KSTARS_DIR/share
  # update KDE's system configuration cache
  kbuildsycoca4
  # start app
  $@


Make the script executable with chmod 755 ~/kde/run.sh. Now you can run the compiled KStars version with `~/kde/run.sh kstars`. Just calling `kstars` directly will start the system version of KStars.
The textual tests and the KStars GUI tests are built with the normal process and they can be executed with "ctest" command.
-->
To build the KStars Lite GUI tests instead of KStars GUI tests, KStars Lite must be build by passing -DBUILD_KSTARS_LITE=ON to the cmake configuration.
You can keep your copy up-to-date by typing `git pull --rebase` in ~/kde/kstars. Feel free to send patches to our mailing list [email protected]. And join #kde-edu on irc.kde.org :–)

Latest revision as of 07:02, 15 September 2019

This page is a community effort to document the procedure to build the KDE Frameworks 5 version of KStars on various platforms and environments. We have a separate page for the old KDE4 version.

Why build from source?

Typically, you would want to build KStars from source if you plan to develop KStars, or stay on the bleeding edge and contribute valuable feedback.

Integrated Development Environment (IDE)

If you plan to develop KStars, it is highly recommended to utilize an IDE. You can use any IDE of your choice, but QtCreator or KDevelop are recommended as they are more suited for Qt/KDE development.

Prerequisite Packages

To build and develop KStars, several packages may be required from your distribution. Here's a list.

Required dependencies

  • GNU Make, GCC -- Essential tools for building
  • cmake -- buildsystem used by KDE
  • Qt Library > 5.2.0
  • Several KDE Frameworks: KConfig, KDocTools, KGuiAddons, KWidgetsAddons, KNewStuff, KI18n, KInit, KIO, KXmlGui, KPlotting, KIconThemes
  • eigen -- linear algebra library
  • zlib -- compression library

Optional dependencies

  • libcfitsio -- FITS library
  • libindi -- Instrument Neutral Distributed Interface, for controlling equipment.
  • xplanet

Installing these packages

To install all of these, use the following commands:

Debian / Kubuntu

sudo apt-get -y install build-essential cmake git libeigen3-dev libcfitsio-dev zlib1g-dev libindi-dev extra-cmake-modules libkf5plotting-dev libqt5svg5-dev libkf5xmlgui-dev kio-dev kinit-dev libkf5newstuff-dev kdoctools-dev libkf5notifications-dev qtdeclarative5-dev libkf5crash-dev gettext libnova-dev libgsl-dev libraw-dev libkf5notifyconfig-dev wcslib-dev libqt5websockets5-dev xplanet xplanet-images qt5keychain-dev libsecret-1-dev breeze-icon-theme

Arch Linux

Warning: this list looks incomplete.

   sudo pacman -S eigen libindi wcslib xplanet cmake kf5 extra-cmake-modules

Fedora

   yum install cfitsio-devel eigen3-devel cmake extra-cmake-modules.noarch kf5-kconfig-devel kf5-kdbusaddons-devel kf5-kdoctools-devel kf5-kguiaddons-devel kf5-ki18n-devel kf5-kiconthemes-devel kf5-kinit-devel kf5-kio-devel kf5-kjobwidgets-devel kf5-knewstuff-devel kf5-kplotting-devel kf5-ktexteditor-devel kf5-kwidgetsaddons-devel kf5-kwindowsystem-devel kf5-kxmlgui-devel libindi-devel libindi-static qt5-qtdeclarative-devel qt5-qtmultimedia-devel qt5-qtsvg-devel wcslib-devel xplanet zlib-devel

Documentation on building various versions

Git

KStars development happens on KDE's git repository. (Git is an open-source version control software.). The code on git is the bleeding-edge developers' version of KStars. It it mostly stable, but occasionally breaks.

  1. Create and change into a KDE development directory:
  mkdir ~/kde && cd ~/kde
  1. Fetch the KStars source code:
  git clone git://anongit.kde.org/kstars
  1. Create and change into a build directory for compilation:
  mkdir build && cd build
  1. Run the configure process with cmake:
  cmake ../kstars -DCMAKE_INSTALL_PREFIX=/usr
  1. Compile KStars:
  make

6) Install KStars:

  sudo make install

That’s all! This installs KStars globally, so if you have an existing KStars, it will overwrite it.

You can keep your copy up-to-date by typing `git pull --rebase` in ~/kde/kstars. Feel free to send patches to our mailing list [email protected]. And join #kde-kstars on irc.kde.org :–)

Android build

Only cross-compilation on (Ubuntu) Linux is supported.

Prerequisites

  • Install Android NDK and Android SDK
  • Install Qt 5.7+ for Android under your home directory to be writable. Unfortunately, there is a Qt bug (https://bugreports.qt.io/browse/QTBUG-54666) what can be fixed by only patching one cmake config file. The build files will comment the problematic line.
  • Get KStars source code from Github or KDE Git
  • Some tools are needed for the compilation:
  sudo apt-get install dos2unix ccache

Build process

Set the following environmental variables before building:

  export QT_ANDROID=Qt SDK for Android target    # E.g. .../Qt/5.8/android_armv7
  export ANDROID_NDK=Android NDK path
  export ANDROID_SDK_ROOT=Android SDK path
  export ANDROID_API_LEVEL=Android API level     # Currently the minimum is 17

If you want to generate signed release package set the following variables:

  export ANDROID_KEYSTORE=your_keystore_file
  export ANDROID_KEYSTORE_ALIAS=your_keystore_alias

First build the KF5 dependencies separately:

1. Go to the root of the source directory.

2. Create build directory for out-of-source build:

  mkdir build
  cd build

3. Run build_kf5.sh and verify that the script builds everything without any problem.

  ../android/build_kf5.sh

When KF5 are ready, build KStars Lite for Android:

  • Install Eigen3, git and other dependencies
  • Configure out-of-source build (MinSizeRel build type is recommended for Android):
  cmake -B. -H.. -DBUILD_KSTARS_LITE=ON -DCMAKE_TOOLCHAIN_FILE=android/toolchain-android.cmake -DEIGEN3_INCLUDE_DIR=/usr/include/eigen3/ -DCMAKE_INSTALL_PREFIX=$(pwd)/android/export -DCMAKE_BUILD_TYPE=MinSizeRel
  • Compile:
  make -j4
  • Install:
  make -j4 install
  • Generate the Android debug and release packages:
  make create-apk-kstars
  • To sign a release package:
  make sign-apk-kstars
  • The debug package location:
  android/kstars_build_apk/bin/QtApp-debug.apk
  • Install the debug package:
  adb install android/kstars_build_apk/bin/QtApp-debug.apk
  • The release package location:
  android/kstars_build_apk/bin/kstars-release-signed.apk
  • Install the release package:
  adb install android/kstars_build_apk/bin/kstars-signed.apk

Running tests

The textual tests and the KStars GUI tests are built with the normal process and they can be executed with "ctest" command. To build the KStars Lite GUI tests instead of KStars GUI tests, KStars Lite must be build by passing -DBUILD_KSTARS_LITE=ON to the cmake configuration.