From patchwork Mon Aug 22 09:36:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Wiktor_=C5=BBelazny?= X-Patchwork-Id: 41858 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 86EC227BBE9; Mon, 22 Aug 2022 10:45:59 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id EB30427BBE9 for ; Mon, 22 Aug 2022 10:45:58 +0100 (BST) Received: from localhost ([::1]:60568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQ40M-0003dM-54 for patchwork@mira.cbaines.net; Mon, 22 Aug 2022 05:45:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ3sh-0003Ws-U1 for guix-patches@gnu.org; Mon, 22 Aug 2022 05:38:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ3sg-0003mx-OM for guix-patches@gnu.org; Mon, 22 Aug 2022 05:38:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oQ3sg-0005Zl-KD for guix-patches@gnu.org; Mon, 22 Aug 2022 05:38:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57337] [PATCH 2/2] gnu: Add docxbox. Resent-From: Wiktor =?utf-8?q?=C5=BBelazny?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 22 Aug 2022 09:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57337 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57337@debbugs.gnu.org Cc: Wiktor =?utf-8?q?=C5=BBelazny?= Received: via spool by 57337-submit@debbugs.gnu.org id=B57337.166116104221359 (code B ref 57337); Mon, 22 Aug 2022 09:38:02 +0000 Received: (at 57337) by debbugs.gnu.org; 22 Aug 2022 09:37:22 +0000 Received: from localhost ([127.0.0.1]:37872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ3s1-0005YQ-Qe for submit@debbugs.gnu.org; Mon, 22 Aug 2022 05:37:22 -0400 Received: from freeshell.de ([116.202.128.144]:38892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ3rz-0005YC-Dj for 57337@debbugs.gnu.org; Mon, 22 Aug 2022 05:37:20 -0400 Received: from localhost.localdomain (cst-prg-68-192.cust.vodafone.cz [46.135.68.192]) (Authenticated sender: wz) by freeshell.de (Postfix) with ESMTPSA id 89D9BB36408E; Mon, 22 Aug 2022 11:37:06 +0200 (CEST) From: Wiktor =?utf-8?q?=C5=BBelazny?= Date: Mon, 22 Aug 2022 11:36:51 +0200 Message-Id: <20220822093651.31574-2-wz@freeshell.de> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220822093651.31574-1-wz@freeshell.de> References: <20220822093651.31574-1-wz@freeshell.de> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From: Wiktor Żelazny * gnu/packages/textutils.scm (docxbox): New variable. --- gnu/packages/textutils.scm | 73 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm index 7898d520f0..41a75c727d 100644 --- a/gnu/packages/textutils.scm +++ b/gnu/packages/textutils.scm @@ -18,7 +18,7 @@ ;;; Copyright © 2018 Meiyo Peng ;;; Copyright © 2019 Yoshinori Arai ;;; Copyright © 2019 Mădălin Ionel Patrașcu -;;; Copyright © 2019 Wiktor Żelazny +;;; Copyright © 2019, 2022 Wiktor Żelazny ;;; Copyright © 2020 Maxim Cournoyer ;;; Copyright © 2021 Jean-Baptiste Volatier ;;; Copyright © 2021 Simon Tournier @@ -58,6 +58,7 @@ (define-module (gnu packages textutils) #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages compression) + #:use-module (gnu packages cpp) #:use-module (gnu packages gcc) #:use-module (gnu packages golang) #:use-module (gnu packages gettext) @@ -73,7 +74,8 @@ (define-module (gnu packages textutils) #:use-module (gnu packages ruby) #:use-module (gnu packages slang) #:use-module (gnu packages syncthing) - #:use-module (gnu packages web)) + #:use-module (gnu packages web) + #:use-module (gnu packages xml)) (define-public dos2unix (package @@ -1502,3 +1504,70 @@ (define-public ack easily specify file types, match highlighting, Perl-Compatible Regular Expressions, and being faster to type than grep.") (license license:artistic2.0))) + +(define-public docxbox + (package + (name "docxbox") + (version "0.0.5") + (source (origin + (method url-fetch) + (uri (string-append + "https://github.com/gyselroth/docxbox/archive/refs/tags/" + version ".tar.gz")) + (sha256 + (base32 + "19ik3jhyyk26bj8x2adaxwwj8l4sg1h2kf2d0hw43yhsqki176cb")) + (modules '((guix build utils))) + (snippet '(begin + (for-each delete-file-recursively + '("bin" "vendor/json" "vendor/miniz-cpp" + "vendor/tinyxml2")) #t)))) + (build-system cmake-build-system) + ;; (native-inputs (list bats)) ; Enable after fixing tests, use bash module + (inputs `(("json-modern-cxx-source" ,(package-source json-modern-cxx)) + ("miniz-cpp-source" ,(package-source miniz-cpp)) + ("tinyxml2-source" ,(package-source tinyxml2)))) + (arguments + `(#:phases (modify-phases %standard-phases + (add-after 'unpack 'unpack-json-modern-cxx + (lambda* (#:key inputs #:allow-other-keys) + (mkdir-p "vendor/json-modern-cxx") + (copy-recursively (assoc-ref inputs + "json-modern-cxx-source") + "vendor/json") #t)) + (add-after 'unpack 'unpack-miniz-cpp + (lambda* (#:key inputs #:allow-other-keys) + (mkdir-p "vendor/miniz-cpp") + (copy-recursively (assoc-ref inputs "miniz-cpp-source") + "vendor/miniz-cpp") #t)) + (add-after 'unpack 'unpack-tinyxml2 + (lambda* (#:key inputs #:allow-other-keys) + (mkdir-p "vendor/tinyxml2") + (copy-recursively (assoc-ref inputs "tinyxml2-source") + "vendor/tinyxml2") #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/usr/bin"))) + (install-file "bin/linux/docxbox" bin))))) + #:configure-flags (let* ((out (assoc-ref %outputs "out"))) + '("-DCMAKE_CXX_FLAGS=-fpermissive -Wno-error")) + ;; Tests depend on a bundled binary in bin/linux/, and even with the + ;; binary in place, I could not get them to run. To my understanding, + ;; the setup() function in test/functional/_helper.bash is supposed to + ;; copy the binary to the test suite directory. However, this does not + ;; seem to happen when invoking ./test.sh (make check is not + ;; supported), and the script complains about the missing binary in the + ;; directory. The fix could be to copy the binary built by the Guix + ;; daemon to the test suite directory before invoking ./test.sh, but + ;; this is beyond my skills. + #:tests? #f)) + (home-page "https://github.com/gyselroth/docxbox/") + (synopsis "CLI tool for MS Word DOCX templating and analysis") + (description + "@command{docxbox} enables direct and convenient inspection and +manipulation of XML and media files making up a DOCX file. The +capabilities include batch editing, unpacking and indentation for manual +editing in a text editor and subsequent unindentation and repacking, +operations on metadata, and diffing") + (license license:expat)))