Re: [PATCH]: Add CUPS.

2015-01-15 Thread Ricardo Wurmus
 It might be clearer and also easier (because all of %standard-phases
 would be readily usable) to make ijs a separate package, similar to the
 libtool/libltdl split.  WDYT?

Agreed.  I made it a separate package.

 From 8e671fdd888bf9548bf52acf8789500c90d4b072 Mon Sep 17 00:00:00 2001
 From: Ricardo Wurmus ricardo.wur...@mdc-berlin.de
 Date: Wed, 7 Jan 2015 17:49:00 +0100
 Subject: [PATCH 1/3] gnu: Add QPDF.

 * gnu/packages/pdf.scm (qpdf): New variable.

 LGTM.

Thanks, I applied this patch in master.

 From d42e6a3233b7c5142d1c91d8c2b1c751b74bd444 Mon Sep 17 00:00:00 2001
 From: Ricardo Wurmus ricardo.wur...@mdc-berlin.de
 Date: Mon, 5 Jan 2015 13:56:51 +0100
 Subject: [PATCH 3/3] gnu: Add CUPS.

 * gnu/packages/cups.scm: New file.
 * gnu-system.am (GNU_SYSTEM_MODULES): Add it.

 [...]

 + --with-gnu-ld

 I suspect this is not needed; ./configure should be able to determine it
 automatically.

 + --disable-static

 Why?  By default we let packages provide both .so and .a files.

Okay, removed those two.

 +   #:phases
 +   (alist-cons-before
 +'configure
 +'patch-target-dirs
 +(lambda _
 +  (let ((out (assoc-ref %outputs out)))
 +;; install backends, banners and filters to cups-filters output
 +;; directory, not the cups server directory
 +(substitute* Makefile.in
 +  ((CUPS_DATADIR = @CUPS_DATADIR@)
 +   (string-append CUPS_DATADIR =  out /share/cups))
 +  ((pkgcupsserverrootdir = \\$\\(CUPS_SERVERROOT\\))
 +   (string-append pkgcupsserverrootdir =  out))
 +  ((pkgbackenddir = \\$\\(CUPS_SERVERBIN\\)/backend)
 +   (string-append pkgbackenddir = 
 +  out
 +  /backend))
 +  ((pkgfilterdir = \\$\\(CUPS_SERVERBIN\\)/filter)
 +   (string-append pkgfilterdir = 
 +  out
 +  /filter)

 Could you make this phase a ‘snippet’, by using a literal “$(prefix)” or
 “@prefix” instead of ‘out’?

This is now a snippet using $(PREFIX).

 +;; see COPYING for details
 +(license (list license:gpl2
 +   license:gpl2+
 +   license:gpl3
 +   license:gpl3+
 +   license:lgpl2.0+
 +   license:expat

 Could you augment the comment to mention what this license list means?
 Each filter has its own license, or something like that?

Done.  The exact license mapping is a bit complicated, so the comment
still isn't quite as helpful as it probably could be.

 +(define-public cups-minimal
 +  (package
 +(name cups-minimal)

 Could you add a comment with the explanation that you gave in this
 message as to why it is needed?

Done.

 +(define-public cups
 +  (package
 +(name cups)

 I think this should inherit from ‘cups-minimal’, and just change the
 ‘name’ and ‘arguments’ fields.  WDYT?


cups now inherits from cups-minimal.

 +(synopsis CUPS printing system)

 What about “The Common Unix Printing System”?

 +(description
 + CUPS printing system provides a portable printing layer for UNIX®
 +operating systems.  It has been developed by Apple Inc. to promote a 
 standard
 +printing solution for all UNIX vendors and users.  CUPS provides the System 
 V
 +and Berkeley command-line interfaces.)

 What about this (based on README.txt):

   CUPS is a printing system that uses the Internet Printing Protocol
   (IPP).  It provides System V and BSD command-line interfaces, as well
   as a Web interface and a C programming interface to manage printers
   and print jobs.  It supports printing to both local (parallel, serial,
   USB) and networked printers, and printers can be shared from one
   computer to another.  Internally, CUPS uses PostScript Printer
   Description (PPD) files to describe printer capabilities and features
   and a wide variety of generic and device-specific programs to convert
   and print many types of files.

I updated both synopsis and description.

Attached are the two remaining patches.

-- Ricardo


From a78114013bdbbff310014815cb47abd38bb0c59c Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus ricardo.wur...@mdc-berlin.de
Date: Wed, 14 Jan 2015 14:47:37 +0100
Subject: [PATCH 1/2] gnu: Add IJS

* gnu/packages/ghostscript.scm (ijs): New variable.
---
 gnu/packages/ghostscript.scm | 46 
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 405b4e7..3100f8a 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013 Andreas Enge andr...@enge.fr
 ;;; Copyright © 2014 Mark H Weaver m...@netris.org
+;;; Copyright © 2015 Ricardo Wurmus rek...@elephly.net
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,6 

Re: [PATCH]: Add CUPS.

2015-01-10 Thread Ludovic Courtès
Ricardo Wurmus ricardo.wur...@mdc-berlin.de skribis:

 * IJS is part of ghostscript, but for some reason is not built even when
   passing --with-ijs as a configure flag.  There is no configure
   script and no usable Makefile in ./ijs, so we actually have to run
   ./autogen.sh after generating macros that work with libtool 2.4.2.
   The second patch adds a new very ugly phase that does just that.  I'd
   love to change this if someone can come up with a better way to do
   this.

It might be clearer and also easier (because all of %standard-phases
would be readily usable) to make ijs a separate package, similar to the
libtool/libltdl split.  WDYT?

 * cups-filters also depends on CUPS libraries and binaries, so
   cups-minimal has been added to satisfy this dependency.  During
   installation, cups-filters attempts to install files to the CUPS
   package output directory.  The install phase is modified to direct the
   files to the output directory of cups-filters.

OK.

 * the CUPS package itself then adds links to the required files in
   cups-filters.  CUPS does not come with a mechanism to load filters,
   backends, charsets, mime files, etc from alternative directories, so I
   chose to use symlinks.

Makes sense.

 * the CUPS tests are run before the installation of any symlinks, so to
   establish a working test environment quite a lot of fixes to the test
   phase are needed.  Without the files from cups-filters seven tests
   fail.  With the files in place only three tests fail.  I have not been
   able to fix these remaining failures, even though I have been trying
   for a long time.

Fair enough.

 From 8e671fdd888bf9548bf52acf8789500c90d4b072 Mon Sep 17 00:00:00 2001
 From: Ricardo Wurmus ricardo.wur...@mdc-berlin.de
 Date: Wed, 7 Jan 2015 17:49:00 +0100
 Subject: [PATCH 1/3] gnu: Add QPDF.

 * gnu/packages/pdf.scm (qpdf): New variable.

LGTM.

 From 36eac76f1aa129f2e22d4341fe4d64d4c5b8fd0a Mon Sep 17 00:00:00 2001
 From: Ricardo Wurmus ricardo.wur...@mdc-berlin.de
 Date: Fri, 9 Jan 2015 15:19:54 +0100
 Subject: [PATCH 2/3] gnu: ghostscript: build IJS library

 * gnu/packages/ghostscript.scm (ghostscript): build and install IJS library
   and header files.

[...]

 +`(#:configure-flags '(--with-ijs)

If this flag has no effect, better remove it.  However, it would be good
to add a comment explaining that --with-ijs cannot be used because it
doesn’t work as advertised.

 +   (alist-cons-after
 +'build 'install-ijs-so
 +(lambda* (#:key outputs #:allow-other-keys)
 +  ;; need to regenerate macros
 +  (system* autoreconf -if)
 +  (substitute* autogen.sh
 +((\\$srcdir/configure) (string-append (which bash)  
 $srcdir/configure)))
 +  (system* bash autogen.sh)
 +
 +  ;; build and install ijs
 +  (with-directory-excursion ijs
 +(substitute* autogen.sh
 +  ((/bin/sh) (which bash)))
 +(system* bash autogen.sh)
 +(substitute* configure
 +  ((/bin/sh) (which bash)))
 +(setenv SHELL (which sh))
 +(setenv CONFIG_SHELL (which sh))
 +(system* ./configure (string-append --prefix= (assoc-ref 
 outputs out)))
 +(system* make)
 +(zero? (system* make install
 + (alist-cons-after
 +  'build 'build-so
 +  (lambda _ (system* make so))
 +  (alist-cons-after
 +   'install 'install-so
 +   (lambda _ (system* make install-so))
 +   (alist-cons-after
 +'install 'install-ijs-headers
 +(lambda _
 +  (let* ((out(assoc-ref %outputs out))
 + (ijsinclude (string-append out /include/ijs/)))
 +(mkdir-p ijsinclude)
 +(for-each (lambda (file)
 +(copy-file file (string-append ijsinclude 
 (basename file
 +  (find-files ijs/ \\.h$
 +%standard-phases)))

I suspect this will be simplified by making IJS a separate package.

BTW, make sure that phases return #t on success on #f on failure.  A
phase that finishes with a call type ‘system*’ must typically do:

  (lambda _
;; ...
(zero? (system* make install)))

 From d42e6a3233b7c5142d1c91d8c2b1c751b74bd444 Mon Sep 17 00:00:00 2001
 From: Ricardo Wurmus ricardo.wur...@mdc-berlin.de
 Date: Mon, 5 Jan 2015 13:56:51 +0100
 Subject: [PATCH 3/3] gnu: Add CUPS.

 * gnu/packages/cups.scm: New file.
 * gnu-system.am (GNU_SYSTEM_MODULES): Add it.

[...]

 + --with-gnu-ld

I suspect this is not needed; ./configure should be able to determine it
automatically.

 + --disable-static

Why?  By default we let packages provide both .so and .a files.

 +   #:phases
 +   (alist-cons-before
 +'configure
 +'patch-target-dirs
 +(lambda _
 +  (let ((out (assoc-ref %outputs out)))
 +;; install backends, 

Re: [PATCH]: Add CUPS.

2015-01-09 Thread Ricardo Wurmus
Attached is a more comprehensive patch set to add CUPS.

CUPS on non-MacOS systems depends on cups-filters, which in turn depends
on QPDF and IJS.

* QPDF is added by the first patch.

* IJS is part of ghostscript, but for some reason is not built even when
  passing --with-ijs as a configure flag.  There is no configure
  script and no usable Makefile in ./ijs, so we actually have to run
  ./autogen.sh after generating macros that work with libtool 2.4.2.
  The second patch adds a new very ugly phase that does just that.  I'd
  love to change this if someone can come up with a better way to do
  this.

* cups-filters also depends on CUPS libraries and binaries, so
  cups-minimal has been added to satisfy this dependency.  During
  installation, cups-filters attempts to install files to the CUPS
  package output directory.  The install phase is modified to direct the
  files to the output directory of cups-filters.

* the CUPS package itself then adds links to the required files in
  cups-filters.  CUPS does not come with a mechanism to load filters,
  backends, charsets, mime files, etc from alternative directories, so I
  chose to use symlinks.

* the CUPS tests are run before the installation of any symlinks, so to
  establish a working test environment quite a lot of fixes to the test
  phase are needed.  Without the files from cups-filters seven tests
  fail.  With the files in place only three tests fail.  I have not been
  able to fix these remaining failures, even though I have been trying
  for a long time.

I have addressed your previous comments about outputs and the CUPS
license (gpl2 instead of gpl2+).

Thanks in advance for your review!

-- Ricardo

From 8e671fdd888bf9548bf52acf8789500c90d4b072 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus ricardo.wur...@mdc-berlin.de
Date: Wed, 7 Jan 2015 17:49:00 +0100
Subject: [PATCH 1/3] gnu: Add QPDF.

* gnu/packages/pdf.scm (qpdf): New variable.
---
 gnu/packages/pdf.scm | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 0f9098d..02b55ac 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -37,6 +37,8 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages pcre)
+  #:use-module (gnu packages perl)
   #:use-module (srfi srfi-1))
 
 (define-public poppler
@@ -238,3 +240,43 @@ 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+)))
+
+(define-public qpdf
+  (package
+   (name qpdf)
+   (version 5.1.2)
+   (source (origin
+(method url-fetch)
+(uri (string-append mirror://sourceforge/qpdf/qpdf-
+version .tar.gz))
+(sha256 (base32
+ 1zbvhrp0zjzbi6q2bnbxbg6399r47pq5gw3kspzph81j19fqvpg9
+   (build-system gnu-build-system)
+   (arguments
+  '(#:phases (alist-cons-before
+  'configure 'patch-paths
+  (lambda _
+(substitute* make/libtool.mk
+  ((SHELL=/bin/bash)
+   (string-append SHELL= (which bash
+(substitute* (append
+  '(qtest/bin/qtest-driver)
+  (find-files . \\.test))
+  ((/usr/bin/env) (which env
+  %standard-phases)))
+   (native-inputs
+`((pkg-config ,pkg-config)))
+   (propagated-inputs
+`((pcre ,pcre)))
+   (inputs
+`((zlib ,zlib)
+  (perl ,perl)))
+   (synopsis Command-line tools and library for transforming PDF files)
+   (description
+QPDF is a command-line program that does structural, content-preserving
+transformations on PDF files.  It could have been called something like
+pdf-to-pdf.  It includes support for merging and splitting PDFs and to
+manipulate the list of pages in a PDF file.  It is not a PDF viewer or a
+program capable of converting PDF into other formats.)
+   (license license:clarified-artistic)
+   (home-page http://qpdf.sourceforge.net/;)))
-- 
1.9.3

From 36eac76f1aa129f2e22d4341fe4d64d4c5b8fd0a Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus ricardo.wur...@mdc-berlin.de
Date: Fri, 9 Jan 2015 15:19:54 +0100
Subject: [PATCH 2/3] gnu: ghostscript: build IJS library

* gnu/packages/ghostscript.scm (ghostscript): build and install IJS library
  and header files.
---
 gnu/packages/ghostscript.scm | 61 +++-
 1 file changed, 49 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 405b4e7..bef0551 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 

Re: [PATCH]: Add CUPS.

2015-01-05 Thread Thompson, David
On Mon, Jan 5, 2015 at 8:04 AM, Ricardo Wurmus
ricardo.wur...@mdc-berlin.de wrote:

 I'm also not sure if creating two outputs out and include is
 correct.  To build OpenJDK with IcedTea I need to have both the library
 output and the include files and after splitting the outputs this worked
 fine.

That doesn't seem correct.  I don't see a reason to have a second
output here.  With a single output out, everything will be included.

- Dave



Re: [PATCH]: Add CUPS.

2015-01-05 Thread Ricardo Wurmus

Thompson, David writes:

 On Mon, Jan 5, 2015 at 8:04 AM, Ricardo Wurmus
 ricardo.wur...@mdc-berlin.de wrote:

 I'm also not sure if creating two outputs out and include is
 correct.  To build OpenJDK with IcedTea I need to have both the library
 output and the include files and after splitting the outputs this worked
 fine.

 That doesn't seem correct.  I don't see a reason to have a second
 output here.  With a single output out, everything will be included.

I'm sure you are right; this is probably a case of cargo-cult
programming...  The recipe for OpenJDK/IcedTea is still pretty messy at
this point and I suppose this confused me.

I'll try again with a single output.




Re: [PATCH]: Add CUPS.

2015-01-05 Thread Ricardo Wurmus

Ludovic Courtès writes:

 Ricardo Wurmus ricardo.wur...@mdc-berlin.de skribis:

 There are a couple of problems with this package, one of which is that
 the test suite is failing for some reason.  I have not been able to
 figure out why the cupsFileFind test fails, so I disabled the tests.

 OK.  Do you have any more details from the test suite log?

I looked at this again and suddenly figured out what went wrong
(hardcoded search path for cat in a call to cupsFileFind).  The
tests take a good while longer now and there are seven more failures
that I will work on before resubmitting an updated patch.

 The reason for splitting would be if it turns out that the include
 directory takes a fair amount of space that is not needed in many
 cases.  If that’s the case, then splitting makes sense.  That may well
 be the case: what’s the side of each of these outputs?

I see that splitting would not be required in this case; the outputs are
very small (6+MB for out and 240+kB for include).

 +(license license:gpl2+)))

 Isn’t it GPLv2-only?

You are right (I was so sure I checked this).  I'll fix this in the
updated patch.

Best,
Ricardo



Re: [PATCH]: Add CUPS.

2015-01-05 Thread Ludovic Courtès
Ricardo Wurmus ricardo.wur...@mdc-berlin.de skribis:

 There are a couple of problems with this package, one of which is that
 the test suite is failing for some reason.  I have not been able to
 figure out why the cupsFileFind test fails, so I disabled the tests.

OK.  Do you have any more details from the test suite log?

 I'm also not sure if creating two outputs out and include is
 correct.  To build OpenJDK with IcedTea I need to have both the library
 output and the include files and after splitting the outputs this worked
 fine.

The reason for splitting would be if it turns out that the include
directory takes a fair amount of space that is not needed in many
cases.  If that’s the case, then splitting makes sense.  That may well
be the case: what’s the side of each of these outputs?

If it’s just that it happens to fix OpenJDK as a side effect, that’s not
a good reason.  :-)

 Finally, I have not actually tried to use CUPS at all, because I only
 really need the libs and headers to build OpenJDK.

OK but that’ll be useful eventually to get Evince and friends to print
correctly.

 +(license license:gpl2+)))

Isn’t it GPLv2-only?

The rest looks good to me.

Thanks,
Ludo’.



Re: [PATCH]: Add CUPS.

2015-01-05 Thread Ludovic Courtès
BTW, if you create an account on Savannah, I can add you to the group so
you can commit by yourself.

Ludo’.