The bottom line of the following text is the question: Is it possible to
combine 2 (or more) build systems for building a package?

I've noticed that the latest 'emacs-pdf-tools' depends on 'let-alist'
library (my bad that I didn't notice this during update to 0.70), so I
added it to the propagated-inputs (as we do with emacs dependencies).

However, adding a new input is not enough here, because a directory with
"let-alist.el" is not seen during elisp compilation, so it should be
added explicitly to 'emacs-byte-compile-directory' procedure.

The root problem here is this: pdf-tools package consists of 2 parts:

1. Some C code (placed in "server" subdir) used to make an auxiliary
   binary for working with pdf.  This server part provides a usual GNU
   build system, which is gladly used in our "emacs-pdf-tools" package.

2. Elisp code: to handle this part (to compile and install it) we use
   'install-lisp' phase.

For the elisp side, we actually duplicate (more or less) what is already
done by emacs-build-system.  So it would be a perfect solution for this
package if there was a way to perform a build twice: at first using
emacs-build-system to handle elisp part, and then using gnu-build-system
for the C part.

I did a little experiment: I thought maybe it could be possible just to
pick some build phases from (guix build emacs-build-system), so I added
this module to #:modules and #:imported-modules and added phases like
this:

  (modify-phases %standard-phases
    ;; ...
    (add-after 'build 'emacs-build
      (@@ (guix build emacs-build-system) build))
    (add-after 'install 'emacs-install
      (@@ (guix build emacs-build-system) install)))

The package was built successfully, but the result was not good, because
both gnu-build-system and emacs-build-system import %standard-phases :-)

>From 5692ba83371fea16a34ff20d1f5d743f05173348 Mon Sep 17 00:00:00 2001
From: Alex Kost <alez...@gmail.com>
Date: Fri, 11 Mar 2016 11:34:20 +0300
Subject: [PATCH] gnu: emacs-pdf-tools: Add missing input.

This is a followup to commit eccd0b57a1f05b3caca28604f4d2c06556e2fe05.

* gnu/packages/emacs.scm (emacs-pdf-tools)[propagated-inputs]: Add
'let-alist'.
[arguments]: Adjust 'install-lisp' phase to compile pdf-tools using
let-alist library.
---
 gnu/packages/emacs.scm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index c9fbfcf..ecc6817 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1044,18 +1044,24 @@ single buffer.")
                 ("pdf-tools-handle-upgrades" '())))))
          (add-after
           'install 'install-lisp
-          (lambda* (#:key outputs #:allow-other-keys)
+          (lambda* (#:key inputs outputs #:allow-other-keys)
             (let ((target (string-append (assoc-ref outputs "out")
-                                         "/share/emacs/site-lisp/")))
+                                         "/share/emacs/site-lisp/"))
+                  (let-alist (string-append
+                              (assoc-ref inputs "let-alist")
+                              "/share/emacs/site-lisp/guix.d/let-alist-"
+                              ,(package-version let-alist))))
               (for-each (lambda (file)
                           (install-file file target))
                         (find-files "../lisp" "^(pdf|tab).*\\.elc?"))
-              (emacs-byte-compile-directory target)
+              (emacs-byte-compile-directory target (list let-alist))
               (emacs-generate-autoloads "pdf-tools" target)))))))
     (native-inputs `(("autoconf" ,autoconf)
                      ("automake" ,automake)
                      ("pkg-config" ,pkg-config)
                      ("emacs" ,emacs-no-x)))
+    (propagated-inputs
+     `(("let-alist" ,let-alist)))
     (inputs `(("poppler" ,poppler)
               ("cairo" ,cairo)
               ("glib" ,glib)
-- 
2.6.3

Reply via email to