- Support FilesystemHierarchyStandard on Linux/Unix using preprocessor macros in .pro files.

- Add support for "make install" and "qmake PREFIX=" to improve YACReader packageability.
- Add .desktop files for YACReader and YACReaderLibrary X11 desktop integration.
- Add central YACReader.pro file as alternative to compileX11.sh
- Add p7zip patch support and sourcecode check to .pro files
This commit is contained in:
Felix Kauselmann 2014-06-25 18:15:41 +02:00
parent 7681fe699b
commit 1d6d605a26
16 changed files with 225 additions and 11 deletions

View File

@ -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

12
YACReader.desktop Normal file
View File

@ -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

3
YACReader.pro Normal file
View File

@ -0,0 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = YACReader YACReaderLibrary
YACReaderLibrary.depends = YACReader

View File

@ -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_*
}

View File

@ -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();

12
YACReaderLibrary.desktop Normal file
View File

@ -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

View File

@ -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
@ -36,6 +35,8 @@ CONFIG -= embed_manifest_exe
unix:!macx{
QMAKE_CXXFLAGS += -std=c++11
isEqual(QT_MAJOR_VERSION, 5) {
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
@ -190,3 +191,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_*
}

View File

@ -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;

View File

@ -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."));

View File

@ -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");

View File

@ -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()

View File

@ -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();

View File

@ -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();

View File

@ -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";

View File

@ -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()

View File

@ -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())
{