all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 3/3] gnu: Add mupdf
@ 2014-09-14  9:15 Dušan Xmetov
  2014-09-15  4:59 ` Alex Kost
  0 siblings, 1 reply; 4+ messages in thread
From: Dušan Xmetov @ 2014-09-14  9:15 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: mupdf.patch --]
[-- Type: application/octet-stream, Size: 7088 bytes --]

From bfe5d62ebe379d9d3b5dde812316f7cefe94ddf5 Mon Sep 17 00:00:00 2001
From: Marek Benc <merkur32@gmail.com>
Date: Sun, 14 Sep 2014 11:08:10 +0200
Subject: [PATCH] gnu: Add mupdf

* gnu/packages/pdf.scm (mupdf): New variable.
* gnu/packages/patches/mupdf-buildsystem-fix.patch: New vile.
* gnu-system.am (dist_patch_DATA): Added the patch above.
---
 gnu-system.am                                    |  1 +
 gnu/packages/patches/mupdf-buildsystem-fix.patch | 69 ++++++++++++++++++++++++
 gnu/packages/pdf.scm                             | 67 +++++++++++++++++++++++
 3 files changed, 137 insertions(+)
 create mode 100644 gnu/packages/patches/mupdf-buildsystem-fix.patch

diff --git a/gnu-system.am b/gnu-system.am
index bf896bf..87cb122 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -372,6 +372,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/mit-krb5-init-fix.patch			\
   gnu/packages/patches/mpc123-initialize-ao.patch		\
   gnu/packages/patches/module-init-tools-moduledir.patch	\
+  gnu/packages/patches/mupdf-buildsystem-fix.patch		\
   gnu/packages/patches/nvi-assume-preserve-path.patch           \
   gnu/packages/patches/orpheus-cast-errors-and-includes.patch	\
   gnu/packages/patches/ots-no-include-missing-file.patch	\
diff --git a/gnu/packages/patches/mupdf-buildsystem-fix.patch b/gnu/packages/patches/mupdf-buildsystem-fix.patch
new file mode 100644
index 0000000..0b17dda
--- /dev/null
+++ b/gnu/packages/patches/mupdf-buildsystem-fix.patch
@@ -0,0 +1,69 @@
+Since openjpeg doesn't seem to ship with a .pc file, provide an alternative.
+
+--- a/ojp2_cppflags.sh	1970-01-01 01:00:00.000000000 +0100
++++ b/ojp2_cppflags.sh	2014-09-13 22:56:38.842418777 +0200
+@@ -0,0 +1,7 @@
++#!/bin/sh
++
++# Return the preprocessor flags to link against openjpeg.
++
++cpppath=$(echo ${NIX_STORE}/*-openjpeg-*/include/openjpeg-*)
++
++echo -I$cpppath
+
+--- a/ojp2_ldflags.sh	1970-01-01 01:00:00.000000000 +0100
++++ b/ojp2_ldflags.sh	2014-09-13 22:56:38.842418777 +0200
+@@ -0,0 +1,7 @@
++#!/bin/sh
++
++# Return the linker flags to link against openjpeg.
++
++ldpath=$(echo ${NIX_STORE}/*-openjpeg-*/lib)
++
++echo -L$ldpath -lopenjp2
+
+Make use of the above alternatives, compile with gcc.
+
+--- a/Makerules	2014-09-14 09:13:40.729149860 +0200
++++ b/Makerules	2014-09-14 09:17:06.425156595 +0200
+@@ -75,12 +75,14 @@
+ 
+ SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2)
+ SYS_FREETYPE_LIBS = $(shell pkg-config --libs freetype2)
+-SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjp2)
+-SYS_OPENJPEG_LIBS = $(shell pkg-config --libs libopenjp2)
++SYS_OPENJPEG_CFLAGS = $(shell ./ojp2_cppflags.sh)
++SYS_OPENJPEG_LIBS = $(shell ./ojp2_ldflags.sh)
+ SYS_JBIG2DEC_LIBS = -ljbig2dec
+ SYS_JPEG_LIBS = -ljpeg
+ SYS_ZLIB_LIBS = -lz
+ 
++CC = gcc
++
+ endif
+ 
+ # The following section is an example of how to simply do cross-compilation
+
+Remove the -x11 from the built binaries, since X11 is implied on GNU. (This
+might change when Wayland gets more popular)
+
+--- a/Makefile	2014-06-10 17:09:28.000000000 +0200
++++ b/Makefile	2014-09-14 09:57:10.381235299 +0200
+@@ -255,7 +255,7 @@
+ 	$(LINK_CMD)
+ 
+ ifeq "$(HAVE_X11)" "yes"
+-MUVIEW_X11 := $(OUT)/mupdf-x11
++MUVIEW_X11 := $(OUT)/mupdf
+ MUVIEW_X11_OBJ := $(addprefix $(OUT)/platform/x11/, x11_main.o x11_image.o pdfapp.o)
+ $(MUVIEW_X11_OBJ) : $(FITZ_HDR) $(PDF_HDR)
+ $(MUVIEW_X11) : $(MUPDF_LIB) $(THIRD_LIBS)
+@@ -263,7 +263,7 @@
+ 	$(LINK_CMD) $(X11_LIBS)
+ 
+ ifeq "$(HAVE_CURL)" "yes"
+-MUVIEW_X11_CURL := $(OUT)/mupdf-x11-curl
++MUVIEW_X11_CURL := $(OUT)/mupdf-curl
+ MUVIEW_X11_CURL_OBJ := $(addprefix $(OUT)/platform/x11/curl/, x11_main.o x11_image.o pdfapp.o curl_stream.o)
+ $(MUVIEW_X11_CURL_OBJ) : $(FITZ_HDR) $(PDF_HDR)
+ $(MUVIEW_X11_CURL) : $(MUPDF_LIB) $(THIRD_LIBS) $(CURL_LIB)
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 82331a1..54f8335 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -25,6 +25,7 @@
   #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages curl)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages lesstif)
@@ -159,3 +160,69 @@ it easy to modify them and write the changes to disk.  It is primarily useful
 for applications that wish to do lower level manipulation of PDF, such as
 extracting content or merging files.")
     (license license:lgpl2.0+)))
+
+(define-public mupdf
+  (package
+    (name "mupdf")
+    (version "1.5")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "http://mupdf.com/downloads/" name "-" version
+                            "-source.tar.gz"))
+        (sha256
+          (base32 "0sl47zqf4c9fhs4h5zg046vixjmwgy4vhljhr5g4md733nash7z4"))
+        (patches
+          (list (search-patch "mupdf-buildsystem-fix.patch")))
+        (modules '((guix build utils)))
+        (snippet
+          '(begin
+            ;; Don't build the bundled-in third party libraries.
+            (delete-file-recursively "thirdparty")
+
+            ;; Make the scripts for finding openjpeg build details executable.
+            (chmod "ojp2_cppflags.sh" #o0755)
+            (chmod "ojp2_ldflags.sh" #o0755)))))
+
+    (build-system gnu-build-system)
+    (inputs
+      `(("curl" ,curl)
+        ("freetype", freetype)
+        ("jbig2dec" ,jbig2dec)
+        ("libjpeg" ,libjpeg)
+        ("libx11" ,libx11)
+        ("libxext" ,libxext)
+        ("openjpeg" ,openjpeg) ;; Don't ask me why it requires 2 different
+        ("openssl" ,openssl)   ;; JPEG libraries.
+        ("zlib" ,zlib)))
+    (native-inputs
+      `(("pkg-config" ,pkg-config)))
+    (arguments
+      ;; Trying to run `$ make check' results in a no rule fault.
+      '(#:tests? #f
+
+        #:modules ((guix build gnu-build-system)
+                     (guix build utils)
+                     (srfi srfi-1))
+        #:phases (alist-replace
+                   'build
+                   (lambda _ (zero? (system* "make" "XCFLAGS=-fpic")))
+                   (alist-replace
+                     'install
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (let ((out (assoc-ref outputs "out")))
+                         (zero? (system* "make" (string-append "prefix=" out)
+                                         "install"))))
+                     (alist-delete 'configure %standard-phases)))))
+    (home-page "http://mupdf.com")
+    (synopsis "A lightweight PDF viewer and toolkit.")
+    (description
+      "MuPDF is a C library that implements a PDF and XPS parsing and rendering
+engine. It is used primarily to render pages into bitmaps, but also provides
+support for other operations such as searching and listing the table of
+contents and hyperlinks.
+
+The library ships with a rudimentary X11 viewer, and a set of command line tools
+for batch rendering (pdfdraw), examining the file structure (pdfshow), and
+rewriting files (pdfclean).")
+    (license license:agpl3+)))
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] gnu: Add mupdf
  2014-09-14  9:15 [PATCH 3/3] gnu: Add mupdf Dušan Xmetov
@ 2014-09-15  4:59 ` Alex Kost
  2014-09-15  5:20   ` Dušan Xmetov
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Kost @ 2014-09-15  4:59 UTC (permalink / raw)
  To: Dušan Xmetov; +Cc: guix-devel

Hello, I don't have real comments, I just noticed a couple of typos.

Dušan Xmetov (2014-09-14 13:15 +0400) wrote:

> From bfe5d62ebe379d9d3b5dde812316f7cefe94ddf5 Mon Sep 17 00:00:00 2001
> From: Marek Benc <merkur32@gmail.com>
> Date: Sun, 14 Sep 2014 11:08:10 +0200
> Subject: [PATCH] gnu: Add mupdf
>
> * gnu/packages/pdf.scm (mupdf): New variable.
> * gnu/packages/patches/mupdf-buildsystem-fix.patch: New vile.

New file.

[...]

> +Make use of the above alternatives, compile with gcc.
> +
> +--- a/Makerules	2014-09-14 09:13:40.729149860 +0200
> ++++ b/Makerules	2014-09-14 09:17:06.425156595 +0200
> +@@ -75,12 +75,14 @@
> + 
trailing space.

> + SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2)
> + SYS_FREETYPE_LIBS = $(shell pkg-config --libs freetype2)
> +-SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjp2)
> +-SYS_OPENJPEG_LIBS = $(shell pkg-config --libs libopenjp2)
> ++SYS_OPENJPEG_CFLAGS = $(shell ./ojp2_cppflags.sh)
> ++SYS_OPENJPEG_LIBS = $(shell ./ojp2_ldflags.sh)
> + SYS_JBIG2DEC_LIBS = -ljbig2dec
> + SYS_JPEG_LIBS = -ljpeg
> + SYS_ZLIB_LIBS = -lz
> + 
trailing space.

> ++CC = gcc
> ++
> + endif
> + 
trailing space.

> + # The following section is an example of how to simply do cross-compilation
> +
> +Remove the -x11 from the built binaries, since X11 is implied on GNU. (This
> +might change when Wayland gets more popular)
> +
> +--- a/Makefile	2014-06-10 17:09:28.000000000 +0200
> ++++ b/Makefile	2014-09-14 09:57:10.381235299 +0200
> +@@ -255,7 +255,7 @@
> + 	$(LINK_CMD)
> + 
trailing space.

> + ifeq "$(HAVE_X11)" "yes"
> +-MUVIEW_X11 := $(OUT)/mupdf-x11
> ++MUVIEW_X11 := $(OUT)/mupdf
> + MUVIEW_X11_OBJ := $(addprefix $(OUT)/platform/x11/, x11_main.o x11_image.o pdfapp.o)
> + $(MUVIEW_X11_OBJ) : $(FITZ_HDR) $(PDF_HDR)
> + $(MUVIEW_X11) : $(MUPDF_LIB) $(THIRD_LIBS)
> +@@ -263,7 +263,7 @@
> + 	$(LINK_CMD) $(X11_LIBS)
> + 
trailing space.

[...]

> +    (inputs
> +      `(("curl" ,curl)
> +        ("freetype", freetype)

("freetype" ,freetype)

[...]

> +    (synopsis "A lightweight PDF viewer and toolkit.")
> +    (description
> +      "MuPDF is a C library that implements a PDF and XPS parsing and rendering
> +engine. It is used primarily to render pages into bitmaps, but also provides
> +support for other operations such as searching and listing the table of
> +contents and hyperlinks.
> +
> +The library ships with a rudimentary X11 viewer, and a set of command line tools
> +for batch rendering (pdfdraw), examining the file structure (pdfshow), and
> +rewriting files (pdfclean).")
> +    (license license:agpl3+)))

I think people usually avoid a period in a synopsis and use a double
space after a period in a description.  Also the description should be
wrapped by 72 (or 78?) characters in a line.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] gnu: Add mupdf
  2014-09-15  4:59 ` Alex Kost
@ 2014-09-15  5:20   ` Dušan Xmetov
  2014-09-15  6:52     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Dušan Xmetov @ 2014-09-15  5:20 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

On 9/15/14, Alex Kost <alezost@gmail.com> wrote:
> Hello, I don't have real comments, I just noticed a couple of typos.

Thanks :)

>>
>> * gnu/packages/pdf.scm (mupdf): New variable.
>> * gnu/packages/patches/mupdf-buildsystem-fix.patch: New vile.
>
> New file.
>

Yup.

>
> 5 * trailing space.
>

They were generated by diff, won't removing them break the patch?

>
>> +    (inputs
>> +      `(("curl" ,curl)
>> +        ("freetype", freetype)
>
> ("freetype" ,freetype)
>

Yup.

>
>> +    (synopsis "A lightweight PDF viewer and toolkit.")
>> +    (description
>> +      "MuPDF is a C library that implements a PDF and XPS parsing and
>> rendering
>> +engine. It is used primarily to render pages into bitmaps, but also
>> provides
>> +support for other operations such as searching and listing the table of
>> +contents and hyperlinks.
>> +
>> +The library ships with a rudimentary X11 viewer, and a set of command
>> line tools
>> +for batch rendering (pdfdraw), examining the file structure (pdfshow),
>> and
>> +rewriting files (pdfclean).")
>> +    (license license:agpl3+)))
>
> I think people usually avoid a period in a synopsis and use a double
> space after a period in a description.  Also the description should be
> wrapped by 72 (or 78?) characters in a line.

Yup. Thanks for the reply, I'll try to fix the patch, but I don't know
about the trailing spaces, I kind of don't want to touch diff's
output.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] gnu: Add mupdf
  2014-09-15  5:20   ` Dušan Xmetov
@ 2014-09-15  6:52     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2014-09-15  6:52 UTC (permalink / raw)
  To: Dušan Xmetov; +Cc: guix-devel, Alex Kost

Dušan Xmetov <merkur32@gmail.com> skribis:

> On 9/15/14, Alex Kost <alezost@gmail.com> wrote:
>> 5 * trailing space.
>>
>
> They were generated by diff, won't removing them break the patch?

I’m not sure, and that’s why I think it’s OK to keep trailing spaces in
diffs (and because the tools generate them this way.)

>>
>>> +    (inputs
>>> +      `(("curl" ,curl)
>>> +        ("freetype", freetype)
>>
>> ("freetype" ,freetype)
>>
>
> Yup.
>
>>
>>> +    (synopsis "A lightweight PDF viewer and toolkit.")
>>> +    (description
>>> +      "MuPDF is a C library that implements a PDF and XPS parsing and
>>> rendering
>>> +engine. It is used primarily to render pages into bitmaps, but also
>>> provides
>>> +support for other operations such as searching and listing the table of
>>> +contents and hyperlinks.
>>> +
>>> +The library ships with a rudimentary X11 viewer, and a set of command
>>> line tools
>>> +for batch rendering (pdfdraw), examining the file structure (pdfshow),
>>> and
>>> +rewriting files (pdfclean).")
>>> +    (license license:agpl3+)))
>>
>> I think people usually avoid a period in a synopsis and use a double
>> space after a period in a description.  Also the description should be
>> wrapped by 72 (or 78?) characters in a line.

Indeed.  Actually ‘guix lint mupdf’ would tell you that the synopsis
shouldn’t start with “A” and shouldn’t end with a period.

Thanks in advance!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-15  6:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-14  9:15 [PATCH 3/3] gnu: Add mupdf Dušan Xmetov
2014-09-15  4:59 ` Alex Kost
2014-09-15  5:20   ` Dušan Xmetov
2014-09-15  6:52     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.