Compiling a Source Package in Linux / Pisi LInux Part 1 Cmake

Hi to all

Today i will give you a little Overview about compiling a package with cmake.

You can click on each Screenshot to enlarge it for a better Viewing

We start with cmake:

Cmake

You have download a Packages and must compile it with cmake it was simple and not so hard as you mean it.

I build for Pisi Linux KDE 5 packages and have as example for you now the KDE 5 package purpose.

Note: I work with a Developer System

At the first download your package what you would compile now.

Note: Before you can compile you need any devel packages from your Operating System:

For Pisi Linux:

sudo pisi it -c system.devel

For Ubuntu or Debian and Derivatives:

sudo apt-get install build-essential

Now extract your Packages with a Package-Manager with Graphical Gui or with the command line.

Is it a tar.gz

tar -xzvf filename.tar.gz

Is it a tar.bz2

tar -xjvf file.tar.bz2

Is it a tar.xz

tar -xvf package.tar.xz

I use all Times the Graphical way

image

 

When you are ready now open a Terminal, it makes no different when you use KDE and Dolphin when you open the little Terminal at the bottom from Dolphin or you use the normal Terminal. Go in the Extract purpose folder and open there a Terminal.

image1

 

Now write in the Terminal:

mkdir build  (it creates a Folder named Build in the extract source package)

image2

Now type in the Terminal:

cd build  (with the cd command you switch in the build Folder, cd means “Change Directory”)

image3

Now we are ready to start the cmake command but you can do it in different ways

  1. cmake ..
  2. cmake -DCMAKE_BUILD_TYPE ..
  3. cmake -DCMAKE_INSTALL_PREFIX=/usr ..

and so further the best is you take a look in the README there found you at the most Time what you must type. I use now the complete command, also:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DKDE_INSTALL_LIBDIR=lib -DKDE_INSTALL_LIBEXECDIR=lib -DBUILD_TESTING=OFF ..

Note: Don’t forget the 2 Dots at the end of the command

image4

So now the first step is done the package has now checked the Dependencies of all is installed what the package need for Building and running.

 

image5-5

 

 

 

image6-6

 

 

Now type in the Terminal:

make (to build the package)

 

the make command begins to run and you see at the right side, a lot of other files comes in the source package, when all was ok we can do the last step:

Now type in the Terminal:

make install (to install the package not at the complete System)

 

image7-7

 

or

sudo make install (to install it at the complete System)

for this package we need the sudo command for it.

image9

 

image10-1

 

That was it you have now install your Package.

Many thanks for reading this Tutorial and happy Package Building with Linux

 

Advertisements