From 35b5c598f10c88b9a2ac571c477586bd2fd0feba Mon Sep 17 00:00:00 2001 From: rewine Date: Thu, 12 Jan 2023 17:49:03 +0800 Subject: [PATCH] deepin-reader: init at 5.10.28 --- .../deepin/apps/deepin-reader/default.nix | 74 +++++++++++++++++++ .../apps/deepin-reader/use-pkg-config.diff | 46 ++++++++++++ pkgs/desktops/deepin/default.nix | 1 + 3 files changed, 121 insertions(+) create mode 100644 pkgs/desktops/deepin/apps/deepin-reader/default.nix create mode 100644 pkgs/desktops/deepin/apps/deepin-reader/use-pkg-config.diff diff --git a/pkgs/desktops/deepin/apps/deepin-reader/default.nix b/pkgs/desktops/deepin/apps/deepin-reader/default.nix new file mode 100644 index 000000000000..f7ab5220b61c --- /dev/null +++ b/pkgs/desktops/deepin/apps/deepin-reader/default.nix @@ -0,0 +1,74 @@ +{ stdenv +, lib +, fetchFromGitHub +, qmake +, pkg-config +, qttools +, wrapQtAppsHook +, dtkwidget +, qt5integration +, qt5platform-plugins +, dde-qt-dbus-factory +, qtwebengine +, karchive +, poppler +, libchardet +, libspectre +, openjpeg +, djvulibre +, gtest +, qtbase +}: + +stdenv.mkDerivation rec { + pname = "deepin-reader"; + version = "5.10.28"; + + src = fetchFromGitHub { + owner = "linuxdeepin"; + repo = pname; + rev = version; + sha256 = "sha256-0jHhsxEjBbu3ktvjX1eKnkZDwzRk9MrUSJSdYeOvWtI="; + }; + + patches = [ ./use-pkg-config.diff ]; + + postPatch = '' + substituteInPlace reader/{reader.pro,document/Model.cpp} htmltopdf/htmltopdf.pro 3rdparty/deepin-pdfium/src/src.pro \ + --replace "/usr" "$out" + ''; + + nativeBuildInputs = [ + qmake + pkg-config + qttools + wrapQtAppsHook + ]; + + buildInputs = [ + dtkwidget + qt5platform-plugins + dde-qt-dbus-factory + qtwebengine + karchive + poppler + libchardet + libspectre + djvulibre + openjpeg + gtest + ]; + + # qt5integration must be placed before qtsvg in QT_PLUGIN_PATH + qtWrapperArgs = [ + "--prefix QT_PLUGIN_PATH : ${qt5integration}/${qtbase.qtPluginPrefix}" + ]; + + meta = with lib; { + description = "A simple memo software with texts and voice recordings"; + homepage = "https://github.com/linuxdeepin/deepin-reader"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = teams.deepin.members; + }; +} diff --git a/pkgs/desktops/deepin/apps/deepin-reader/use-pkg-config.diff b/pkgs/desktops/deepin/apps/deepin-reader/use-pkg-config.diff new file mode 100644 index 000000000000..7993cecd30ad --- /dev/null +++ b/pkgs/desktops/deepin/apps/deepin-reader/use-pkg-config.diff @@ -0,0 +1,46 @@ +diff --git a/3rdparty/deepin-pdfium/src/3rdparty/pdfium/pdfium.pri b/3rdparty/deepin-pdfium/src/3rdparty/pdfium/pdfium.pri +index 3e04f340..894b0ac7 100755 +--- a/3rdparty/deepin-pdfium/src/3rdparty/pdfium/pdfium.pri ++++ b/3rdparty/deepin-pdfium/src/3rdparty/pdfium/pdfium.pri +@@ -20,13 +20,8 @@ DEFINES += USE_SYSTEM_LIBJPEG \ + USE_SYSTEM_LIBOPENJPEG2 \ + USE_SYSTEM_FREETYPE + +-INCLUDEPATH += /usr/include/openjpeg-2.3 \ +- /usr/include/openjpeg-2.4 \ +- /usr/include/freetype2 \ +- /usr/include/freetype2/freetype \ +- /usr/include/freetype2/freetype/config +- +-LIBS += -lopenjp2 -llcms2 -lfreetype ++CONFIG += link_pkgconfig ++PKGCONFIG += libopenjp2 lcms2 freetype2 + + #QMAKE_CXXFLAGS += "-Wc++11-narrowing" #is_clang + #QMAKE_CXXFLAGS += "-Wno-inconsistent-missing-override" #is_clang Suppress no override warning for overridden functions. +diff --git a/3rdparty/deepin-pdfium/src/src.pro b/3rdparty/deepin-pdfium/src/src.pro +index 196b91d3..bda71ff4 100755 +--- a/3rdparty/deepin-pdfium/src/src.pro ++++ b/3rdparty/deepin-pdfium/src/src.pro +@@ -2,7 +2,9 @@ TARGET = $$PWD/../lib/deepin-pdfium + + TEMPLATE = lib + +-CONFIG += c++14 ++CONFIG += c++14 link_pkgconfig ++ ++PKGCONFIG += chardet + + ###安全漏洞检测 + #QMAKE_CXX += -g -fsanitize=undefined,address -O2 +@@ -28,10 +30,6 @@ include($$PWD/3rdparty/pdfium/pdfium.pri) + + INCLUDEPATH += $$PWD/../include + +-INCLUDEPATH += /usr/include/chardet +- +-LIBS += -lchardet +- + public_headers += \ + $$PWD/../include/dpdfglobal.h \ + $$PWD/../include/dpdfdoc.h \ diff --git a/pkgs/desktops/deepin/default.nix b/pkgs/desktops/deepin/default.nix index bb36b21b31c8..9a573ebcd133 100644 --- a/pkgs/desktops/deepin/default.nix +++ b/pkgs/desktops/deepin/default.nix @@ -29,6 +29,7 @@ let deepin-image-viewer = callPackage ./apps/deepin-image-viewer { }; deepin-picker = callPackage ./apps/deepin-picker { }; deepin-terminal = callPackage ./apps/deepin-terminal { }; + deepin-reader = callPackage ./apps/deepin-reader { }; #### ARTWORK dde-account-faces = callPackage ./artwork/dde-account-faces { };