This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KDE ~/trunk in ArchLinux

Tags: None
(comma "," separated)
STiAT
Registered Member
Posts
6
Karma
0

KDE ~/trunk in ArchLinux

Wed Dec 23, 2009 2:09 pm
In this tutorial, I describe how to build kde trunk on ArchLinux, using several tools, and providing you with configuration. This is a tutorial for KDE developers (or those who want to become a KDE developer), not for end users.

Basic Design
I decided I want the KDE trunk to be built in it’s own “sandbox”, meaning in a completely closed environment, but not in a virtual environment /vmware / xen / kvm or anything similar. This is done using a chroot, with basically a 2nd ArchLinux installation on your machine.
I do this for one simple reason, it is possible that you need more recent libraries for the kde trunk, and you may not want to mess up your system with other unstable libraries. You of course could also build and install unstable libraries into your home directory, but I like a closed environment better. Also, there have been problems installing kde to a custom directory lately, due to plasmascripts.py which is part of kdebase-workspace. To avoid this troubles, and even being able to push kde to /usr, I decided for a chroot.
Also, you’re able to do this on machines where you don’t even have root access, even though, you’ll have to change a few parts on the tutorial.
All this boils down to install Arch stable for your private use on your main installation, and a Arch “sandbox” in a chroot.

First Step – chroot environment
NOTE: If you do not want to run KDE trunk in a sandbox, just skip this chapter. You may need to change some of the commands lateron, as when starting Xephyr.
There is a great guide how to set up a chroot in Arch in the Arch Linux wiki. It is basically described how to build a Arch32 chroot in Arch64, but with some simple modifications you can also build a Arch64 chroot in Arch64. I’ll anyway describe here how to do it, if it doesn’t work out for you, you may want to read the guide. You’ll find the link in the Ressources section of this tutorial.

First of all, you can set up your arch chroot in any directory, and it must not be /opt, as in my case. This can depend on your partition settings – how ever you like.
Code: Select all
mkdir /opt/arch-chroot
cp /etc/pacman.conf /opt/arch-chroot
cp /etc/pacman.d/mirrorlist /opt/arch-chroot
mkdir -p /opt/arch-chroot/var/{cache/pacman/pkg,lib/pacman}
pacman –root /opt/arch-chroot –cachedir /opt/arch-chroot/var/cache/pacman/pkg –config /opt/arch-chroot/pacman.conf -Sy
pacman –root /opt/arch-chroot –cachedir /opt/arch-chroot/var/cache/pacman/pkg –config /opt/arch-chroot/pacman.conf -S base base-devel sudo ttf-bitstream-vera ttf-ms-fonts
rm /opt/arch-chroot/{mirrorlist,pacman.conf}
cd /opt/arch-chroot/etc
ln -f /etc/passwd* .
ln -f /etc/shadow* .
ln -f /etc/group* .
ln -f /etc/sudoers .
ln -f /etc/resolv.conf .
ln -f /etc/localtime .
ln -f /etc/locale.gen .
ln -f /etc/profile.d/locale.sh profile.d
cp /etc/mtab .


There is a rc-script which is used to start the Arch chroot. You can add this to your rc.conf if you like.
You can save this file to /etc/rc.d/arch-chroot
You can also download it from >here<

Code: Select all
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case $1 in
start)
    stat_busy “Starting Arch chroot”
    mount –bind /proc /opt/arch-chroot/proc
    mount –bind /proc/bus/usb /opt/arch-chroot/proc/bus/usb
    mount –bind /dev /opt/arch-chroot/dev
    mount –bind /dev/pts /opt/arch-chroot/dev/pts
    mount –bind /dev/shm /opt/arch-chroot/dev/shm
    mount –bind /sys /opt/arch-chroot/sys
    mount –bind /tmp /opt/arch-chroot/tmp
    mount –bind /home /opt/arch-chroot/home
    mount --bind /var/run/dbus /opt/arch64/var/run/dbus
    add_daemon arch-chroot
    stat_done
    ;;
stop)
    stat_busy “Stopping Arch chroot”
    umount /opt/arch-chroot/proc/bus/usb
    umount /opt/arch-chroot/proc
    umount /opt/arch-chroot/dev/pts
    umount /opt/arch-chroot/dev/shm
    umount /opt/arch-chroot/dev
    umount /opt/arch-chroot/sys
    umount /opt/arch-chroot/tmp
    umount /opt/arch-chroot/home
    umount /opt/arch64/var/run/dbus
    rm_daemon arch-chroot
    stat_done
    ;;
restart)
    $0 stop
    sleep 1
    $0 start
    ;;
*)
    echo “usage: $0 {start|stop|restart}”
esac
exit 0


As the next step, you must chmod the file to be executable, and you should enter your chroot.

Code: Select all
chmod +x /etc/rc.d/arch-chroot
/etc/rc.d/arch-chroot
chroot /opt/arch-chroot
/usr/sbin/locale-gen


Installing the KDE build dependencies
Code: Select all
pacman -Sy subversion git bzip2 libxslt libxml2 libjpeg \
libungif shared-mime-info mesa boost dbus \
openssl pkgconfig xine-lib clucene redland \
gpgme hal cmake qt qca libical lcms xorg-server perl-libwww\
automoc4 akonadi eigen taglib soprano strigi qimageblitz phonon \
pulseaudio xorg-server gstreamer0.10-good-plugins


Setting up your KDE Development user
This step is important. You may not want to crash your local kde user and ~/.kde4 or ~/.kde directory. Since this needs environment variables, as well as your KDE install will need them, we create a own user for this.
Make sure your user is added to all groups you need for kde development, in example if you need sound or device plugging. This example includes my current configuration.

Code: Select all
useradd -g users -G disk,wheel,games,kvm,dbus,hal,network,video,audio,optical,floppy,storage,power,policykit -m kde-devel -s /bin/bash
passwd kde-devel


Next, you should edit your ~/.bashrc

Add the following pathes and settings. This must be local user settings, if you use ksh or another shell for your user, make sure this settings work!

Code: Select all
export QTDIR=$HOME/qt4
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG

export KDEDIR=$HOME/kde
export KDEDIRS=$KDEDIR
export PATH=$KDEDIR/bin:$PATH
export LD_LIBRARY_PATH=$KDEDIR/lib:$LD_LIBRARY_PATH
export QT_PLUGIN_PATH=$KDEDIR/lib/kde4/plugins
export PKG_CONFIG_PATH=$KDEDIR/lib/pkgconfig:$PKG_CONFIG_PATH
export CMAKE_PREFIX_PATH=$KDEDIR:$CMAKE_PREFIX_PATH
export KDEHOME=$HOME/.kde4

export QTEST_COLORED=1
export KDE_COLOR_DEBUG=1
export DISPLAY=:1



kdesvn-build
kdesvn-build is a tool compiling and installing the KDE trunk (or other) repositories, this will easen up things a lot.
kdesvn-build must be configured properly. I provide my current configuration for you to download >here<
The configuration should work out of the box, I’ll describe shortly some of the options I edited.

First of all, the qt-kde git repository is fetched by http, because kdesvn-build has problems with git urls for some unknown reasons.
Also, you currently need to build phonon first form the qt repository, and then from the kdesupport library. I don’t really know why, maybe has to do with the qmake configuration parameters available building qt with phonon. This trick comes from Thiago Macieira, some KDE users on #kde-devel in IRC told me about that it’s currently needed.
Now, you should download the latest kdesvn-build from the official kdesvn-build page, extract it, and copy the kdesvn-build file in the user directory of the kde-devel user.

After you have this, kdesvn-build directory should include kdesvn-build and .kdesvn-buildrc

Now, run kdesvn-build, and ensure that you include the option –no-snapshots the first time you run it. This has the reason that kdesvn-build prefers snapshots on the first checkout, updating just a few files later. The problem is, that the svn snapshots of kde are broken (in example taglib/admin is fetched of 3.5 branch, which is just one of a lot of problems in the -svn snapshots I stumbled over).

Also note, that kdesvn-build obviously has problems building kde to /usr and qt to a custom directory at the same time. I talked Michael Pyne (maintainer of kdesvn-build) about this, but decided I will try to fix the bug myself, due to the reason that I can reproduce the problem. The version at the time writing (1.11) is still broken.

Code: Select all
./kdesvn-build –no-snapshots


Afterwards, your ~/ direcotry should look like this:

Code: Select all
drwx—— 9 kde-devel users 4096 2009-12-13 19:38 .
-rw-r–r– 1 kde-devel users 6 2009-12-13 19:38 .kdesvn-lock
-rw-r–r– 1 kde-devel users 12419 2009-12-13 19:37 .kdesvn-buildrc
-rw-r–r– 1 kde-devel users 2786 2009-12-13 19:37 .kdesvn-build-data
drwxr-xr-x 2 kde-devel users 4096 2009-12-13 19:27 .config
drwxr-xr-x 10 kde-devel users 4096 2009-12-13 18:59 qt4
-rw——- 1 kde-devel users 2077 2009-12-13 17:58 .bash_history
drwxr-xr-x 3 kde-devel users 4096 2009-12-13 17:33 .subversion
drwx—— 3 kde-devel users 4096 2009-12-13 17:17 .dbus
drwx—— 3 kde-devel users 4096 2009-12-13 17:14 .kde4
-rw-r–r– 1 kde-devel users 674 2009-12-13 17:13 .bashrc
drwxr-xr-x 7 kde-devel users 4096 2009-12-13 06:22 kde
drwxr-xr-x 19 kde-devel users 4096 2009-12-13 05:23 kdesvn
-rwxr-xr-x 1 kde-devel users 208941 2009-12-09 02:39 kdesvn-build
drwxr-xr-x 6 root root 4096 2009-12-08 20:15 ..
-rwxr-xr-x 1 kde-devel users 182 2009-02-09 22:43 .xinitrc
-rwxr-xr-x 1 kde-devel users 100 2009-02-09 22:43 .xsession
-rw-r–r– 1 kde-devel users 16 2009-01-28 20:30 .bash_profile


Running kde trunk using Xephyr
Xephyr is a tool for nested sessions which shipping with the XOrg server. In archlinux the package xorg-server includes Xephyr, which was installed in the first chapter.

Switch into your chroot, and start Xephyr (and dbus, you'll need dbus for kde starting up):

Code: Select all
sudo chroot /opt/arch-chroot
/etc/rc.d/dbus start
Xephyr :1 -extension GLX -screen 1024×768 &


You could also use a script to do this for you, and put it into your PATH (/bin/sbin) in your chroot environment:

Code: Select all
#!/bin/bash
if [ ! -e /var/run/dbus.pid ]; then
    /etc/rc.d/dbus start
else
    /etc/rc.d/dbus stop
    if [ -e /var/run/dbus.pid ]; then
        rm /var/run/dbus.pid
    fi
fi

/etc/rc.d/dbus start
Xephyr :1 -extension GLX -screen 1024×768 &



Start your KDE session
Code: Select all
su – kde-devel
startkde


Keyboard Layouts
If you’re using evdev, you’ll very likely experience problems with your default keyboard layout and keymappings in Xephyr, since Xephyr uses XKB.
Now, there’s a simple workaround for this, run as user (in example on your primary system with your primary user)

Code: Select all
xmodmap -pke > ~/.xmodmap
mv .xmodmap /home/kde-devel/.xmodmap


Now autostart xmodmap when your kde4 session starts:

Code: Select all
su – kde-devel
vi .kde4/Autostart/xmodmap


Code: Select all
#!/bin/bash
xmodmap ~/.xmodmap


Now, make the file executable
Code: Select all
chmod +x ~/kde4/Autostart/xmodmap


Ressources
ArchLinux Wiki (Arch32 chroot on Arch64)
KDE Techbase (Getting Started/Build/KDE4)
KDE Techbase (Getting Started/Increased productivity in KDE4 with Scripts)
KDE Techbase (Getting Started/Build/KDE4/ArchLinux)
KDE Techbase (Getting Started/Set up KDE4 for development)
kdesvn-build

Last edited by STiAT on Sun Jan 10, 2010 6:35 pm, edited 3 times in total.
STiAT
Registered Member
Posts
6
Karma
0

Re: KDE ~/trunk in ArchLinux

Thu Dec 24, 2009 1:21 pm
Changes:

2009-12-24: Updated for kdesvn-build 1.11 (qt-copy options, replaced -qtdbus with -dbus and removed -no-exceptions)
2010-01-01: Fixed arch-chroot section.
2010-01-10:Added dbus bind, so KDE can use the system DBUS.

NOTE: For KDE Sound / Hardware development, you'll need to build and run it in your main environment, to be able to access HAL correctly (you can use Xephyr to start KDE though).
I'll add a tutorial about "how to build KDE in your main environment" lateron, it's basically this tutorial with a few adoptions.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]