diff --git a/INSTALL.txt b/INSTALL.txt index 70bbcdb6..8c65b479 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,8 +1,31 @@ -INSTALLATION GUIDE FOR LINUX USERS +INSTALLATION GUIDE FOR LINUX USERS (BINARY PACKAGE) ********************************** YACReader and YACReaderLibraries binaries are compiled under Ubuntu 13.10 and uses Qt5 and libpoppler-qt5. +COMPILATION GUIDE FOR LINUX/UNIX USERS +********************************** +YACReader and YACReaderLibrary are build using qmake. To build and install the program, run: + +qmake +make +make install + +from the source dir. For seperate builds of YACReader or YACReaderLibrary, enter their respective subfolders and run the commands from there. + +Build options: +--------------------- +You can adjust the installation prefix as well als the path make install uses to install the files. +Use "qmake PREFIX=DIR" to configure YACReader for your systems default prefix (for example "/", "/usr", "/usr/local"). + +For packaging purposes, you can use "make install INSTALL_ROOT=DIR" to install to a different location than the prefix. + +Default values: + +PREFIX=/usr +INSTALL_ROOT="" + + DO YOU WANT TO HELP YACREADER? ****************************** -If you have experience creating packages,please help to create a package for your favourite distro! Send me an e-mail to: info@yacreader.com +If you have experience creating packages, please help to create a package for your favourite distro! Send me an e-mail to: info@yacreader.com diff --git a/YACReader.desktop b/YACReader.desktop new file mode 100644 index 00000000..ddd79076 --- /dev/null +++ b/YACReader.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=YACReader +GenericName=Yet Another Comic Reader +Comment=Yet Another Comic Reader +Exec=YACReader %f +Icon=/usr/share/YACReader/icon.png +Terminal=false +Type=Application +StartupNotify=true +Categories=Graphics;Viewer; +MimeType=application/x-cbz;application/x-cbr;application/x-cbt;application/x-cb7; +X-Desktop-File-Install-Version=0.22 diff --git a/YACReader.pro b/YACReader.pro new file mode 100644 index 00000000..bfc8dc47 --- /dev/null +++ b/YACReader.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = YACReader YACReaderLibrary +YACReaderLibrary.depends = YACReader diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 15d17463..31f6cb33 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -8,6 +8,10 @@ DEPENDPATH += . \ DEFINES += NOMINMAX + unix:!macx{ +QMAKE_CXXFLAGS += -std=c++11 +} + isEqual(QT_MAJOR_VERSION, 5) { Release:DESTDIR = ../release5 Debug:DESTDIR = ../debug5 @@ -34,3 +38,57 @@ TRANSLATIONS = yacreader_es.ts \ yacreader_nl.ts \ yacreader_tr.ts \ yacreader_source.ts + + +win32:!exists (../compressed_archive/lib7zip) { + error(You\'ll need 7zip source code to compile YACReader. \ + Please check the compressed_archive folder for further instructions.) +} + +unix:exists (../compressed_archive/libp7zip) { + message(Found p7zip source code...) + system(patch -d ../compressed_archive -N -p0 -i libp7zip.patch) +} else { + error(You\'ll need 7zip source code to compile YACReader. \ + Please check the compressed_archive folder for further instructions.) +} + +unix:!macx { +#set install prefix if it's empty +isEmpty(PREFIX) { + PREFIX = /usr +} + +BINDIR = $$PREFIX/bin +LIBDIR = $$PREFIX/lib +DATADIR = $$PREFIX/share + +DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" + + +#MAKE INSTALL + +INSTALLS += bin docs icon desktop translation + +bin.path = $$BINDIR +isEmpty(DESTDIR) { + bin.files = YACReader +} else { + bin.files = $$DESTDIR/YACReader +} + +docs.path = $$DATADIR/doc/YACReader +docs.files = ../*.txt + +icon.path = $$DATADIR/YACReader +icon.files = ../images/icon.png + +desktop.path = $$DATADIR/applications +desktop.extra = desktop-file-edit --set-icon=$$DATADIR/YACReader/icon.png $$PWD/../YACReader.desktop +desktop.files = ../YACReader.desktop + +#TODO: icons should be located at /usr/share/icons and have the same basename as their application + +translation.path = $$DATADIR/YACReader/languages +translation.files = ../release/languages/yacreader_* +} \ No newline at end of file diff --git a/YACReader/main.cpp b/YACReader/main.cpp index f61614e2..d5bbdfb5 100644 --- a/YACReader/main.cpp +++ b/YACReader/main.cpp @@ -95,7 +95,11 @@ int main(int argc, char * argv[]) QTranslator translator; QString sufix = QLocale::system().name(); +#if defined Q_OS_UNIX && !defined Q_OS_MAC + translator.load(QString(DATADIR)+"/YACReader/languages/yacreader_"+sufix); +#else translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix); +#endif app.installTranslator(&translator); MainWindowViewer * mwv = new MainWindowViewer(); diff --git a/YACReaderLibrary.desktop b/YACReaderLibrary.desktop new file mode 100644 index 00000000..38551ad7 --- /dev/null +++ b/YACReaderLibrary.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=YACReader Library +GenericName=Yet Another Comic Reader +Comment=Yet Another Comic Reader +Exec=YACReaderLibrary %f +Icon=/usr/share/YACReader/iconLibrary.png +Terminal=false +Type=Application +StartupNotify=true +Categories=Graphics;Viewer; +MimeType=application/x-cbz;application/x-cbr;application/x-cbt;application/x-cb7; +X-Desktop-File-Install-Version=0.22 diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 50a375d8..760b24ed 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -19,7 +19,6 @@ win32 { LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 - isEqual(QT_MAJOR_VERSION, 5) { LIBS += -lpoppler-qt5 INCLUDEPATH += ../dependencies/poppler/include/qt5 @@ -37,6 +36,8 @@ CONFIG -= embed_manifest_exe unix:!macx{ QMAKE_CXXFLAGS += -std=c++11 +QMAKE_CXXFLAGS += -std=c++11 + isEqual(QT_MAJOR_VERSION, 5) { INCLUDEPATH += /usr/include/poppler/qt5 LIBS += -L/usr/lib -lpoppler-qt5 @@ -191,3 +192,54 @@ isEqual(QT_MAJOR_VERSION, 5) { Release:DESTDIR = ../release Debug:DESTDIR = ../debug } + +win32:!exists (../compressed_archive/lib7zip) { + error(You\'ll need 7zip source code to compile YACReader. \ + Please check the compressed_archive folder for further instructions.) +} + +unix:exists (../compressed_archive/libp7zip) { + message(Found p7zip source code...) + system(patch -d ../compressed_archive -N -p0 -i libp7zip.patch) +} else { + error(You\'ll need 7zip source code to compile YACReader. \ + Please check the compressed_archive folder for further instructions.) +} + +unix:!macx { +#set install prefix if it's empty +isEmpty(PREFIX) { + PREFIX = /usr +} + +BINDIR = $$PREFIX/bin +LIBDIR = $$PREFIX/lib +DATADIR = $$PREFIX/share + +DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" + +#MAKE INSTALL +INSTALLS += bin icon desktop server translation + +bin.path = $$BINDIR +isEmpty(DESTDIR) { + bin.files = YACReaderLibrary +} else { + bin.files = $$DESTDIR/YACReaderLibrary +} + +server.path = $$DATADIR/YACReader +server.files = ../release/server + +icon.path = $$DATADIR/YACReader +icon.prefix = ../images +icon.files = iconLibrary.png db.png coversPackage.png + +desktop.path = $$DATADIR/applications +desktop.extra = desktop-file-edit --set-icon=$$DATADIR/YACReader/iconLibrary.png $$PWD/../YACReaderLibrary.desktop +desktop.files = ../YACReaderLibrary.desktop +#TODO: icons should be located at /usr/share/icons and have the same basename as their application + +translation.path = $$DATADIR/YACReader/languages +translation.files = ../release/languages/yacreaderlibrary_* +} \ No newline at end of file diff --git a/YACReaderLibrary/library_creator.cpp b/YACReaderLibrary/library_creator.cpp index cb3d19bf..505e83ea 100644 --- a/YACReaderLibrary/library_creator.cpp +++ b/YACReaderLibrary/library_creator.cpp @@ -73,7 +73,11 @@ void LibraryCreator::run() stopRunning = false; //check for 7z lib +#if defined Q_OS_UNIX && !defined Q_OS_MAC + QLibrary *sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so"); +#else QLibrary *sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z"); +#endif if(!sevenzLib->load()) { QLOG_ERROR() << "Loading 7z.dll : " + sevenzLib->errorString() << endl; diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index d9cf27c6..66debab4 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1148,9 +1148,9 @@ void LibraryWindow::openComic() yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader \"%1\" \"%2\" \"%3\"").arg(path).arg(comicId).arg(libraryId)/*.arg(page).arg(bookmark1).arg(bookmark2).arg(bookmark3).arg(brightness).arg(contrast).arg(gamma)*/,QStringList()); #endif -#ifdef Q_OS_LINUX +#if defined Q_OS_UNIX && !defined Q_OS_MAC QStringList parameters = QStringList() << path << QString::number(comicId) << QString::number(libraryId); - yacreaderFound = QProcess::startDetached(QDir::cleanPath(QCoreApplication::applicationDirPath())+QString("/YACReader"),parameters); + yacreaderFound = QProcess::startDetached(QString("YACReader"),parameters); #endif if(!yacreaderFound) QMessageBox::critical(this,tr("YACReader not found"),tr("YACReader not found, YACReader should be installed in the same folder as YACReaderLibrary.")); diff --git a/YACReaderLibrary/main.cpp b/YACReaderLibrary/main.cpp index ea3709c3..6b0eb261 100644 --- a/YACReaderLibrary/main.cpp +++ b/YACReaderLibrary/main.cpp @@ -92,15 +92,20 @@ void logSystemAndConfig() #endif #ifdef Q_OS_WIN - if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.dll")) + if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.dll")) { +#elif defined Q_OS_UNIX && !defined Q_OS_MAC + if(QLibrary::isLibrary(QString(LIBDIR)+"/p7zip/7z.so")) #else if(QLibrary::isLibrary(QApplication::applicationDirPath()+"/utils/7z.so")) #endif QLOG_INFO() << "7z : found"; else QLOG_ERROR() << "7z : not found"; - +#if defined Q_OS_UNIX && !defined Q_OS_MAC + if(QFileInfo(QString(BINDIR)+"/qrencode").exists()) +#else if(QFileInfo(QApplication::applicationDirPath()+"/utils/qrencode.exe").exists() || QFileInfo("./util/qrencode").exists()) +#endif QLOG_INFO() << "qrencode : found"; else QLOG_INFO() << "qrencode : not found"; @@ -150,11 +155,19 @@ int main( int argc, char ** argv ) QTranslator translator; QString sufix = QLocale::system().name(); +#if defined Q_OS_UNIX && !defined Q_OS_MAC + translator.load(QString(DATADIR) +"/YACReader/languages/yacreaderlibrary_"+sufix); +#else translator.load(QCoreApplication::applicationDirPath()+"/languages/yacreaderlibrary_"+sufix); +#endif app.installTranslator(&translator); QTranslator viewerTranslator; +#if defined Q_OS_UNIX && !defined Q_OS_MAC + viewerTranslator.load(QString(DATADIR)+"/YACReader/languages/yacreader_"+sufix); +#else viewerTranslator.load(QCoreApplication::applicationDirPath()+"/languages/yacreader_"+sufix); +#endif app.installTranslator(&viewerTranslator); app.setApplicationName("YACReaderLibrary"); diff --git a/YACReaderLibrary/package_manager.cpp b/YACReaderLibrary/package_manager.cpp index 3aaf2b91..d5f21ef9 100644 --- a/YACReaderLibrary/package_manager.cpp +++ b/YACReaderLibrary/package_manager.cpp @@ -14,7 +14,11 @@ void PackageManager::createPackage(const QString & libraryPath,const QString & d _7z = new QProcess(); connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError))); connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SIGNAL(exported())); +#if defined Q_OS_UNIX && !defined Q_OS_MAC + _7z->start("7z",attributes); //TODO: use 7z.so +#else _7z->start(QCoreApplication::applicationDirPath()+"/utils/7zip",attributes); //TODO: use 7z.dll +#endif } void PackageManager::extractPackage(const QString & packagePath,const QString & destDir) @@ -26,7 +30,11 @@ void PackageManager::extractPackage(const QString & packagePath,const QString & _7z = new QProcess(); connect(_7z,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError))); connect(_7z,SIGNAL(finished(int,QProcess::ExitStatus)),this,SIGNAL(imported())); +#if defined Q_OS_UNIX && !defined Q_OS_MAC + _7z->start("7z",attributes); //TODO: use 7z.so +#else _7z->start(QCoreApplication::applicationDirPath()+"/utils/7zip",attributes); //TODO: use 7z.dll +#endif } void PackageManager::cancel() diff --git a/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp b/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp index e750fd3e..e01a39b7 100644 --- a/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp +++ b/YACReaderLibrary/server/lib/bfHttpServer/staticfilecontroller.cpp @@ -24,8 +24,13 @@ StaticFileController::StaticFileController(QSettings* settings, QObject* parent) if (QDir::isRelativePath(docroot)) #endif { +#if defined Q_OS_UNIX && ! defined Q_OS_MAC + QFileInfo configFile(QString(DATADIR)+"/YACReader"); + docroot=QFileInfo(QString(DATADIR)+"/YACReader",docroot).absoluteFilePath(); +#else QFileInfo configFile(QApplication::applicationDirPath()); docroot=QFileInfo(QApplication::applicationDirPath(),docroot).absoluteFilePath(); +#endif } qDebug("StaticFileController: docroot=%s, encoding=%s, maxAge=%i",qPrintable(docroot),qPrintable(encoding),maxAge); maxCachedFileSize=settings->value("maxCachedFileSize","65536").toInt(); diff --git a/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp b/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp index 2456407e..5cb416e4 100644 --- a/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp +++ b/YACReaderLibrary/server/lib/bfTemplateEngine/templateloader.cpp @@ -22,8 +22,13 @@ TemplateLoader::TemplateLoader(QSettings* settings, QObject* parent) if (QDir::isRelativePath(templatePath)) #endif { +#if defined Q_OS_UNIX && !defined Q_OS_MAC + QFileInfo configFile(QString(DATADIR)+"/YACReader"); + templatePath=QFileInfo(QString(DATADIR)+"/YACReader",templatePath).absoluteFilePath(); +#else QFileInfo configFile(QApplication::applicationDirPath()); templatePath=QFileInfo(QApplication::applicationDirPath(),templatePath).absoluteFilePath(); +#endif } fileNameSuffix=settings->value("suffix",".tpl").toString(); QString encoding=settings->value("encoding").toString(); diff --git a/YACReaderLibrary/server/static.cpp b/YACReaderLibrary/server/static.cpp index b724cfeb..38133b66 100644 --- a/YACReaderLibrary/server/static.cpp +++ b/YACReaderLibrary/server/static.cpp @@ -26,8 +26,11 @@ QString Static::getConfigDir() { return configDir; } // Search config file - + #if defined Q_OS_UNIX && !defined Q_OS_MAC + QString binDir=(QString(DATADIR) + "/YACReader"); + #else QString binDir=QCoreApplication::applicationDirPath(); + #endif QString organization=QCoreApplication::organizationName(); QString configFileName=QCoreApplication::applicationName()+".ini"; diff --git a/YACReaderLibrary/server_config_dialog.cpp b/YACReaderLibrary/server_config_dialog.cpp index 5945ee38..571dcc7f 100644 --- a/YACReaderLibrary/server_config_dialog.cpp +++ b/YACReaderLibrary/server_config_dialog.cpp @@ -282,7 +282,11 @@ void ServerConfigDialog::generateQR(const QString & serverAddress) attributes << "-o" << "-" /*QCoreApplication::applicationDirPath()+"/utils/tmp.png"*/ << "-s" << "8" << "-l" << "H" << "-m" << "0" << serverAddress; connect(qrGenerator,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(updateImage(void))); connect(qrGenerator,SIGNAL(error(QProcess::ProcessError)),this,SLOT(openingError(QProcess::ProcessError))); //TODO: implement openingError +#if defined Q_OS_UNIX && !defined Q_OS_MAC + qrGenerator->start(QString("qrencode"),attributes); +#else qrGenerator->start(QCoreApplication::applicationDirPath()+"/utils/qrencode",attributes); +#endif } void ServerConfigDialog::updateImage() diff --git a/compressed_archive/compressed_archive.cpp b/compressed_archive/compressed_archive.cpp index 0ec119c0..b7dda786 100644 --- a/compressed_archive/compressed_archive.cpp +++ b/compressed_archive/compressed_archive.cpp @@ -197,8 +197,12 @@ bool CompressedArchive::loadFunctions() // fix2: rename 7z.so to 7z.dylib if(sevenzLib == 0) { -#ifdef Q_OS_UNIX - rarLib = new QLibrary(QApplication::applicationDirPath()+"/utils/Codecs/Rar29"); +#if defined Q_OS_UNIX + #if defined Q_OS_MAC + rarLib = new QLibrary(QApplication::applicationDirPath()+"/utils/Codecs/Rar29"); + #else + rarLib = new QLibrary(QString(LIBDIR)+"/p7zip/Codecs/Rar29.so"); + #endif if(!rarLib->load()) { qDebug() << "Error Loading Rar29.so : " + rarLib->errorString() << endl; @@ -206,7 +210,11 @@ bool CompressedArchive::loadFunctions() return false; } #endif - sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z"); +#if defined Q_OS_UNIX && !defined Q_OS_MAC + sevenzLib = new QLibrary(QString(LIBDIR)+"/p7zip/7z.so"); +#else + sevenzLib = new QLibrary(QApplication::applicationDirPath()+"/utils/7z"); +#endif } if(!sevenzLib->load()) {