File use-system-libraries.patch of Package gaia2

Index: gaia-2.4.5/src/wscript
===================================================================
--- gaia-2.4.5.orig/src/wscript
+++ gaia-2.4.5/src/wscript
@@ -36,7 +36,6 @@ def build_library(bld):
     sources += bld.path.ant_glob('algorithms/*.cpp')
     sources += bld.path.ant_glob('metrics/*.cpp')
     sources += bld.path.ant_glob('3rdparty/alglib/*.cpp')
-    sources += bld.path.ant_glob('3rdparty/libsvm/*.cpp')
     sources += bld.path.ant_glob('parser/*.cpp')
 
     if bld.env['WITH_STLFACADE']:
@@ -46,7 +45,7 @@ def build_library(bld):
         source   = sources,
         target   = 'gaia2',
         uselib   = 'QT5CORE QT5NETWORK QT5CONCURRENT',
-        use      = bld.env['USELIB'],
+        use      = bld.env['USELIB'] + ['svm'],
         install_path = '${PREFIX}/lib%s' % Utils.lib64(),
         includes = [ '.', 'metrics', '3rdparty' ]
     )
@@ -163,6 +162,8 @@ def build_tools(bld):
         bld.install_files('/etc/init.d', bld.path.ant_glob('tools/cyclops_server/initscripts/*'), chmod=0755)
     
 def build(bld):
+    bld.recurse('3rdparty')
+
     build_library(bld)
     build_tools(bld)
 
Index: gaia-2.4.5/src/algorithms/svmpredict.h
===================================================================
--- gaia-2.4.5.orig/src/algorithms/svmpredict.h
+++ gaia-2.4.5/src/algorithms/svmpredict.h
@@ -22,7 +22,7 @@
 
 #include <QByteArray>
 #include "applier.h"
-#include "3rdparty/libsvm/svm.h"
+#include "libsvm/svm.h"
 
 namespace gaia2 {
 
Index: gaia-2.4.5/src/3rdparty/libsvm/gaiasvmutils.h
===================================================================
--- gaia-2.4.5.orig/src/3rdparty/libsvm/gaiasvmutils.h
+++ gaia-2.4.5/src/3rdparty/libsvm/gaiasvmutils.h
@@ -2,7 +2,7 @@
 #define GAIASVMUTILS_H
 
 #include "dataset.h"
-#include "svm.h"
+#include "libsvm/svm.h"
 
 namespace gaia2 {
 namespace svm {
Index: gaia-2.4.5/src/algorithms/extractapplier.h
===================================================================
--- gaia-2.4.5.orig/src/algorithms/extractapplier.h
+++ gaia-2.4.5/src/algorithms/extractapplier.h
@@ -21,7 +21,7 @@
 #define GAIA_EXTRACTAPPLIER_H
 
 #include "applier.h"
-#include "3rdparty/libsvm/svm.h"
+#include "libsvm/svm.h"
 #include "utils.h"
 
 namespace gaia2 {
Index: gaia-2.4.5/src/algorithms/svmtrain.cpp
===================================================================
--- gaia-2.4.5.orig/src/algorithms/svmtrain.cpp
+++ gaia-2.4.5/src/algorithms/svmtrain.cpp
@@ -22,8 +22,8 @@
 #include <QTextStream>
 #include <QTemporaryFile>
 #include "svmtrain.h"
-#include "3rdparty/libsvm/svm.h"
-#include "3rdparty/libsvm/gaiasvmutils.h"
+#include "libsvm/svm.h"
+#include "gaiasvmutils.h"
 #include "utils.h"
 #include "algoutils.h"
 
@@ -199,7 +199,7 @@ Transformation SVMTrain::analyze(const D
   }
 
   // destroy the model allocated by libsvm
-  svm_destroy_model(model);
+  svm_free_and_destroy_model(&model);
 
   Transformation result(dataset->layout());
   result.analyzerName = "svmtrain";
Index: gaia-2.4.5/src/algorithms/svmpredict.cpp
===================================================================
--- gaia-2.4.5.orig/src/algorithms/svmpredict.cpp
+++ gaia-2.4.5/src/algorithms/svmpredict.cpp
@@ -43,7 +43,7 @@ SVMPredict::SVMPredict(const Transformat
 
 
 SVMPredict::~SVMPredict() {
-  svm_destroy_model(_model);
+  svm_free_and_destroy_model(&_model);
   delete[] _cmap;
 }
 
Index: gaia-2.4.5/src/3rdparty/wscript
===================================================================
--- /dev/null
+++ gaia-2.4.5/src/3rdparty/wscript
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import os, os.path
+from waflib import Utils
+
+def build(bld):
+    os.chdir(os.path.join(bld.top_dir, 'src/3rdparty/qthttp'))
+    os.system('qmake-qt5')
+    os.system('make')
+    os.chdir(bld.top_dir)