soprano: find virtuoso without LD_LIBRARY_PATH hack

Now it finds virtuoso driver provided that virtuoso-t binary is in PATH.

svn path=/nixpkgs/trunk/; revision=29103
This commit is contained in:
Yury G. Kudryashov 2011-09-07 22:53:11 +00:00
parent fcec1593b8
commit 133310cb87
2 changed files with 78 additions and 0 deletions

View file

@ -14,6 +14,7 @@ stdenv.mkDerivation rec {
name = "soprano-virtuoso-restart.patch";
sha256 = "0jk038fp7ii6847mbxdajhhc7f6ap6lriaklxcqqxf6ddj37gf3y";
})
./find-virtuoso.patch
];
# We disable the Java backend, since we do not need them and they make the closure size much bigger

View file

@ -0,0 +1,77 @@
From: Yury G. Kudryashov <urkud.urkud@gmail.com>
Subject: [PATCH] Find virtuoso if virtuoso-t is in PATH
---
backends/virtuoso/virtuosobackend.cpp | 29 ++++++++++++++++++++---------
backends/virtuoso/virtuosobackend.h | 2 +-
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/backends/virtuoso/virtuosobackend.cpp b/backends/virtuoso/virtuosobackend.cpp
index c83605d..c24854e 100644
--- a/backends/virtuoso/virtuosobackend.cpp
+++ b/backends/virtuoso/virtuosobackend.cpp
@@ -188,19 +188,19 @@ namespace {
bool Soprano::Virtuoso::BackendPlugin::isAvailable() const
{
-#ifndef Q_OS_WIN
- if ( findVirtuosoDriver().isEmpty() ) {
- qDebug() << Q_FUNC_INFO << "could not find Virtuoso ODBC driver";
- return false;
- }
-#endif
-
QString virtuosoBin = VirtuosoController::locateVirtuosoBinary();
if ( virtuosoBin.isEmpty() ) {
qDebug() << Q_FUNC_INFO << "could not find virtuoso-t binary";
return false;
}
+#ifndef Q_OS_WIN
+ if ( findVirtuosoDriver(virtuosoBin).isEmpty() ) {
+ qDebug() << Q_FUNC_INFO << "could not find Virtuoso ODBC driver";
+ return false;
+ }
+#endif
+
QString vs = determineVirtuosoVersion( virtuosoBin );
if ( vs.isEmpty() ) {
qDebug() << Q_FUNC_INFO << "Failed to determine version of the Virtuoso server at" << virtuosoBin;
@@ -217,9 +217,20 @@ bool Soprano::Virtuoso::BackendPlugin::isAvailable() const
#ifndef Q_OS_WIN
-QString Soprano::Virtuoso::BackendPlugin::findVirtuosoDriver() const
+QString Soprano::Virtuoso::BackendPlugin::findVirtuosoDriver( const QString &virtuosoBinHint ) const
{
- return Soprano::findLibraryPath( "virtodbc_r", QStringList(), QStringList() << QLatin1String( "virtuoso/plugins/" ) << QLatin1String( "odbc/" ) );
+ QString virtuosoBin;
+ if (virtuosoBinHint.isEmpty())
+ virtuosoBin = VirtuosoController::locateVirtuosoBinary();
+ else
+ virtuosoBin = virtuosoBinHint;
+
+ QDir virtuosoBinDir = QFileInfo(virtuosoBin).absoluteDir();
+ return Soprano::findLibraryPath( "virtodbc_r",
+ QStringList() << virtuosoBinDir.absolutePath()
+ << virtuosoBinDir.absoluteFilePath("../lib"),
+ QStringList() << QLatin1String( "virtuoso/plugins/" ) <<
+ QLatin1String( "odbc/" ) );
}
#endif
diff --git a/backends/virtuoso/virtuosobackend.h b/backends/virtuoso/virtuosobackend.h
index 3971b83..0807e5d 100644
--- a/backends/virtuoso/virtuosobackend.h
+++ b/backends/virtuoso/virtuosobackend.h
@@ -50,7 +50,7 @@ namespace Soprano {
#ifndef Q_OS_WIN
private:
- QString findVirtuosoDriver() const;
+ QString findVirtuosoDriver(const QString &virtuosoBinHint = QString()) const;
#endif
};
}
--
tg: (432b73f..) t/find-virtuoso (depends on: master)