From df7454580ecb697ff6fc9e95c2c203fa084fd727 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Sun, 30 Jul 2023 16:44:40 +0200 Subject: [PATCH] Linux installation scripts, some adjustments --- CMakeLists.txt | 2 ++ Pdf4QtLib/sources/pdfcms.cpp | 2 ++ Pdf4QtLib/sources/pdfutils.cpp | 2 ++ Pdf4QtViewer/pdfprogramcontroller.cpp | 17 ++++++++++++-- make-package.sh.in | 33 +++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 make-package.sh.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 4877af8..c5d11d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,8 @@ message("CMAKE_TOOLCHAIN_FILE = " ${CMAKE_TOOLCHAIN_FILE}) install(FILES Desktop/Pdf4QtDocDiff.desktop Desktop/Pdf4QtDocPageOrganizer.desktop Desktop/Pdf4QtViewerLite.desktop Desktop/Pdf4QtViewerProfi.desktop DESTINATION usr/share/applications) install(FILES Desktop/Pdf4QtDocDiff.svg Desktop/Pdf4QtDocPageOrganizer.svg Desktop/Pdf4QtViewerLite.svg Desktop/Pdf4QtViewerProfi.svg DESTINATION usr/share/icons) +configure_file(make-package.sh.in make-package.sh) + if(PDF4QT_INSTALL_DEPENDENCIES) install(DIRECTORY ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/ TYPE BIN diff --git a/Pdf4QtLib/sources/pdfcms.cpp b/Pdf4QtLib/sources/pdfcms.cpp index a2c1767..efd63d4 100644 --- a/Pdf4QtLib/sources/pdfcms.cpp +++ b/Pdf4QtLib/sources/pdfcms.cpp @@ -32,7 +32,9 @@ #pragma warning(push) #pragma warning(disable:5033) #endif +#ifndef CMS_NO_REGISTER_KEYWORD #define CMS_NO_REGISTER_KEYWORD +#endif #include #include #ifdef PDF4QT_COMPILER_MSVC diff --git a/Pdf4QtLib/sources/pdfutils.cpp b/Pdf4QtLib/sources/pdfutils.cpp index c0337cf..0a62e94 100644 --- a/Pdf4QtLib/sources/pdfutils.cpp +++ b/Pdf4QtLib/sources/pdfutils.cpp @@ -45,7 +45,9 @@ #pragma warning(push) #pragma warning(disable:5033) +#ifndef CMS_NO_REGISTER_KEYWORD #define CMS_NO_REGISTER_KEYWORD +#endif #include #pragma warning(pop) diff --git a/Pdf4QtViewer/pdfprogramcontroller.cpp b/Pdf4QtViewer/pdfprogramcontroller.cpp index 36bb95d..f69663c 100644 --- a/Pdf4QtViewer/pdfprogramcontroller.cpp +++ b/Pdf4QtViewer/pdfprogramcontroller.cpp @@ -1904,15 +1904,28 @@ void PDFProgramController::updatePageLayoutActions() void PDFProgramController::loadPlugins() { + QStringList availablePlugins; + #if defined(Q_OS_WIN) QDir directory(QApplication::applicationDirPath() + "/pdfplugins"); - QStringList availablePlugins = directory.entryList(QStringList("*.dll")); + availablePlugins = directory.entryList(QStringList("*.dll")); #elif defined(Q_OS_UNIX) +#ifndef NDEBUG QDir directory(QApplication::applicationDirPath() + "/../pdfplugins"); - QStringList availablePlugins = directory.entryList(QStringList("*.so")); + availablePlugins = directory.entryList(QStringList("*.so")); +#else + QDir directory(QApplication::applicationDirPath()); + if (directory.cdUp() && + directory.cd("lib") && + directory.cd("pdf4qt")) + { + availablePlugins = directory.entryList(QStringList("*.so")); + } +#endif #else static_assert(false, "Implement this for another OS!"); #endif + for (const QString& availablePlugin : availablePlugins) { QString pluginFileName = directory.absoluteFilePath(availablePlugin); diff --git a/make-package.sh.in b/make-package.sh.in new file mode 100644 index 0000000..3846771 --- /dev/null +++ b/make-package.sh.in @@ -0,0 +1,33 @@ +#!/bin/bash + +mkdir -p install/lib/pdf4qt +mv -f install/lib/*Plugin.so* install/lib/pdf4qt/ + +#mkdir -p install/usr/bin/ +#mv -f install/bin/* install/usr/bin/ + +mkdir -p install/DEBIAN/ +file="install/DEBIAN/control" + +>$file +echo "Package: PDF4QT" >>$file +echo "Version: ${PDF4QT_VERSION}" >>$file +echo "Section: base" >>$file +echo "Priority: optional" >>$file +echo "Architecture: amd64" >>$file +echo "Depends: libqt6gui6, libqt6xml6, libqt6svg6, libqt6openglwidgets6, libtbb12, libqt6printsupport6, libqt6texttospeech6, qt6-speech-speechd-plugin, qt6-speech-flite-plugin">>$file +echo "Maintainer: Jakub Melka" >>$file +echo "Description: This software is consisting of PDF rendering library, and several applications, such as advanced document viewer, command line tool, and document page manipulator application. Software is implementing PDF functionality based on PDF Reference 2.0. It is written and maintained by Jakub Melka." >>$file +echo "Homepage: https://jakubmelka.github.io/" >>$file +echo "Vcs-Browser: https://github.com/JakubMelka/PDF4QT" >>$file + + +dpkg-deb --build install + +mv install.deb PDF4QT-${PDF4QT_VERSION}.deb + + + + + +