$OpenBSD: patch-startkde_cmake,v 1.5 2014/04/29 08:42:57 zhuk Exp $
1. Fix lnusertemp locate and make startkde work even without X started.
2. Deconflict kde-runtime with kdebase-3.x.
3. Don't lie about actual temporary directories used (see lnusertemp
   patch in kdelibs).
--- startkde.cmake.orig	Mon Apr 28 08:38:04 2014
+++ startkde.cmake	Mon Apr 28 23:22:20 2014
@@ -3,6 +3,11 @@
 #  DEFAULT KDE STARTUP SCRIPT ( @KDE4WORKSPACE_VERSION@ )
 #
 
+case X"$DISPLAY" in
+X)
+	exec /usr/X11R6/bin/startx $0;;
+esac
+
 if test "x$1" = x--failsafe; then
     KDE_FAILSAFE=1 # General failsafe flag
     KWIN_COMPOSE=N # Disable KWin's compositing
@@ -228,17 +233,17 @@ else
     export GS_LIB
 fi
 
-lnusertemp=`kde4-config --path exe --locate lnusertemp`
+lnusertemp="`kde4-config --path libexec --locate lnusertemp`"
 if test -z "$lnusertemp"; then
   # Startup error
-  echo 'startkde: ERROR: Could not locate lnusertemp in '`kde4-config --path exe` 1>&2
+  echo 'startkde: ERROR: Could not locate lnusertemp in '`kde4-config --path libexec` 1>&2
 fi
 
 # Link "tmp" "socket" and "cache" resources to directory in /tmp
 # Creates:
-# - a directory /tmp/kde-$USER and links $KDEHOME/tmp-$HOSTNAME to it.
-# - a directory /tmp/ksocket-$USER and links $KDEHOME/socket-$HOSTNAME to it.
-# - a directory /var/tmp/kdecache-$USER and links $KDEHOME/cache-$HOSTNAME to it.
+# - a directory /tmp/kde4-$USER and links $KDEHOME/tmp-$HOSTNAME to it.
+# - a directory /tmp/k4socket-$USER and links $KDEHOME/socket-$HOSTNAME to it.
+# - a directory /var/tmp/kde4cache-$USER and links $KDEHOME/cache-$HOSTNAME to it.
 # Note: temporary locations can be overriden through the KDETMP and KDEVARTMP
 # environment variables
 for resource in tmp cache socket; do
@@ -358,11 +363,11 @@ if test $? -eq 255; then
   xmessage -geometry 500x100 "Could not start ksmserver. Check your installation."
 fi
 
-wait_drkonqi=`kreadconfig --file startkderc --group WaitForDrKonqi --key Enabled --default true`
+wait_drkonqi=`kreadconfig4 --file startkderc --group WaitForDrKonqi --key Enabled --default true`
 
 if test x"$wait_drkonqi"x = x"true"x ; then
     # wait for remaining drkonqi instances with timeout (in seconds)
-    wait_drkonqi_timeout=`kreadconfig --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
+    wait_drkonqi_timeout=`kreadconfig4 --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
     wait_drkonqi_counter=0
     while $qdbus | grep "^[^w]*org.kde.drkonqi" > /dev/null ; do
         sleep 5
