summary refs log tree commit diff
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2023-03-12 18:36:58 +0100
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2023-03-19 09:25:36 +0100
commitd7b4ecdb4c1a845690d943f8b8d883e065081eb9 (patch)
treeeb7a2369d089c61977c07475e84011afba550223
parentfa509741348c1276be550009a096ddc1df7e87e5 (diff)
downloadguix-d7b4ecdb4c1a845690d943f8b8d883e065081eb9.tar.gz
gnu: Add a4pdf.
* gnu/packages/pdf.scm (a4pdf): New variable.
-rw-r--r--gnu/packages/pdf.scm55
1 files changed, 55 insertions, 0 deletions
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 6eee460740..dd1064bd6c 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -89,6 +89,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages photo)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages pretty-print)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-build)
@@ -110,6 +111,60 @@
   #:use-module (gnu packages xorg)
   #:use-module (srfi srfi-1))
 
+(define-public a4pdf
+  (package
+    (name "a4pdf")
+    (version "0.1.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/jpakkane/a4pdf")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "18062cm1qsbaymmjar0whbd7kaggy4x7wzp7xw94kcd1pwx2jp1p"))))
+    (build-system meson-build-system)
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'add-missing-header
+                 (lambda _
+                   (substitute* "src/pdfgen.cpp"
+                     (("#include <cassert>" all)
+                      (string-append all "\n#include <unistd.h>")))))
+               (add-after 'unpack 'fix-glib-application-flags
+                 (lambda _
+                   ;; XXX: remove when bumping glib
+                   (substitute* "src/pdfviewer.cpp"
+                     (("G_APPLICATION_DEFAULT_FLAGS")
+                      "G_APPLICATION_FLAGS_NONE"))))
+               (add-after 'unpack 'fix-broken-tests
+                 (lambda* (#:key inputs native-inputs #:allow-other-keys)
+                   (substitute* "test/a4pdftests.py"
+                     (("'Ghostscript not found, test suite can not be run.'")
+                      ;; Sucks, but there's no point in repairing a certain test
+                      ;; at the moment.
+                      "0")))))))
+    (inputs (list fmt
+                  freetype
+                  gtk
+                  lcms
+                  libjpeg-turbo
+                  libpng
+                  zlib))
+    (native-inputs (list font-google-noto
+                         ;; ghostscript
+                         pkg-config
+                         python
+                         python-pillow))
+    (home-page "https://github.com/jpakkane/a4pdf")
+    (synopsis "Color-managed PDF generator")
+    (description "A4PDF is a low-level libray for generating PDF files.
+It does not have a document model and instead uses PDF primitives
+directly.  It uses LittleCMS for color management but otherwise does not
+convert data in any way.")
+    (license license:asl2.0)))
+
 (define-public extractpdfmark
   (package
     (name "extractpdfmark")