Getting Started/Build/KDE4.x: Difference between revisions

From KDE TechBase
(Redirected page to Getting Started/Build)
 
(136 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:I18n/Language Navigation Bar|Getting_Started/Build/KDE4.x}}
#REDIRECT [[Getting_Started/Build|Building KDE]]
 
==Objectives==
 
You first need to decide if you want to keep your current KDE-3.5.x installation till you feel that KDE-4.x.y meets your needs for actual day to day use of your computer.  Yet, you want to be able to change over with a minimum of work when the time comes to make the switch.
 
==Method==
 
The best way to accomplish this is to install the needed support libraries on your system in the usual manner.  Convention is that these should be installed in the /usr/local/ directory.  By default, Troll Tech installs Qt in: /usr/local/Trolltech/Qt-4/.  It is best to install KDE-4.x.y in its own directory so that the directory can be deleted if some large problem occurs.  I will be using /usr/local/KDE-4/ but you can call it whatever you want.
 
Remember to add the: "lib" directories:
 
/usr/local/Trolltech/Qt-4/lib
/usr/local/KDE-4/lib
 
(or the directories you are using if different) to your: "/etc/ld.so.conf" file.  The libraries have different names so there should be no conflicts.
 
 
If you are currently running KDE-3, we can keep configurations straight by using a separate user account for accessing KDE-4.x.y.  This user account will contain your configurations of KDE-4.x.y and will have a script to set the environment variables (.bash_profile if using Linux).  When you want to changeover to KDE-4, all that is needed is to change the configuration information.
 
==Installation==
 
=== Required packages from your distribution===
* [[Getting_Started/Build/KDE4/LFS|Linux from Scratch]] or to build from source.
 
(Till other distro instructions are added, you can probably determine the correct version to install by reading the LFS list of libraries)
 
===Create the User Account===
 
Use whatever method you wish to create a new user account.  Mine is called: "KDE4".  Then edit or create the user specific login script (.bash_profile for Linux).  There is a lot that goes into this.  Note that this presumes that USER was correctly set by the system login script.
 
<nowiki>------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------</nowiki>
 
:XDG_DATA_HOME="$HOME/.local/share"
:XDG_CONFIG_HOME="$HOME/.config"
:export XDG_DATA_HOME XDG_CONFIG_HOME
 
:KDEDIR=/usr/local/KDE-4
:KDEHOME=$HOME/.kde4
:KDETMP=/tmp/$USER-kde4
:mkdir -p $KDETMP
:KDEVARTMP=/var/tmp/$USER-kde4
:mkdir -p $KDEVARTMP
:KDEDIRS=$KDEDIR
:PKG_CONFIG_PATH=$KDEDIR/lib/pkgconfig:$PKG_CONFIG_PATH
:export KDEDIR KDEHOME KDETMP KDEVARTMP KDEDIRS PKG_CONFIG_PATH
 
:QTDIR=/usr/local/Trolltech/Qt-COPY
:QT_PLUGIN_PATH=$KDEDIR/lib/kde4/plugins:$QT_PLUGIN_PATH
:PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG_PATH
:export QTDIR QT_PLUGIN_PATH PKG_CONFIG_PATH
 
:PATH=$QTDIR/bin:$KDEDIR/bin:$PATH
:export PATH
 
:XDG_CONFIG_DIRS=$KDEDIR/etc/xdg
:XDG_DATA_DIRS=$KDEDIR/share
 
:export XDG_CONFIG_DIRS XDG_DATA_DIRS
 
:LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib
:export LD_LIBRARY_PATH
 
<nowiki>------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------</nowiki>
 
Be sure to get the paths correct for your system!!!
 
This is in addition to other things that you need in the script which would probably go at the beginning -- this large block of junk is to be added at the end.  The XDG directories might need to be modified for your system.
 
When creating the new account, remember that various service on the system are dependent on a user account being a member of various groups.  So, open KUser and see which groups your regular user account is a member of and add the new account (KDE4) to those that are appropriate.
 
If you want access to data in another account, you need to add the new account (KDE4) to the private group of that other account.  If you still have access issues, check the directory permissions.  The private group for the other user must have the needed permissions.
 
===Build===
 
To build, you must be logged on as the new user account (KDE4).  I suggest that you use a virtual console rather than trying to do this in a Konsole.  You can 'su' for the whole thing or 'su -c' for each install.
 
Packages need to be installed with the correct prefixes for this to work:
 
:If you are building Qt from source, configure it with with --prefix=/usr/local/Trolltech/Qt-4.  If you installed it from a binary, determine the prefix and change: QTDIR in the script above.
 
KDE should use:
 
-DCMAKE_INSTALL_PREFIX=/usr/local/KDE-4 -DCMAKE_BUILD_TYPE:STRING=Release
 
when running cmake.
 
KDE Support should installed in the same directory as KDE.
 
:Other packages should be installed with the default prefix (/usr/local) or in /usr -- which ever you prefer.
 
Then, you need to build:
 
::KDELibs
::KDEPIMLibs
::KDEBase
 
first and in that order. 
 
If you are installing KDEBindings, it should be built next (4th).
 
===CMake===
 
CMake normally uses a build directory.  So follow these steps:
 
::mkdir build
::cd build
::cmake .. <configure parameters>
::make
::make install
 
Don't forget the ".." after cmake!
 
===Configure===
 
For this to work, you must properly configure D-Bus.  The D-Bus services will be installed in "/usr/KDE-4/share/dbus-1/services".  For D-Bus to find them, you must add that path to the: "/etc/dbus-1/session-local.conf" file:
 
  <servicedir>/usr/KDE-4/share/dbus-1/services</servicedir>
 
===Starting===
 
You will have two "startkde" scripts on your system and you will probably need to make changes so that you use the correct one to start the version that you want.  Specifically, the KDE 'desktop' file for KDM from KDE-3 probably has the full path to the KDE-3 "startkde" script so the different PATH will not make any difference.
 
==Switching to KDE-4==
 
First, the simple part.  If you have a:
 
::/etc/profile.d
 
directory as Linux should, you need to add these two files:
 
qt4.sh
<nowiki>------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------</nowiki>
 
:<nowiki>#</nowiki> Qt-4 initialization script (sh)
 
:QTDIR=/usr/local/Trolltech/Qt-4.5.2
:QT_PLUGIN_PATH=$KDEDIR/lib/kde4/plugins:$QT_PLUGIN_PATH
:PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG_PATH
 
:export QT_PLUGIN_PATH PKG_CONFIG_PATH
 
:PATH=$QTDIR/bin:$PATH
:export PATH
 
<nowiki>------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------</nowiki>
 
 
kde-4.sh
<nowiki>------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------</nowiki>
 
:<nowiki>#</nowiki> KDE-4 initialization script (sh)
 
:KDEX="kde4"
 
:KDEDIR="/usr/KDE-4"
 
:KDEHOME=$HOME/.kde4
:PATH="$KDEDIR/bin:$PATH"
:KDEDIRS=$KDEDIR:/usr
 
:export KDEDIR KDEHOME PATH KDEDIRS
 
:KDETMP=/tmp/$USER-$KDEX
:mkdir -p $KDETMP
:KDEVARTMP=/var/tmp/$USER-$KDEX
:mkdir -p $KDEVARTMP
 
:export KDETMP KDEVARTMP
 
:KDE4_XDG_CONFIG_DIRS=/usr/KDE-4/etc/xdg
:KDE4_XDG_DATA_DIRS=$KDEDIR/share
 
:if test -n "$XDG_CONFIG_DIRS" ; then
:    XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS:$KDE4_XDG_CONFIG_DIRS
:else
:    XDG_CONFIG_DIRS=$KDE4_XDG_CONFIG_DIRS
:fi
 
:if test -n "$XDG_DATA_DIRS" ; then
:    XDG_DATA_DIRS=$XDG_DATA_DIRS:$KDE4_XDG_DATA_DIRS
:else
:    XDG_DATA_DIRS=$KDE4_XDG_DATA_DIRS
:fi
 
:export XDG_DATA_DIRS XDG_CONFIG_DIRS
 
<nowiki>------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------</nowiki>
 
If you don't have the: "profile.d" directory, you need to add this stuff to your "/etc/profile" script.
 
This eliminates the need for the large block of stuff in your: ".bash_profile" script.
 
Now, if you remove KDE-3, and reboot your system, all should be OK -- but it probably won't.  Or, perhaps you don't want to remove KDE-3.
 
The: "profile.d" scripts are executed in alphabetical order, so you can modify the order by adding capitol letters to the beginning of the file names.  So, my KDE-4 script is named: "ACkde-4".
 
What is important for this to work is for the PATH to be set correctly so that the directory: "/usr/KDE-4/bin" is before the: "bin" directory for KDE-3.
 
I have KDE-3 installed in: "/usr/kde-3" so I have a: "profile.d" script for it.  This made disabling KDE-3 very simple.  I just disabled that script. Note that you don't want to disable Qt-3 because you might have applications which use it.  However, if you have KDE-3 installed in: "/usr" you may have issues disabling it.
 
One major issue if you leave KDE-3 installed and can not disable it is the menu.  You probably don't want the KDE-3 stuff in your menu while running KDE-4.  The KDE-3 menu 'desktop' files are in:
 
:<kde-3 prefix>/share/applications/kde
 
so you can remove them from the menu by locking that directory -- set the permissions to 000.

Latest revision as of 16:35, 20 March 2011