@@ -1,5 +1,5 @@
11{ stdenv, fetchurl, cmake, gettext, pkgconfig, extra-cmake-modules, makeQtWrapper
2−, qtquickcontrols, qtwebkit, qttools
2+, qtquickcontrols, qtwebkit, qttools, kde-cli-tools
33, kconfig, kdeclarative, kdoctools, kiconthemes, ki18n, kitemmodels, kitemviews
44, kjobwidgets, kcmutils, kio, knewstuff, knotifyconfig, kparts, ktexteditor
55, threadweaver, kxmlgui, kwindowsystem, grantlee
@@ -36,7 +36,16 @@ stdenv.mkDerivation rec {
3636
3737 postInstall = ''
3838 wrapQtProgram "$out/bin/kdevelop"
39− wrapProgram "$out/bin/kdevelop!" --prefix PATH ":" "${qttools}/bin"
39+
40+ # The kdevelop! script (shell environment) needs qdbus and kioclient5 in PATH.
41+ wrapProgram "$out/bin/kdevelop!" --prefix PATH ":" "${qttools}/bin:${kde-cli-tools}/bin"
42+
43+ # Fix the (now wrapped) kdevelop! to find things in right places:
44+ # - Make KDEV_BASEDIR point to bin directory of kdevplatform.
45+ kdev_fixup_sed="s|^export KDEV_BASEDIR=.*$|export KDEV_BASEDIR=${kdevplatform}/bin|"
46+ # - Fixup the one use where KDEV_BASEDIR is assumed to contain kdevelop.
47+ kdev_fixup_sed+=";s|\\\$KDEV_BASEDIR/kdevelop|$out/bin/kdevelop|"
48+ sed -E -i "$kdev_fixup_sed" "$out/bin/.kdevelop!-wrapped"
4049 '';
4150
4251 meta = with stdenv.lib; {