Archive:Getting Started/Build/KDE4.x (zh CN)

From KDE TechBase


目标

You probably 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.

方式方法

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.

We will 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).

安装

你的发行版所需文件包

(Till other distro instructions are added, you can probably determine the correct version to install by reading the LFS list of libraries)

创建用户帐号

用你能使用的方法创建一个帐户。我的账户是: "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.

------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------

# Redundant setting of HOME as work around for Bash bug
HOME=/home/KDE4
PATH=$HOME/bin:$PATH
export PATH HOME
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
LIBXCB_ALLOW_SLOPPY_LOCK="true"
export LIBXCB_ALLOW_SLOPPY_LOCK

------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------

确保路径在你的系统里都正确!!!

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.

构建

To build, you must be logged on as the new user account (KDE4). 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 when running cmake.
KDE Support should installed in the same directory as KDE. This also applies to some of the packages if you are installing the individual packages/modules for a release or BRANCH. For packages that don't use CMake that would be: --prefix=/usr/local/KDE-4. The packages that don't install anything in "share" (eigen,eigen2) can be installed in "/usr/local/".
Other packages should be installed with the default prefix (/usr/local).

配置

For this to work, you must properly configure D-Bus. The D-Bus services will be installed in "$KDEDIR/share/dbus-1/services". For D-Bus to find them, you must add that path to the: "/etc/dbus-1/session-local.conf" file.

开始

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 from KDM from KDE-3 probably has the full path to the KDE-3 "startkde" script so the different PATH will not make any difference.

切换到KDE-4

I have done this and will write this up soon.