From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id yPHvANKH22UPmwAA62LTzQ:P1 (envelope-from ) for ; Sun, 25 Feb 2024 19:32:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id yPHvANKH22UPmwAA62LTzQ (envelope-from ) for ; Sun, 25 Feb 2024 19:32:50 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=dan.games header.s=fm2 header.b="H/e0S7au"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=Bf5Fx214; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708885969; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=QfIt3FiPThRFDEmVAzBnSmQh4Vt6XZCKLGlWaP+6oMs=; b=XyBbs9VqbJZUFqpGQdfQABYXPtzzIz2sx0dw8wc9zQKpFU9sAPRm3k7r803//0DwOfrxAZ yttG0pt13NsVGZ2KnF0V0n3vifuCKFgjkDkfDP/deEoflPA2E35JgF6je4UeQ6NwhwKcvy bx++G4Yo28p5ed2q5t8/HjKwwLiD56wM1LkDcMK6NjGjTujxFxIbM2OwxaqAtIqd8ig3eY GkLolOTnr+PgTN1Qz2J++FABXC964eyQlvU2lkU7s4BfVUgJb9v96nHy5xMbtUdDhTn4YF 5IaRGWk17rflxq9u4xH+Mj74rK678wfydYf92PwdfKjPobbeGZ9LNj8vGIa2Mw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=dan.games header.s=fm2 header.b="H/e0S7au"; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=Bf5Fx214; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708885969; a=rsa-sha256; cv=none; b=CYWRe1d3AyDHuR2Jd80KoYmOVpuk7h7r9KNiQzLUwWYgxauKwOY7Hhr1N3lEqaq4p9BTU9 R+fPYlOwcO7cQqprETuZg9QSCHQCikS1N/OVVICFPIt14fdWg9UKK4IbyS1KmfJoe5W6Bb bXgV3NJ3GLYXk4/+fi9xsmXjuXRyZCE+nSQEN51mS/sJfknwV1YhCYoDAQMXHZdBeBhtan nFgZF5rmofZRN9mWsHlEL5GraTYVv0UCTwQRqfAS0d6q5gsNmtiN5ZmACVJ1leBIKMXDAz eMmJF/YZRZ4S77B1HqHZ8UI29KP9iPUQCqD0E8uBczzrfNCgAFg19mUIL6r8BA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D49A214529 for ; Sun, 25 Feb 2024 19:32:48 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reJIn-0006Zz-Va; Sun, 25 Feb 2024 13:32:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1reJIl-0006ZQ-RO for guix-patches@gnu.org; Sun, 25 Feb 2024 13:32:40 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reJIl-0007ZE-JJ for guix-patches@gnu.org; Sun, 25 Feb 2024 13:32:39 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1reJJA-0000pC-CY for guix-patches@gnu.org; Sun, 25 Feb 2024 13:33:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69377] [PATCH v3] gnu: Add sioyek. References: <20240225101233.13418-1-i@dan.games> In-Reply-To: <20240225101233.13418-1-i@dan.games> Resent-From: dan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 25 Feb 2024 18:33:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69377 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69377@debbugs.gnu.org Received: via spool by 69377-submit@debbugs.gnu.org id=B69377.17088859823156 (code B ref 69377); Sun, 25 Feb 2024 18:33:04 +0000 Received: (at 69377) by debbugs.gnu.org; 25 Feb 2024 18:33:02 +0000 Received: from localhost ([127.0.0.1]:37445 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reJJ7-0000oe-1Y for submit@debbugs.gnu.org; Sun, 25 Feb 2024 13:33:02 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:37735) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1reJJ3-0000o7-Pi for 69377@debbugs.gnu.org; Sun, 25 Feb 2024 13:32:59 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 43C7932000EB for <69377@debbugs.gnu.org>; Sun, 25 Feb 2024 13:32:26 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 25 Feb 2024 13:32:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dan.games; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm2; t=1708885945; x=1708972345; bh=QfIt3FiPTh RFDEmVAzBnSmQh4Vt6XZCKLGlWaP+6oMs=; b=H/e0S7auZlBDd5d49Zw15HfrBU jzX17j1/ClT2uUTP51WXaXU2tL+ZDAQ9GcB1o8t24fnWBYucxpHy+qytjxS/2UDT 4qRWaotu0c5DEsjp4DLDKyLXRixjOm2IR878WbyyO32XtF0QwY59I7qpy/2xJXAu 5wER9CaWAOnZt+W7+WU0hWvoLjahsKky11W6BWJ68oA66BUUI3+F0KtSXSGuFWDx WU0Le/hPg07ptUEKtJsmrv106Vx3/lxmIevWPrFyaZmUZ/Ym43IJfxXP1/EfnBbj 1AlZfIDHX0hIpw1oQRAg4IsfoXE+5yx+hPopGV+Q749EiH4yN8eu7Fb+SyGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708885945; x=1708972345; bh=QfIt3FiPThRFDEmVAzBnSmQh4Vt6 XZCKLGlWaP+6oMs=; b=Bf5Fx214EsNSzP044cJ/H5XpsLqNeHWbQOdFBcs5go40 kV3ssjkPdYtUQdUtfFoNM8BQYycNHJji0I0y1Oi/Lw31/yU4vN434WVDXioc/xsQ kWtt2gQBTW94gqtJZ2IazhWOtueZde6bvPWHEkmI07WhxN5vfMFV1NdNxEX6YRhq VI5x7WBbxr7AT06EKJt1zOWgKfxPg6Rj4JZfBT0i53Pd0VMDnTW1U2OLzbVIsgTB aMeG/5YdG5X9ATQvGEF06lCkXj8Rj3a2xefT7nZwhH34Taa1XFOadvi0mFH7ND29 WJgAu96zeRCOXiNw8LWGUKQRSJ/YbL4B2MJ3QzvXNw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgedtgdduuddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofggtgfgsehtkeertd ertdejnecuhfhrohhmpegurghnuceoihesuggrnhdrghgrmhgvsheqnecuggftrfgrthht vghrnhepveelveekgeevteevhfehtdegledvhefhfeeugedvhfffhfeffffhveelhffhve eunecuffhomhgrihhnpehgihhthhhusgdrtghomhdpshhiohihvghkrdhinhhfohenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehisegurghnrd hgrghmvghs X-ME-Proxy: Feedback-ID: i3b5946ed:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for <69377@debbugs.gnu.org>; Sun, 25 Feb 2024 13:32:24 -0500 (EST) From: dan Date: Mon, 26 Feb 2024 02:31:44 +0800 Message-ID: <6f33128cb1f1125430f77b86d21b31cebec44d4d.1708885904.git.i@dan.games> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -1.37 X-Spam-Score: -1.37 X-Migadu-Queue-Id: D49A214529 X-TUID: Jvs5JhnvU8fl * gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch: New file. * gnu/packages/pdf.scm (sioyek): New variable. Change-Id: Id2708745bd7ef672b620b8e9c907126bdc5a1f55 --- .../sioyek-mupdf-0.23.0-fix-build.patch | 73 +++++++++++++++++++ gnu/packages/pdf.scm | 56 ++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch diff --git a/gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch b/gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch new file mode 100644 index 0000000000..4e0ee6de37 --- /dev/null +++ b/gnu/packages/patches/sioyek-mupdf-0.23.0-fix-build.patch @@ -0,0 +1,73 @@ +diff --git a/pdf_viewer/document_view.cpp b/pdf_viewer/document_view.cpp +index f48d05e..0bc3855 100644 +--- a/pdf_viewer/document_view.cpp ++++ b/pdf_viewer/document_view.cpp +@@ -1121,7 +1121,7 @@ std::vector DocumentView::find_line_definitions() { + + std::optional pdf_link = current_document->get_link_in_page_rect(get_center_page_number(), line_rects[line_index]); + if (pdf_link.has_value()) { +- auto parsed_uri = parse_uri(mupdf_context, pdf_link.value().uri); ++ auto parsed_uri = parse_uri(mupdf_context, current_document->doc, pdf_link.value().uri); + result.push_back({ parsed_uri.page - 1, parsed_uri.x, parsed_uri.y }); + return result; + } +diff --git a/pdf_viewer/main_widget.cpp b/pdf_viewer/main_widget.cpp +index 19b568b..335a93f 100644 +--- a/pdf_viewer/main_widget.cpp ++++ b/pdf_viewer/main_widget.cpp +@@ -170,7 +170,7 @@ void MainWidget::set_overview_position(int page, float offset) { + + void MainWidget::set_overview_link(PdfLink link) { + +- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri); ++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, link.uri); + if (page >= 1) { + set_overview_position(page - 1, offset_y); + } +@@ -3178,7 +3178,7 @@ void MainWidget::handle_pending_text_command(std::wstring text) { + open_web_url(utf8_decode(selected_link->uri)); + } + else{ +- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, selected_link->uri); ++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, selected_link->uri); + long_jump_to_destination(page-1, offset_y); + } + } +@@ -3863,7 +3863,7 @@ void MainWidget::handle_link_click(const PdfLink& link) { + return; + } + +- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri); ++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, link.uri); + + // convert one indexed page to zero indexed page + page--; +diff --git a/pdf_viewer/utils.cpp b/pdf_viewer/utils.cpp +index 22d4265..3150e66 100644 +--- a/pdf_viewer/utils.cpp ++++ b/pdf_viewer/utils.cpp +@@ -116,8 +116,9 @@ bool rects_intersect(fz_rect rect1, fz_rect rect2) { + return range_intersects(rect1.x0, rect1.x1, rect2.x0, rect2.x1) && range_intersects(rect1.y0, rect1.y1, rect2.y0, rect2.y1); + } + +-ParsedUri parse_uri(fz_context* mupdf_context, std::string uri) { +- fz_link_dest dest = pdf_parse_link_uri(mupdf_context, uri.c_str()); ++ParsedUri parse_uri(fz_context* mupdf_context, fz_document* fz_doc, std::string uri) { ++ pdf_document* doc = pdf_document_from_fz_document(mupdf_context, fz_doc); ++ fz_link_dest dest = pdf_resolve_link_dest(mupdf_context, doc, uri.c_str()); + return { dest.loc.page + 1, dest.x, dest.y }; + } + +diff --git a/pdf_viewer/utils.h b/pdf_viewer/utils.h +index 2a12211..643b030 100644 +--- a/pdf_viewer/utils.h ++++ b/pdf_viewer/utils.h +@@ -55,7 +55,7 @@ void get_flat_toc(const std::vector& roots, std::vector& + int mod(int a, int b); + bool range_intersects(float range1_start, float range1_end, float range2_start, float range2_end); + bool rects_intersect(fz_rect rect1, fz_rect rect2); +-ParsedUri parse_uri(fz_context* mupdf_context, std::string uri); ++ParsedUri parse_uri(fz_context* mupdf_context, fz_document* fz_doc, std::string uri); + char get_symbol(int key, bool is_shift_pressed, const std::vector&special_symbols); + + template diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm index 0d796f65bb..553642c170 100644 --- a/gnu/packages/pdf.scm +++ b/gnu/packages/pdf.scm @@ -25,6 +25,7 @@ ;;; Copyright © 2022 Paul A. Patience ;;; Copyright © 2022 Petr Hodina ;;; Copyright © 2023 Felix Gruber +;;; Copyright © 2024 dan ;;; ;;; This file is part of GNU Guix. ;;; @@ -1710,3 +1711,58 @@ (define-public weasyprint Keywords: html2pdf, htmltopdf") (license license:bsd-3))) + +(define-public sioyek + (package + (name "sioyek") + (version "2.0.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ahrm/sioyek") + (commit (string-append "v" version)))) + (sha256 + (base32 "1vmmp2s032ygh1byz77pg9aljmp8hx745fr7mmz11831f96mlmhq")) + (modules '((guix build utils))) + (snippet '(substitute* "pdf_viewer_build_config.pro" + (("-lmupdf-third") + ""))) + ;; XXX: Fix for mupdf-0.23.0+ . + (patches (search-patches "sioyek-mupdf-0.23.0-fix-build.patch")))) + (build-system gnu-build-system) + (arguments + (list + #:configure-flags #~(list (string-append "PREFIX=" + #$output)) + #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'patch-paths + (lambda _ + (substitute* "pdf_viewer/main.cpp" + (("/usr/share") + (string-append #$output "/share")) + (("/etc") + (string-append #$output "/etc"))))) + (replace 'configure + (lambda* (#:key configure-flags #:allow-other-keys) + (apply invoke "qmake" configure-flags))) + (add-after 'install 'instal-man-page + (lambda _ + (install-file "resources/sioyek.1" + (string-append #$output "/share/man/man1"))))))) + (inputs (list freetype + gumbo-parser + harfbuzz + jbig2dec + libjpeg-turbo + mujs + mupdf + openjpeg + qt3d-5 + qtbase-5 + zlib)) + (home-page "https://sioyek.info") + (synopsis "PDF viewer with a focus on technical books and research papers") + (description + "Sioyek is a PDF viewer with a focus on textbooks and research papers.") + (license license:gpl3+))) base-commit: b25b94335a3ee8d68d2145da8e5ea0325ecea451 -- 2.41.0