KDE PIM/Docker: Difference between revisions

From KDE Community Wiki
(Update based on README.md)
Line 3: Line 3:
To make developing KDE PIM as easy as possible we have prepared a Docker image based on the KDE Neon distribution. It contains all the dependencies necessary to compile KDE PIM, the environment for running self-compiled KDE PIM and pre-configured tool (kdesrc-build) used to build latest KDE PIM from sources.
To make developing KDE PIM as easy as possible we have prepared a Docker image based on the KDE Neon distribution. It contains all the dependencies necessary to compile KDE PIM, the environment for running self-compiled KDE PIM and pre-configured tool (kdesrc-build) used to build latest KDE PIM from sources.


== Building the Docker image ==
== Preparations ==
First, clone the git repository with the Dockerfile and support scripts.
 
  git clone git://anongit.kde.org/scratch/dvratil/kdepim-docker.git
  git clone git://anongit.kde.org/scratch/dvratil/kdepim-docker.git
  cd kdepim-docker
  cd kdepim-docker
sudo docker build . --label kdepim-image
# Now go make a coffee, this will take a while...


Next, create a directory where you want the sources code, build folders and everything else related to KDE PIM development to be stored. We will then expose this directory to the Docker container at runtime.
Next, create a directory where you want the sources code, build folders and everything else related to KDE PIM development to be stored. We will then expose this directory to the Docker container at runtime.
Line 19: Line 19:
The easiest way is to use NVIDIA's nvidia-docker from [https://github.com/NVIDIA/nvidia-docker nvidia-docker Github]. You can follow the instructions on the Github page regarding how to install it. The nvidia-docker will automatically find your installed NVIDIA drivers and will expose them into the Docker container at runtime, so you don't have to rebuild your container whenever you upgrade your NVIDIA drivers.
The easiest way is to use NVIDIA's nvidia-docker from [https://github.com/NVIDIA/nvidia-docker nvidia-docker Github]. You can follow the instructions on the Github page regarding how to install it. The nvidia-docker will automatically find your installed NVIDIA drivers and will expose them into the Docker container at runtime, so you don't have to rebuild your container whenever you upgrade your NVIDIA drivers.


Note that if you do this, you need to use <code>nvidia-docker run</code> command instead of <code>docker run</code>.
Note that if you do this, you must pass <code>-n</code> switch to the <code>build.sh</code> and <code>run.sh</code> scripts from the kdepim-docker.git repository.


=== Nouveau (NVIDIA opensource drivers) ===
=== Nouveau (NVIDIA opensource drivers) ===
Line 30: Line 30:
TODO
TODO


== Running the container ==
== Building Docker image ==
  sudo docker run --rm \
 
                  -e DISPLAY=$DISPLAY \
In order to build the Docker image, run the <code>build.sh</code> script. If you are
                  -v=/tmp/.X11-unix:/tmp/.X11-unix:rw \
using proprietary NVIDIA drivers, run the script with <code>-n</code> switch.
                  -v=$HOME/kdepim-dev:/home/neon/kdepim:rw \
 
                  --privileged \
The command will create kdepim:dev Docker image.
                  -ti \
 
                  kdepim-image
== Running Docker container ==
 
To run the container, use the <code>run.sh</code> script:
 
run.sh $HOME/kdepim-dev
 
If you are using proprietary NVIDIA drivers, run the script with <code>-n</code> switch:
 
run.sh -n $HOME/kdepim-dev
 
The content of the directory will be available in the container in the
/home/neon/kdepim directory.


Remember to replace <code>docker</code> with <code>nvidia-docker</code> if you are using NVIDIA proprietary drivers.
== Building and updating KDE PIM ==


We recommend you [https://shapeshed.com/unix-alias/#why-create-a-shell-alias create an alias] or a shell script to run this command so that you don't have to type it every time you want to start the container.
Once inside the container, you can use the following command to compile the
entire KDE PIM:


If you are not familiar with Docker, here's an explanation of the individual switches:
kdesrc-build kde-pim


<code>--rm</code> The container will be deleted when you stop it and will be created freshly from the image when you start it again
This will take a lot of time the first time, but all subsequent builds will be
faster thanks. You can also build use a specific repository name instead of the
<code>kde-pim</code> group.


<code>-e</code> Expose the host's $DISPLAY environment variable as DISPLAY into the Docker
Check the [https://kdesrc-build.kde.org kdesrc-build documentation] for more
details about KDE PIM.


<code>-v=HOSTDIR:CONTAINERDIR:options</code> Mount the HOSTDIR directory as CONTAINERDIR inside the container, with the specified options
kdesrc-build will clone all the repositories into /home/neon/kdepim/src/kde/pim,
build directories (where you can run <code>make</code> manually are in /home/neon/kdepim/build/kde/pim.
The binaries are installed into /home/neon/kdepim/install (and the environment
of the container is adjusted to work with the custom installation prefix).


<code>--privileged</code> Run the container in privileged mode. Needed for OpenGL to work
== Development tools ==


<code>-ti</code> Run in interactive mode (get a shell)
There's [https://www.kdevelop.org KDevelop] and [https://www.qt.io/ide/ QtCreator]
preinstalled in the container and you can run them from there. You can also use
them from outside of the container, but code completion might not work perfectly.


<code>kdepim-image</code> Name of the image to create the container from
You can also any other IDE of your choice either by installing it into the container
with apt-get, or use it from outside of the container.


== Using the container ==
== Contributing ==


[TODO]
Please upload patches to [https://phabricator.kde.org phabriactor.kde.org] for
review.

Revision as of 21:49, 30 July 2017

 
Under Construction
This is a new page, currently under construction!


To make developing KDE PIM as easy as possible we have prepared a Docker image based on the KDE Neon distribution. It contains all the dependencies necessary to compile KDE PIM, the environment for running self-compiled KDE PIM and pre-configured tool (kdesrc-build) used to build latest KDE PIM from sources.

Preparations

First, clone the git repository with the Dockerfile and support scripts.

git clone git://anongit.kde.org/scratch/dvratil/kdepim-docker.git
cd kdepim-docker

Next, create a directory where you want the sources code, build folders and everything else related to KDE PIM development to be stored. We will then expose this directory to the Docker container at runtime.

mkdir ~/kdepim-dev

Making OpenGL work in the container

Several parts of KDE PIM depend on OpenGL - this is due to our use of QtWebEngine, which is based on Blink and has a hard dependency on OpenGL for rendering web pages. There's no way around that and so we need to make OpenGL work in the container. Unfortunately, that is not a very straightforward process and it differs for each GPU vendor and drivers used.

NVIDIA proprietary drivers

The easiest way is to use NVIDIA's nvidia-docker from nvidia-docker Github. You can follow the instructions on the Github page regarding how to install it. The nvidia-docker will automatically find your installed NVIDIA drivers and will expose them into the Docker container at runtime, so you don't have to rebuild your container whenever you upgrade your NVIDIA drivers.

Note that if you do this, you must pass -n switch to the build.sh and run.sh scripts from the kdepim-docker.git repository.

Nouveau (NVIDIA opensource drivers)

TODO

Intel

TODO

AMD/ATI

TODO

Building Docker image

In order to build the Docker image, run the build.sh script. If you are using proprietary NVIDIA drivers, run the script with -n switch.

The command will create kdepim:dev Docker image.

Running Docker container

To run the container, use the run.sh script:

run.sh $HOME/kdepim-dev

If you are using proprietary NVIDIA drivers, run the script with -n switch:

run.sh -n $HOME/kdepim-dev

The content of the directory will be available in the container in the /home/neon/kdepim directory.

Building and updating KDE PIM

Once inside the container, you can use the following command to compile the entire KDE PIM:

kdesrc-build kde-pim

This will take a lot of time the first time, but all subsequent builds will be faster thanks. You can also build use a specific repository name instead of the kde-pim group.

Check the kdesrc-build documentation for more details about KDE PIM.

kdesrc-build will clone all the repositories into /home/neon/kdepim/src/kde/pim, build directories (where you can run make manually are in /home/neon/kdepim/build/kde/pim. The binaries are installed into /home/neon/kdepim/install (and the environment of the container is adjusted to work with the custom installation prefix).

Development tools

There's KDevelop and QtCreator preinstalled in the container and you can run them from there. You can also use them from outside of the container, but code completion might not work perfectly.

You can also any other IDE of your choice either by installing it into the container with apt-get, or use it from outside of the container.

Contributing

Please upload patches to phabriactor.kde.org for review.