--- qtcreator-1.3.1.orig/src/qtcreatorlibrary.pri
+++ qtcreator-1.3.1/src/qtcreatorlibrary.pri
@@ -17,7 +17,7 @@
         target.path = /bin
         target.files = $$DESTDIR/$${TARGET}.dll
     } else {
-        target.path = /$$IDE_LIBRARY_BASENAME/qtcreator
+        target.path = $$[QT_INSTALL_LIBS]/qtcreator
     }
     INSTALLS += target
 }
--- qtcreator-1.3.1.orig/src/qtcreatorplugin.pri
+++ qtcreator-1.3.1/src/qtcreatorplugin.pri
@@ -43,8 +43,8 @@
 CONFIG += plugin plugin_with_soname
 
 !macx {
-    target.path = /$$IDE_LIBRARY_BASENAME/qtcreator/plugins/$$PROVIDER
+    target.path = $$[QT_INSTALL_LIBS]/qtcreator/plugins/$$PROVIDER
     pluginspec.files += $${TARGET}.pluginspec
-    pluginspec.path = /$$IDE_LIBRARY_BASENAME/qtcreator/plugins/$$PROVIDER
+    pluginspec.path = $$[QT_INSTALL_LIBS]/qtcreator/plugins/$$PROVIDER
     INSTALLS += target pluginspec
 }
--- qtcreator-1.3.1.orig/src/app/app.pro
+++ qtcreator-1.3.1/src/app/app.pro
@@ -28,7 +28,7 @@
 } else {
     LIBS *= -lExtensionSystem -lAggregation
 
-    target.path  = /bin
+    target.path  = $$[QT_INSTALL_BINS]
     INSTALLS    += target
 }
 
--- qtcreator-1.3.1.orig/src/plugins/projectexplorer/debugginghelper.cpp
+++ qtcreator-1.3.1/src/plugins/projectexplorer/debugginghelper.cpp
@@ -66,6 +66,14 @@
             << (qtInstallData + QLatin1String("/qtc-debugging-helper/"))
             << QDir::cleanPath((QCoreApplication::applicationDirPath() + QLatin1String("/../qtc-debugging-helper/") + QString::number(hash))) + slash
             << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/qtc-debugging-helper/") + QString::number(hash)) + slash;
+
+    // Append Debian search path for pre-built gdbmacros to the end of the
+    // paths to not overwrite user-compiled version. The qtpath condition
+    // is such that the pre-built library only applies to Debian version of Qt,
+    // not any user Qt version.
+    if( qtInstallData == "/usr/share/qt4" )
+        directories << "/usr/lib/qtcreator/gdbmacros/"; // Use FHS on Debian
+
     return directories;
 }
 
--- qtcreator-1.3.1.orig/src/plugins/coreplugin/coreplugin.pro
+++ qtcreator-1.3.1/src/plugins/coreplugin/coreplugin.pro
@@ -168,7 +168,8 @@
     fancyactionbar.qrc
 unix:!macx { 
     images.files = images/qtcreator_logo_*.png
-    images.path = /share/pixmaps
+    images.path = $$[QT_INSTALL_PREFIX]/share/pixmaps
+
     INSTALLS += images
 }
 OTHER_FILES += Core.pluginspec
--- qtcreator-1.3.1.orig/src/plugins/help/helpplugin.cpp
+++ qtcreator-1.3.1/src/plugins/help/helpplugin.cpp
@@ -612,7 +612,7 @@
 #if defined(Q_OS_MAC)
                 + QLatin1String("/../Resources/doc/qtcreator.qch"));
 #else
-                + QLatin1String("../../share/doc/qtcreator/qtcreator.qch"));
+                + QLatin1String("/../share/qtcreator/doc/qtcreator.qch"));
 #endif
             if (!hc.registerDocumentation(qchFileName))
                 qDebug() << qPrintable(hc.error());
--- qtcreator-1.3.1.orig/src/libs/utils/process_stub.pro
+++ qtcreator-1.3.1/src/libs/utils/process_stub.pro
@@ -20,5 +20,5 @@
     LIBS += -lshell32
 }
 
-target.path  = /bin # FIXME: libexec, more or less
+target.path  = $$[QT_INSTALL_BINS] # FIXME: libexec, more or less
 INSTALLS    += target
--- qtcreator-1.3.1.orig/src/libs/utils/consoleprocess_unix.cpp
+++ qtcreator-1.3.1/src/libs/utils/consoleprocess_unix.cpp
@@ -241,7 +241,7 @@
     return QDir::cleanPath(QCoreApplication::applicationDirPath()
                            + QLatin1String("/../Resources/runInTerminal.command"));
 #else
-    return QLatin1String("xterm");
+    return QLatin1String("x-terminal-emulator");
 #endif
 }
 
--- qtcreator-1.3.1.orig/doc/doc.pri
+++ qtcreator-1.3.1/doc/doc.pri
@@ -13,7 +13,7 @@
 }
 
 QHP_FILE = $$OUT_PWD/doc/html/qtcreator.qhp
-QCH_FILE = $$IDE_DOC_PATH/qtcreator.qch
+QCH_FILE = $$OUT_PWD/share/qtcreator/doc/qtcreator.qch
 
 html_docs.commands = $$QDOC $$PWD/qtcreator.qdocconf
 html_docs.depends += $$PWD/qtcreator.qdoc $$PWD/qtcreator.qdocconf
@@ -24,7 +24,7 @@
 qch_docs.files = $$QCH_FILE
 
 unix:!macx {
-    qch_docs.path = /share/doc/qtcreator
+    qch_docs.path = $$[QT_INSTALL_PREFIX]/share/qtcreator/doc
     qch_docs.CONFIG += no_check_exist
     INSTALLS += qch_docs
 }
--- qtcreator-1.3.1.orig/share/qtcreator/static.pro
+++ qtcreator-1.3.1/share/qtcreator/static.pro
@@ -60,7 +60,7 @@
 !macx {
     for(data_dir, DATA_DIRS) {
         eval($${data_dir}.files = $$quote($$PWD/$$data_dir))
-        eval($${data_dir}.path = /share/qtcreator)
+        eval($${data_dir}.path = $$[QT_INSTALL_PREFIX]/share/qtcreator)
         INSTALLS += $$data_dir
     }
 }
--- qtcreator-1.3.1.orig/share/qtcreator/translations/translations.pro
+++ qtcreator-1.3.1/share/qtcreator/translations/translations.pro
@@ -60,6 +60,6 @@
 }
 
 qmfiles.files = $$prependAll(LANGUAGES, $$OUT_PWD/qtcreator_,.qm)
-qmfiles.path = /share/qtcreator/translations
+qmfiles.path = $$[QT_INSTALL_PREFIX]/share/qtcreator/translations
 qmfiles.CONFIG += no_check_exist
 INSTALLS += qmfiles
--- qtcreator-1.3.1.orig/bin/bin.pro
+++ qtcreator-1.3.1/bin/bin.pro
@@ -10,5 +10,5 @@
 
 QMAKE_CLEAN = $$IDE_APP_WRAPPER
 
-target.path  = /bin
+target.path  = $$[QT_INSTALL_BINS]
 INSTALLS    += target
--- qtcreator-1.3.1.orig/bin/qtcreator
+++ qtcreator-1.3.1/bin/qtcreator
@@ -31,6 +31,6 @@
 
 bindir=`dirname "$me"`
 libdir=`cd "${bindir}/../lib" ; pwd`
-LD_LIBRARY_PATH="${libdir}/qtcreator:${LD_LIBRARY_PATH}"
+LD_LIBRARY_PATH="${libdir}/qtcreator${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
 export LD_LIBRARY_PATH
 exec "${bindir}/qtcreator.bin" ${1+"$@"}
