2006-09-30 20:02:39 +04:00
|
|
|
/*
|
|
|
|
-----BEGIN QCMOD-----
|
|
|
|
name: libtorrent
|
2007-03-12 15:21:02 +03:00
|
|
|
arg: with-libtorrent-inc=[path], Path to libtorrent include files
|
2007-03-12 15:34:57 +03:00
|
|
|
arg: with-libtorrent-lib=[path], Path to libtorrent library files
|
2007-06-15 15:29:00 +04:00
|
|
|
arg: with-libtorrent-static-lib=[path], Path to libtorrent .a file
|
2006-09-30 20:02:39 +04:00
|
|
|
-----END QCMOD-----
|
|
|
|
*/
|
|
|
|
class qc_libtorrent : public ConfObj
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
qc_libtorrent(Conf *c) : ConfObj(c) {}
|
2007-04-12 21:17:04 +04:00
|
|
|
QString name() const { return "libtorrent >= 0.13"; }
|
2006-09-30 20:02:39 +04:00
|
|
|
QString shortname() const { return "libtorrent"; }
|
|
|
|
bool exec(){
|
2007-04-04 01:49:52 +04:00
|
|
|
QString s;
|
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_INC");
|
|
|
|
if(!s.isEmpty()) {
|
2007-04-12 21:17:04 +04:00
|
|
|
if(!conf->checkHeader(s, "libtorrent/lsd.hpp")) {
|
2007-04-04 01:49:52 +04:00
|
|
|
return false;
|
2007-03-12 15:21:02 +03:00
|
|
|
}
|
2007-04-04 01:49:52 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/include";
|
|
|
|
sl << "/usr/local/include";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
2007-04-12 21:17:04 +04:00
|
|
|
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
|
2007-04-04 01:49:52 +04:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
conf->addIncludePath(s);
|
|
|
|
conf->addIncludePath(s+QDir::separator()+"libtorrent");
|
2007-03-12 15:34:57 +03:00
|
|
|
|
2007-06-15 15:29:00 +04:00
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_STATIC_LIB");
|
|
|
|
if(!s.isEmpty() && QFile::exists(s) && s.endsWith(".a")){
|
|
|
|
conf->addLib(s);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-04-04 01:49:52 +04:00
|
|
|
s = conf->getenv("QC_WITH_LIBTORRENT_LIB");
|
|
|
|
if(!s.isEmpty()) {
|
2007-03-12 15:34:57 +03:00
|
|
|
if(!conf->checkLibrary(s, "torrent")) {
|
|
|
|
return false;
|
2007-04-04 01:49:52 +04:00
|
|
|
}
|
2007-03-12 15:34:57 +03:00
|
|
|
conf->addLib(QString("-L") + s);
|
2007-04-04 01:49:52 +04:00
|
|
|
}else{
|
|
|
|
QStringList sl;
|
|
|
|
sl << "/usr/lib/";
|
|
|
|
sl << "/usr/local/lib/";
|
|
|
|
bool found = false;
|
|
|
|
foreach(s, sl){
|
|
|
|
if(conf->checkLibrary(s, "torrent")){
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) return false;
|
|
|
|
conf->addLib(QString("-L") + s);
|
|
|
|
}
|
2007-07-24 09:08:02 +04:00
|
|
|
// BUGFIX for Fedora (doesn't support pkg-config?)
|
|
|
|
QFile issue_file("/etc/issue");
|
|
|
|
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
|
|
|
|
QString content = issue_file.readAll();
|
|
|
|
issue_file.close();
|
|
|
|
if(content.indexOf("Fedora") != -1){
|
|
|
|
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
|
|
|
|
conf->addLib("-lssl -lcrypto -lboost_date_time -lboost_filesystem -lboost_thread -lz -ltorrent");
|
|
|
|
}
|
|
|
|
}
|
2007-04-04 01:49:52 +04:00
|
|
|
return true;
|
2006-09-30 20:02:39 +04:00
|
|
|
}
|
|
|
|
};
|