Making some build and installation tricks

Change-Id: I49fb84615212762faf0c543ce142185bb216a8fc
diff --git a/linux/ndnxcontrolcenter.desktop b/linux/ndnxcontrolcenter.desktop.in
similarity index 61%
rename from linux/ndnxcontrolcenter.desktop
rename to linux/ndnxcontrolcenter.desktop.in
index 2d7c055..7eecf80 100644
--- a/linux/ndnxcontrolcenter.desktop
+++ b/linux/ndnxcontrolcenter.desktop.in
@@ -1,7 +1,7 @@
 [Desktop Entry]
 Type=Application
 Name=NDNx Control Center
-Exec=/home/iliamo/Qtprojects/untitled2-build-desktop-Qt_4_8_1_in_PATH__System__Release/untitled2
+Exec=@BINDIR@/@BINARY@
 X-GNOME-Autostart-enabled=true
 X-KDE-autostart-after=panel
 X-GNOME-Autostart-Phase=Application
diff --git a/linux/tray-menu.cpp b/linux/tray-menu.cpp
index cfd420a..db3d79e 100644
--- a/linux/tray-menu.cpp
+++ b/linux/tray-menu.cpp
@@ -189,7 +189,7 @@
     QProcess *process = new QProcess();
     connect(process,SIGNAL(finished(int)),process, SLOT(deleteLater()));
     QStringList arguments;
-    arguments << QApplication::applicationDirPath() + "/" + SHORTCUT_FILE << QDir::homePath() + AUTOSTART_DIRECTORY;
+    arguments << QString(RESOURCES_DIR) + "/" + SHORTCUT_FILE << QDir::homePath() + AUTOSTART_DIRECTORY;
     process->start("cp",arguments);
 }
 
@@ -395,7 +395,7 @@
     applyStatusXslt = new QProcess();
 
     QStringList arguments;
-    arguments << QApplication::applicationDirPath() + "/" + STATUS_XSLT_FILE << "-";
+    arguments << QString(RESOURCES_DIR) + "/" + STATUS_XSLT_FILE << "-";
     connect(applyStatusXslt,SIGNAL(finished(int)), this, SLOT(parseStatusXml()));
     //connect(applyStatusXslt,SIGNAL(finished(int)), applyStatusXslt, SLOT(deleteLater()));
     applyStatusXslt->start(XSLTPROC,arguments);
@@ -404,7 +404,7 @@
 
     applyFibXslt = new QProcess();
     QStringList args;
-    args << QApplication::applicationDirPath() + "/" + FIB_XSLT_FILE << "-";
+    args << QString(RESOURCES_DIR) + "/" + FIB_XSLT_FILE << "-";
     connect(applyFibXslt,SIGNAL(finished(int)), this, SLOT(parseFibXml()));
     //connect(applyFibXslt,SIGNAL(finished(int)), applyFibXslt, SLOT(deleteLater()));
     applyFibXslt->start(XSLTPROC,args);
diff --git a/wscript b/wscript
index 03fb3cf..3ee0110 100644
--- a/wscript
+++ b/wscript
@@ -5,7 +5,7 @@
 from waflib import Logs, Utils, Task, TaskGen
 
 def options(opt):
-    opt.load('compiler_c compiler_cxx qt4')
+    opt.load('compiler_c compiler_cxx qt4 gnu_dirs')
     opt.load('sparkle xcode', tooldir='waf-tools')
 
     grp = opt.add_option_group ('NDNx Control Center options')
@@ -50,8 +50,11 @@
         conf.load('sparkle')
     else:
         conf.load('qt4')
+        conf.load('gnu_dirs')
         conf.find_program('xsltproc', mandatory=True)
         conf.define('XSLTPROC', conf.env['XSLTPROC'])
+
+        conf.define('RESOURCES_DIR', Utils.subst_vars("${DATAROOTDIR}/ndnx-control-center", conf.env))
         
         if Utils.unversioned_sys_platform () == "darwin":
             conf.define('OSX_BUILD', 1)
@@ -74,6 +77,15 @@
             mac_frameworks = "osx/Frameworks/Sparkle.framework",
             )
     else:
+        bld (features = "subst",
+             source = bld.path.ant_glob(['linux/**/*.in']),
+             target = [node.change_ext('', '.in') for node in bld.path.ant_glob(['linux/**/*.in'])],
+             BINARY = "NDNx Control Center",
+             install_path = "${DATAROOTDIR}/ndnx-control-center"
+            )
+        bld.install_files("${DATAROOTDIR}/ndnx-control-center",
+                          bld.path.ant_glob(['linux/Resources/*']))
+
         bld (
             target = "NDNx Control Center",
             features=['qt4', 'cxxprogram', 'cxx'],