unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Pierre Neidhardt <mail@ambrevar.xyz>
To: Andy Patterson <ajpatter@uwaterloo.ca>
Cc: 32770@debbugs.gnu.org
Subject: bug#32770: Packaging SLIME/SWANK as Common Lisp library
Date: Wed, 03 Oct 2018 20:34:24 +0200	[thread overview]
Message-ID: <8736tmj2vj.fsf@ambrevar.xyz> (raw)
In-Reply-To: <20181003012224.5baff3ac@mailservices.uwaterloo.ca>


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

Last (hopefully?) step before getting Next up and running: add support for CFFI.

I've re-used your CFFI package and they seem to work.  Now if I want to package
cl-sqlite, it fails because sqlite.so cannot be found.  Indeed, the patch to
/gnu/store/...-sqlite.../lib must be added to the
cffi:*foreign-library-directories* global variable before compiling.

If I do that from quicklisp, it works.  Now I guess we need to tweak
asdf-build-system so that packages can specify which paths to add to that global
variable.

Makes sense?

I've given it a quick shot (patch attached) but then every ASDF build fails with

--8<---------------cut here---------------start------------->8---
ice-9/boot-9.scm:222:17: In procedure map1:
Syntax error:
unknown location: unexpected syntax in form ()
--8<---------------cut here---------------end--------------->8---

I'm still lacking good knowledge of the asdf build system.

I'll give it a closer look tomorrow.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-cffi-support.patch --]
[-- Type: text/x-patch, Size: 3212 bytes --]

From 1c4b9b915086b0fdfb4229f5bbfa5aecff784f42 Mon Sep 17 00:00:00 2001
From: Pierre Neidhardt <mail@ambrevar.xyz>
Date: Wed, 3 Oct 2018 20:27:00 +0200
Subject: [PATCH] cffi support

---
 guix/build-system/asdf.scm       | 2 ++
 guix/build/asdf-build-system.scm | 4 ++--
 guix/build/lisp-utils.scm        | 5 ++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm
index 57e294d74..37c219460 100644
--- a/guix/build-system/asdf.scm
+++ b/guix/build-system/asdf.scm
@@ -266,6 +266,7 @@ set up using CL source package conventions."
                   (tests? #t)
                   (asd-file #f)
                   (asd-system-name #f)
+                  (cffi-foreign-library-directories '())
                   (test-asd-file #f)
                   (phases '(@ (guix build asdf-build-system)
                               %standard-phases))
@@ -298,6 +299,7 @@ set up using CL source package conventions."
                        #:asd-file ,(or asd-file (string-append system-name ".asd"))
                        #:asd-system-name ,system-name
                        #:test-asd-file ,test-asd-file
+                       #:cffi-foreign-library-directories ,cffi-foreign-library-directories
                        #:system ,system
                        #:tests? ,tests?
                        #:phases ,phases
diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm
index dd6373b33..7d879ddb9 100644
--- a/guix/build/asdf-build-system.scm
+++ b/guix/build/asdf-build-system.scm
@@ -106,7 +106,7 @@ valid."
       (delete-file-recursively "systems")))
   #t)
 
-(define* (build #:key outputs inputs asd-file asd-system-name
+(define* (build #:key outputs inputs asd-file asd-system-name cffi-foreign-library-directories
                 #:allow-other-keys)
   "Compile the system."
   (let* ((out (library-output outputs))
@@ -121,7 +121,7 @@ valid."
 
     (setenv "HOME" out) ; ecl's asdf sometimes wants to create $HOME/.cache
 
-    (compile-system asd-system-name asd-file)
+    (compile-system asd-system-name asd-file cffi-foreign-library-directories)
 
     ;; As above, ecl will sometimes create this even though it doesn't use it
 
diff --git a/guix/build/lisp-utils.scm b/guix/build/lisp-utils.scm
index 5dea30486..5d7b5afd0 100644
--- a/guix/build/lisp-utils.scm
+++ b/guix/build/lisp-utils.scm
@@ -149,13 +149,16 @@ with PROGRAM."
          `(asdf:load-system ,system))
        systems))
 
-(define (compile-system system asd-file)
+(define* (compile-system system asd-file #:optional cffi-foreign-library-directories)
   "Use a lisp implementation to compile SYSTEM using asdf.  Load ASD-FILE
 first."
   (lisp-eval-program
    `((require :asdf)
      (let ((*package* (find-package :asdf)))
        (load ,asd-file))
+     ,(unless (null? cffi-foreign-library-directories)
+        `(progn (require :cffi)
+                (setq cffi:*foreign-library-directories* ,cffi-foreign-library-directories)))
      (asdf:operate 'asdf:compile-bundle-op ,system))))
 
 (define (system-dependencies system asd-file)
-- 
2.19.0


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


-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  reply	other threads:[~2018-10-03 18:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-19  7:19 bug#32770: Packaging SLIME/SWANK as Common Lisp library Pierre Neidhardt
2018-09-29 19:16 ` Andy Patterson
2018-09-30 21:27   ` Pierre Neidhardt
2018-09-30 21:46     ` Pierre Neidhardt
2018-10-01 13:53       ` Pierre Neidhardt
2018-10-02  8:38         ` Andy Patterson
2018-10-02  8:55       ` Andy Patterson
2018-10-02 10:24         ` Pierre Neidhardt
2018-10-03  5:22           ` Andy Patterson
2018-10-03 18:34             ` Pierre Neidhardt [this message]
2018-10-03 19:48               ` Pierre Neidhardt
2018-10-04  5:03               ` Andy Patterson
2018-10-04  8:37                 ` Pierre Neidhardt
2018-10-04 18:08                   ` Ricardo Wurmus
2018-10-04 20:38                     ` Pierre Neidhardt
2019-10-06 11:53                       ` Pierre Neidhardt
2018-10-05  4:56                   ` Andy Patterson
2018-10-05  8:28                     ` Pierre Neidhardt
2018-10-05 11:44                       ` Ricardo Wurmus
2018-10-05 13:30                         ` Pierre Neidhardt
2018-10-10  5:54                           ` Andy Patterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736tmj2vj.fsf@ambrevar.xyz \
    --to=mail@ambrevar.xyz \
    --cc=32770@debbugs.gnu.org \
    --cc=ajpatter@uwaterloo.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).