KPhotoAlbum/build instructions: Difference between revisions

From KDE Community Wiki
mNo edit summary
(Starter rechecking against 22.04.3)
Line 3: Line 3:
This will allow you to test all the latest features that have not been published in the official releases or have not reached your distribution yet. Alternatively, you may want to check out the nightly built [https://neon.kde.org Neon] packages for kphotoalbum.
This will allow you to test all the latest features that have not been published in the official releases or have not reached your distribution yet. Alternatively, you may want to check out the nightly built [https://neon.kde.org Neon] packages for kphotoalbum.


BUILD INSTRUCTIONS CHECKED AGAINST:
For Kubuntu 19.10 & Ubuntu 18.04, see old versions of this page.
- Kubuntu 19.10
 
- Ubuntu 18.04
THIS PAGE IS BEING RECHECKED AGAINST KUBUNTU 22.04.03, WORK IN PROGRESS! (10/2023)


==Summary==
==Summary==
Line 12: Line 12:
First, backup all your precious files!!  See section "Backup" below.
First, backup all your precious files!!  See section "Backup" below.


Enable the deb-src rows in /etc/apt/sources.list & run sudo apt-get update
Remove # from all deb-src rows in /etc/apt/sources.list
{{Input|1=<nowiki>
sudo nano /etc/apt/sources.list</nowiki>}}


Install all required packages (Ubuntu / Debian):
run
{{Input|1=<nowiki>sudo apt update
sudo apt upgrade</nowiki>}}
 
Install required packages:
{{Input|1=<nowiki>
{{Input|1=<nowiki>
sudo apt install build-essential git
sudo apt install build-essential git ffmpeg
sudo apt install cmake extra-cmake-modules libkf5kio-dev pkg-config pkg-kde-tools
sudo apt install cmake extra-cmake-modules libkf5kio-dev pkg-config pkg-kde-tools
sudo apt build-dep kphotoalbum
sudo apt build-dep kphotoalbum
#this install following packages on Kubuntu 19.10: autoconf automake autopoint autotools-dev debhelper dh-autoreconf dh-strip-nondeterminism dwz libastro-dev libastro1 libdebhelper-perl libexiv2-dev libfile-stripnondeterminism-perl libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libjs-openlayers libkf5archive-dev libkf5doctools-dev libkf5kdcraw-dev libkf5purpose-dev libmarble-dev libmarblewidget-qt5-28 libphonon4qt5-dev libqt5quickparticles5 libqt5quickshapes5 libqt5quicktest5 libqt5webkit5-dev libsigsegv2 libsub-override-perl libtool m4 marble-data marble-qt-data po-debconf qt5-qmltooling-plugins qtdeclarative5-dev qtdeclarative5-dev-tools
</nowiki>}}
 
sudo apt-get install libkf5testwidgets-dev
# this adds a missing packet with Ubuntu 22.04
 
sudo apt install ffmpeg</nowiki>}}


Preparations for other systems (openSUSE) - see at the bottom.
Preparations for other systems (openSUSE) - see at the bottom.
Line 33: Line 34:
cd kphotoalbum
cd kphotoalbum
mkdir build ; cd build
mkdir build ; cd build
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_BUILD_TYPE=RelWithDebInfo .. #FAILS HERE
make
make
make install</nowiki>}}
make install</nowiki>}}

Revision as of 06:00, 24 October 2023

This howto will tell you the steps required to pull, build and install the GIT version of KPhotoAlbum in Ubuntu/Debian.

This will allow you to test all the latest features that have not been published in the official releases or have not reached your distribution yet. Alternatively, you may want to check out the nightly built Neon packages for kphotoalbum.

For Kubuntu 19.10 & Ubuntu 18.04, see old versions of this page.

THIS PAGE IS BEING RECHECKED AGAINST KUBUNTU 22.04.03, WORK IN PROGRESS! (10/2023)

Summary

Preparations before building

First, backup all your precious files!! See section "Backup" below.

Remove # from all deb-src rows in /etc/apt/sources.list

sudo nano /etc/apt/sources.list

run

sudo apt update
sudo apt upgrade

Install required packages:

sudo apt install build-essential git ffmpeg
sudo apt install cmake extra-cmake-modules libkf5kio-dev pkg-config pkg-kde-tools
sudo apt build-dep kphotoalbum

Preparations for other systems (openSUSE) - see at the bottom.

First build

git clone https://invent.kde.org/graphics/kphotoalbum.git
cd kphotoalbum
mkdir build ; cd build
cmake -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_BUILD_TYPE=RelWithDebInfo .. #FAILS HERE
make
make install

Updating

cd ~/kphotoalbum
git pull
cd build
make && make install

Running

~/.local/bin/kpa-backup.sh --backup
~/.local/bin/kphotoalbum




Full instructions

Build dependencies

If you've had KPhotoAlbum installed earlier from repositories, the Git KPhotoAlbum will use the same setting files as the earlier version. If you want to be able to use the previous version after installing this, please do install to custom directory, not the default one.

Install required build tools:

sudo apt install git build-essential cmake extra-cmake-modules pkg-config pkg-kde-tools

Install required packages to build:

sudo apt build-dep kphotoalbum
#on Kubuntu 19.10 following packages are installed: autoconf automake autopoint autotools-dev debhelper dh-autoreconf dh-strip-nondeterminism dwz libastro-dev libastro1 libdebhelper-perl libexiv2-dev libfile-stripnondeterminism-perl libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libjs-openlayers libkf5archive-dev libkf5doctools-dev libkf5kdcraw-dev libkf5purpose-dev libmarble-dev libmarblewidget-qt5-28 libphonon4qt5-dev libqt5quickparticles5 libqt5quickshapes5 libqt5quicktest5 libqt5webkit5-dev libsigsegv2 libsub-override-perl libtool m4 marble-data marble-qt-data po-debconf qt5-qmltooling-plugins qtdeclarative5-dev qtdeclarative5-dev-tools

If you don't have source packages configured and build-dep doesn't work for you, you can install the following packages directly instead:

sudo apt install libexiv2-dev libjpeg8-dev libkf5archive-dev libkf5completion-dev libkf5configwidgets-dev libkf5coreaddons-dev libkf5doctools-dev libkf5i18n-dev libkf5iconthemes-dev libkf5jobwidgets-dev libkf5kdcraw-dev libmarble-dev libkf5kio-dev libkf5purpose-dev libkf5service-dev libkf5textwidgets-dev libkf5widgetsaddons-dev libkf5xmlgui-dev libphonon4qt5-dev marble

OPTIONAL BUT RECOMMENDED: Install other dependencies:

sudo apt install ffmpeg

Download the source code

Clone the Git repository:

git clone https://invent.kde.org/graphics/kphotoalbum.git

Building

Move to the created directory

cd kphotoalbum

Create a build-directory (so you don't mess up you source directory)

mkdir build ; cd build

Run cmake to configure the build system

cmake .. 

[to install to the default directory]

You can adopt the configuration to your needs by adding additional arguments to cmake:

  • -DCMAKE_INSTALL_PREFIX=/YOUR_INSTALL_PREFIX: to install to a custom directory
  • -DCMAKE_BUILD_TYPE=RelWithDebugInfo: Make a debug build that will output plenty of debug messages to help track crashes etc.

These options can just be added to the regular cmake command:

cmake -DCMAKE_INSTALL_PREFIX=/YOUR_INSTALL_PREFIX -DCMAKE_BUILD_TYPE=RelWithDebInfo ..

See the messages. In this stage you'll be told if you have missing dependencies. Do fix them (try to find the missing packages from the package repositories) before continuing.

Run make:

make -j=4

This uses up to 4 processes to build kphotoalbum. On a modern system you may want to increase the number. If you want to use a single process only, simply omit the -j=4 entirely.

Choosing the installation directory

While you can install kphotoalbum to any directory of your choice, some directories make life easier for you. Here are some suggestions for your install prefix:

  • /usr/local(default)
    Usually included in search path, but requires root privileges for installation.
  • ~/.local
    Does not require root privileges for installation. You might need to add ~/.local/bin to your search path, though.

Both of the above suggestions are also searched by default when Qt searches for application resources. Using one of them makes sure that kphotoalbum can find its own resource files (e.g. the demo database).

Do not use /usr as prefix directory! This prefix is reserved for files managed by your distribution's package manager.

Installing

Run installation:

make install

or if the installation path is not writable by your user:

sudo make install

If you have already installed a different version of kphotoalbum, and you only want to check out some specific feature, you may skip the installation step and directly run the kphotoalbum executable file in your build directory. Be aware, though, that in this case kphotoalbum uses the already installed resource files of your kphotoalbum installation. If there is not existing installation of kphotoalbum, certain features will not work correctly (demo database, HTML export, …)

Verify installation

If the install directory that you chose is not in your search path, your system won't find kphotoalbum on its own, or it may find a packaged version of kphotoalbum instead. To verify your installation, run:

which kphotoalbum

The output should start with the install prefix that you chose earlier. If it does not match, you have to add the installation directory (/YOUR_INSTALL_PREFIX/bin) to your search path, or type the full path of the executable file.

Under most shells, you can add a directory to your search path using this command:

export PATH="/YOUR_INSTALL_PREFIX/bin:$PATH"

Back up your files

By using the latest GIT versions of KPhotoAlbum you risk losing your precious files. It shouldn't happen but you never know. This would now be an excellent time to run the backups - you've just downloaded a script to backup the KPhotoAlbum config files for you so keep reading! Your photos you already have backed up, right...?

To backup your database and configuration files, run:

kpa-backup --backup

Complete backup instructions can be found under #Backup

Running

A handy feature of the cmake build-system is that it builds binaries in such a way that you can start them from within the build system. This certainly handy for quickly testing a new version of KPhotoalbum without touching anything else on your system. However, be aware that some features depend on hard-coded paths (e.g. menu-entries, Handbook, HTML Exports, Demo) and may not work as expected. These features will still use the files installed by the distributions version of KPhotoAlbum. You can just try out KPhotoalbum without installation first, and install later on (see 2.4), if you decide so.

If you installed to a non-standard directory, you have two options: 1a) Start KPhotoAlbum from the directory where it was installed:

/path/for/my/kphotoalbum/installation/kphotoalbum

OR 1b) add the following line to /home/username/.bashrc so you can start KPhotoAlbum from anywhere:

export KDEDIRS=/path/for/my/kphotoalbum/installation

Restart your terminal (so that .bashrc gets executed)

2)Start KPhotoAlbum:

kphotoalbum

It's always a good idea to first try out things with the demo-database. Just add "--demo" when starting KPhotoalbum:

kphotoalbum --demo


Rebuild / Update

In the kphotoalbum git directory, execute:

git pull
cd build
make -j4
make install

If you want to see what has changed try git log or qgit for graphical user interface.

If you upgraded your system and the build fails afterwards, it can often help to delete the build directory (no need to delete the source directory) and run the instructions under #Building again.

Hints & Tips

Backup

This text assumes that you already back up your image files (disk failures happen). When playing with an experimental version of kphotoalbum, you may also want to backup your image database and other files that are needed by kphotoalbum.

Backup script

KPhotoalbum source code has a backup script included.

kpa-backup.sh --backup
kpa-backup.sh --restore


If the backup script is not included in an old installation of kphotoalbum, you can run the backup script directly from the source directory:

script/kpa-backup.sh --backup
script/kpa-backup.sh --restore


Manual backup

Create backup directory

mkdir kpa-backup

Backup your settings:

cp -a ~/.local/share/kphotoalbum/kphotoalbumui.rc kpa-backup/
cp -a ~/.config/kphotoalbumrc kpa-backup/

And if you want to try KPhotoalbum with your real database (not the demo): Backup your database:

cp -a /path/to/your/image/folder/index.html kpa-backup/
cp -a /path/to/your/image/folder/exif-info.db kpa-backup/

Backup the layout of your Annotation dialog:

cp -a /path/to/your/image/folder/layout.dat kpa-backup/

Preparations for other systems

openSUSE

These instructions were prepared with an out of the box installation of openSUSE Leap 42.2. Leap 42.1, SLES12 and Tumbleweed should work along the same lines. In older versions of openSUSE, success depends on the completeness of the transition to QT5 in the distribution. It is assumed that installation takes place from remote repositories (not from DVD).

Use settings->yast (command line: yast2) to install packages and patterns. You need root access to enter yast.

The easiest way to get all the necessary build tools is installing the pattern "KDE development":

  • In yast software management select View-> Patterns.
  • scroll down and select "KDE Development" for installation. This should pull in cmake, git, gcc and most of the libraries needed.


Change to View->Search and search/select the libs AND the corresponding the *-devel packages:

  • libkf5purpose
  • libkdcraw
  • libmarble
  • libkexiv2


Check the remaining toolkit (these packages should already be checked for installation or present anyhow). Search and check for installation:

  • cmake - the "extra-cmake-modules" package is needed
  • git
  • ffmpeg (needed for video thumbnails). This package contains ffmpeg and ffprobe.

Klick accept. Several more dependencies will be selected for installation. This is OK.

After installation it is advisable (not strictly necessary) to reboot.

Mplayer(1 or 2) is no longer necessary for video thumbnails if ffmpeg is available. In openSUSE only mplayer (1) is available as the Mplayer2 project lost support.

To get a complete set of supported codecs, it might be advisable to add the packman repository and install ffmpeg and vlc from there. The install of vlc will pull in a lot of codec libs:

  • In yast software management select from the menu: Configuration -> Repositories.
  • Add the packman repository from the list of community repositories or as URL:
http://packman.inode.at/suse/openSUSE_Leap_42.2/

Search and install vlc and ffmpeg:

  • select a package and click on the tab "Versions"
  • select the version from the packman repository


openSUSE Tumbleweed using the command line

These instructions are accurate for an openSUSE Tumbleweed installation as of 09 September 2023.

Install Build dependencies

Here are two alternative ways of installing the build dependencies of KPhotoAlbum via the command line (using zypper). Both ways should give the same results.

Alternative 1: Installing only build dependencies using zypper source-install

If the openSUSE Tumbleweed package is up to date then you can directly install just the dependencies openSUSE uses to build the KPhotoAlbum package. Note that here only the build dependencies are installed and not the KPhotoAlbum package from openSUSE Tumbleweed source repository. Instead after the build dependencies are installed, the KPhotoAlbum is built as per the instructions above.

# Enable the default openSUSE Tumbleweed Source repository (if not already enabled)
sudo zypper mr -e openSUSE-Tumbleweed-Source

# Use zypper source-install to install only the build dependencies
sudo zypper source-install --build-deps-only kphotoalbum

# Disable the default openSUSE Tumbleweed Source repository since we are not installing KPhotoAlbum from OpenSUSE sources.
sudo zypper mr -d openSUSE-Tumbleweed-Source
Alternative 2: Install build dependencies directly
sudo zypper install cmake extra-cmake-modules 'cmake(Qt5Core)' 'cmake(Qt5Sql)' 'cmake(Qt5Xml)' 'cmake(Qt5Widgets)' 'cmake(Qt5Test)' 'cmake(KF5Archive)' 'cmake(KF5Completion)' 'cmake(KF5Config)' 'cmake(KF5CoreAddons)' 'cmake(KF5I18n)' 'cmake(KF5IconThemes)' 'cmake(KF5JobWidgets)' 'cmake(KF5KIO)' 'cmake(KF5TextWidgets)' 'cmake(KF5XmlGui)' 'cmake(KF5WidgetsAddons)' 'cmake(KF5Purpose)' 'cmake(Marble)' 'cmake(exiv2)' 'cmake(KF5DocTools)'  'cmake(KF5KDcraw)' 'cmake(Phonon4Qt5)' QtAV-devel vlc-devel libjpeg-devel


Install git

sudo zypper install git


Install optional dependencies (ffmpeg)

To learn more about installing VLC (and ffmpeg) on openSUSE refer to: openSUSE's VLC page

sudo zypper install  ffmpeg