#!/bin/bash

prepend() { [ -d "$2" ] && eval $1=\"$2\$\{$1:+':'\$$1\}\" && export $1 ; }

export KDEDIR=/opt/kontact-e5

# KDE
export KDEHOME=$HOME/kontact-e5_home
export KDESYCOCA=$KDEHOME/kde_sycoca
export KDETMP=/tmp/kde48-sid-$USER
export XDG_CONFIG_HOME=$KDEHOME/xdg_config
export XDG_DATA_HOME=$KDEHOME/xdg_data

mkdir -p $KDETMP
export KDEDIRS=$KDEDIR
prepend LD_LIBRARY_PATH $KDEDIR/lib
prepend PKG_CONFIG_PATH $KDEDIR/lib/pkgconfig
prepend QT_PLUGIN_PATH $KDEDIR/lib/kde4/plugins

prepend PATH $KDEDIR/bin
export PATH
export LD_LIBRARY_PATH
export PKG_CONFIG_PATH
export QT_PLUGIN_PATH

prepend XDG_DATA_DIRS /usr/share
prepend XDG_DATA_DIRS $KDEDIR/share
export XDG_DATA_DIRS

echo Kontact E5 Environment set up.

